Support Num.abs for non-64 bit integer types

Closes #4210
This commit is contained in:
Ayaz Hafiz 2022-10-05 08:39:45 -05:00
parent df3b7cb1b4
commit 657346a057
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 16 additions and 2 deletions

View file

@ -7921,11 +7921,10 @@ fn int_abs_with_overflow<'a, 'ctx, 'env>(
// (xor arg shifted) - shifted
let bd = env.builder;
let ctx = env.context;
let shifted_name = "abs_shift_right";
let shifted_alloca = {
let bits_to_shift = int_type.get_bit_width() as u64 - 1;
let shift_val = ctx.i64_type().const_int(bits_to_shift, false);
let shift_val = int_type.const_int(bits_to_shift, false);
let shifted = bd.build_right_shift(arg, shift_val, true, shifted_name);
let alloca = bd.build_alloca(int_type, "#int_abs_help");