We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f180b8d commit ac0c703Copy full SHA for ac0c703
2 files changed
crates/rustc_codegen_spirv/src/builder/builder_methods.rs
@@ -210,21 +210,23 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
210
},
211
SpirvType::Integer(width, true) => match width {
212
8 => self
213
- .constant_i8(self.span(), unsafe { std::mem::transmute(fill_byte) })
+ .constant_i8(self.span(), unsafe {
214
+ std::mem::transmute::<u8, i8>(fill_byte)
215
+ })
216
.def(self),
217
16 => self
218
.constant_i16(self.span(), unsafe {
- std::mem::transmute(memset_fill_u16(fill_byte))
219
+ std::mem::transmute::<u16, i16>(memset_fill_u16(fill_byte))
220
})
221
222
32 => self
223
.constant_i32(self.span(), unsafe {
- std::mem::transmute(memset_fill_u32(fill_byte))
224
+ std::mem::transmute::<u32, i32>(memset_fill_u32(fill_byte))
225
226
227
64 => self
228
.constant_i64(self.span(), unsafe {
- std::mem::transmute(memset_fill_u64(fill_byte))
229
+ std::mem::transmute::<u64, i64>(memset_fill_u64(fill_byte))
230
231
232
_ => self.fatal(format!(
crates/rustc_codegen_spirv/src/codegen_cx/constant.rs
@@ -18,11 +18,6 @@ impl<'tcx> CodegenCx<'tcx> {
18
self.builder.def_constant_cx(ty, val, self)
19
}
20
21
- pub fn constant_i8(&self, span: Span, val: i8) -> SpirvValue {
22
- let ty = SpirvType::Integer(8, true).def(span, self);
23
- self.def_constant(ty, SpirvConst::U32(val as u32))
24
- }
25
-
26
pub fn constant_u8(&self, span: Span, val: u8) -> SpirvValue {
27
self.constant_int_from_native_unsigned(span, val)
28
@@ -47,9 +42,8 @@ impl<'tcx> CodegenCx<'tcx> {
47
42
48
43
49
44
50
- pub fn constant_i64(&self, span: Span, val: u64) -> SpirvValue {
51
- let ty = SpirvType::Integer(64, true).def(span, self);
52
- self.def_constant(ty, SpirvConst::U64(val))
45
+ pub fn constant_i64(&self, span: Span, val: i64) -> SpirvValue {
46
+ self.constant_int_from_native_signed(span, val)
53
54
55
pub fn constant_u64(&self, span: Span, val: u64) -> SpirvValue {
0 commit comments