summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/string.c b/string.c
index 677a82eda9..3fb123be80 100644
--- a/string.c
+++ b/string.c
@@ -1692,7 +1692,7 @@ rb_str_aset(str, indx, val)
switch (TYPE(indx)) {
case T_FIXNUM:
num_index:
- idx = NUM2LONG(indx);
+ idx = FIX2LONG(indx);
if (RSTRING(str)->len <= idx) {
out_of_range:
rb_raise(rb_eIndexError, "index %ld out of string", idx);
@@ -1707,7 +1707,7 @@ rb_str_aset(str, indx, val)
RSTRING(str)->len += 1;
RESIZE_CAPA(str, RSTRING(str)->len);
}
- RSTRING(str)->ptr[idx] = NUM2INT(val) & 0xff;
+ RSTRING(str)->ptr[idx] = FIX2INT(val) & 0xff;
}
else {
rb_str_splice(str, idx, 1, val);