Use WrappingRange::full instead of hand-rolling it
This commit is contained in:
parent
09b291f0b2
commit
d57b755909
3 changed files with 3 additions and 6 deletions
|
@ -328,7 +328,7 @@ pub fn const_alloc_to_gcc<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, alloc: ConstAl
|
||||||
interpret::Pointer::new(alloc_id, Size::from_bytes(ptr_offset)),
|
interpret::Pointer::new(alloc_id, Size::from_bytes(ptr_offset)),
|
||||||
&cx.tcx,
|
&cx.tcx,
|
||||||
),
|
),
|
||||||
abi::Scalar::Initialized { value: Primitive::Pointer, valid_range: WrappingRange { start: 0, end: !0 } },
|
abi::Scalar::Initialized { value: Primitive::Pointer, valid_range: WrappingRange::full(dl.pointer_size) },
|
||||||
cx.type_i8p(),
|
cx.type_i8p(),
|
||||||
));
|
));
|
||||||
next_offset = offset + pointer_size;
|
next_offset = offset + pointer_size;
|
||||||
|
|
|
@ -111,7 +111,7 @@ pub fn const_alloc_to_llvm<'ll>(cx: &CodegenCx<'ll, '_>, alloc: ConstAllocation<
|
||||||
),
|
),
|
||||||
Scalar::Initialized {
|
Scalar::Initialized {
|
||||||
value: Primitive::Pointer,
|
value: Primitive::Pointer,
|
||||||
valid_range: WrappingRange { start: 0, end: !0 },
|
valid_range: WrappingRange::full(dl.pointer_size),
|
||||||
},
|
},
|
||||||
cx.type_i8p_ext(address_space),
|
cx.type_i8p_ext(address_space),
|
||||||
));
|
));
|
||||||
|
|
|
@ -567,10 +567,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
|
||||||
let scalar_unit = |value: Primitive| {
|
let scalar_unit = |value: Primitive| {
|
||||||
let size = value.size(dl);
|
let size = value.size(dl);
|
||||||
assert!(size.bits() <= 128);
|
assert!(size.bits() <= 128);
|
||||||
Scalar::Initialized {
|
Scalar::Initialized { value, valid_range: WrappingRange::full(size) }
|
||||||
value,
|
|
||||||
valid_range: WrappingRange { start: 0, end: size.unsigned_int_max() },
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
let scalar =
|
let scalar =
|
||||||
|value: Primitive| tcx.intern_layout(LayoutS::scalar(self, scalar_unit(value)));
|
|value: Primitive| tcx.intern_layout(LayoutS::scalar(self, scalar_unit(value)));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue