forked from M-Labs/nac3
core: change call_nac3_range_len to take Int Instances
This commit is contained in:
parent
58be4a8b09
commit
e62509ae67
|
@ -613,14 +613,10 @@ pub fn call_nac3_range_len<'ctx, G: CodeGenerator + ?Sized, N: IntKind<'ctx>>(
|
||||||
generator: &mut G,
|
generator: &mut G,
|
||||||
ctx: &mut CodeGenContext<'ctx, '_>,
|
ctx: &mut CodeGenContext<'ctx, '_>,
|
||||||
int_kind: N,
|
int_kind: N,
|
||||||
start: IntValue<'ctx>,
|
start: Instance<'ctx, Int<N>>,
|
||||||
stop: IntValue<'ctx>,
|
stop: Instance<'ctx, Int<N>>,
|
||||||
step: IntValue<'ctx>,
|
step: Instance<'ctx, Int<N>>,
|
||||||
) -> Instance<'ctx, Int<N>> {
|
) -> Instance<'ctx, Int<N>> {
|
||||||
let start = Int(int_kind).check_value(generator, ctx.ctx, start).unwrap();
|
|
||||||
let stop = Int(int_kind).check_value(generator, ctx.ctx, stop).unwrap();
|
|
||||||
let step = Int(int_kind).check_value(generator, ctx.ctx, step).unwrap();
|
|
||||||
|
|
||||||
let bit_width = int_kind.get_int_type(generator, ctx.ctx).get_bit_width();
|
let bit_width = int_kind.get_int_type(generator, ctx.ctx).get_bit_width();
|
||||||
let func_name = match bit_width {
|
let func_name = match bit_width {
|
||||||
32 => "__nac3_range_len_i32",
|
32 => "__nac3_range_len_i32",
|
||||||
|
|
|
@ -91,14 +91,7 @@ impl<'ctx, N: IntKind<'ctx>> RustRange<'ctx, N> {
|
||||||
ctx: &mut CodeGenContext<'ctx, '_>,
|
ctx: &mut CodeGenContext<'ctx, '_>,
|
||||||
) -> Instance<'ctx, Int<N>> {
|
) -> Instance<'ctx, Int<N>> {
|
||||||
let int_kind = self.start.model.0;
|
let int_kind = self.start.model.0;
|
||||||
call_nac3_range_len(
|
call_nac3_range_len(generator, ctx, int_kind, self.start, self.stop, self.step)
|
||||||
generator,
|
|
||||||
ctx,
|
|
||||||
int_kind,
|
|
||||||
self.start.value,
|
|
||||||
self.stop.value,
|
|
||||||
self.step.value,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue