Commit e052c082
e052c0827ef4Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 1 file · ~1 modified
Description
fix(codegen): bigint#[] bit-index dispatch
Details
- Commit
- e052c0827ef4
- Parent
- 95dc567987ae
spinel_codegen.rbmodifiedView file
@@ -14570,6 +14570,20 @@
1457014570
if recv_type == "bigint"1457114571
# Cast away volatile from bigint locals (see compile_bigint_arg).1457214572
rc_b = "(sp_Bigint *)" + rc14573+
if mname == "[]"14574+
# Integer#[idx] bit-index on bigint receiver.14575+
args_id_bi = @nd_arguments[nid]14576+
if args_id_bi >= 014577+
a_bi = get_args(args_id_bi)14578+
if a_bi.length > 014579+
idx_t_bi = infer_type(a_bi[0])14580+
if idx_t_bi == "int" || idx_t_bi == "poly" || idx_t_bi == "bigint"14581+
idx_bi = compile_arg0_as_int(nid)14582+
return "((sp_bigint_to_int(" + rc_b + ") >> (" + idx_bi + ")) & 1)"14583+
end14584+
end14585+
end14586+
end1457314587
if mname == "to_s"1457414588
return "sp_bigint_to_s(" + rc_b + ")"1457514589
end