summaryrefslogtreecommitdiff
path: root/ext/stringio/stringio.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-15 12:05:46 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-15 12:05:46 +0000
commitd7976d145193379d8c43f33e9a5714292a40d994 (patch)
tree91b0975cbe29241078aba41607420adeed680a35 /ext/stringio/stringio.c
parentd154bec0d5f0dd32e0d30559ab8a0a7ed8be98d2 (diff)
downloadruby-d7976d145193379d8c43f33e9a5714292a40d994.tar.gz
Use `&` instead of `modulo`
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/stringio/stringio.c')
-rw-r--r--ext/stringio/stringio.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index 47c2c50b95..6ae9e805b5 100644
--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -810,11 +810,11 @@ strio_ungetbyte(VALUE self, VALUE c)
return Qnil;
case T_FIXNUM:
case T_BIGNUM: ;
- /* rb_int_modulo() not visible from exts */
- VALUE v = rb_funcall(c, rb_intern("modulo"), 1, INT2FIX(256));
- unsigned char cc = NUM2INT(v) & 0xFF;
- c = rb_str_new((const char *)&cc, 1);
- break;
+ /* rb_int_and() not visible from exts */
+ VALUE v = rb_funcall(c, '&', 1, INT2FIX(0xff));
+ const char cc = NUM2INT(v) & 0xFF;
+ strio_unget_bytes(ptr, &cc, 1);
+ return Qnil;
default:
SafeStringValue(c);
}