Skip to content

Commit 6c69e2f

Browse files
committed
Reorder ConstMethods.
It's crazy to have the integer methods in something close to random order. The reordering makes the gaps clear: `const_i64`, `const_i128`, `const_isize`, and `const_u16`. I guess they just aren't needed.
1 parent 9ed19dc commit 6c69e2f

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/common.rs

+16-16
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,14 @@ impl<'gcc, 'tcx> ConstCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
8080
self.const_undef(typ)
8181
}
8282

83-
fn const_int(&self, typ: Type<'gcc>, int: i64) -> RValue<'gcc> {
84-
self.gcc_int(typ, int)
85-
}
86-
87-
fn const_uint(&self, typ: Type<'gcc>, int: u64) -> RValue<'gcc> {
88-
self.gcc_uint(typ, int)
89-
}
90-
91-
fn const_uint_big(&self, typ: Type<'gcc>, num: u128) -> RValue<'gcc> {
92-
self.gcc_uint_big(typ, num)
93-
}
94-
9583
fn const_bool(&self, val: bool) -> RValue<'gcc> {
9684
self.const_uint(self.type_i1(), val as u64)
9785
}
9886

87+
fn const_i8(&self, i: i8) -> RValue<'gcc> {
88+
self.const_int(self.type_i8(), i as i64)
89+
}
90+
9991
fn const_i16(&self, i: i16) -> RValue<'gcc> {
10092
self.const_int(self.type_i16(), i as i64)
10193
}
@@ -104,8 +96,12 @@ impl<'gcc, 'tcx> ConstCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
10496
self.const_int(self.type_i32(), i as i64)
10597
}
10698

107-
fn const_i8(&self, i: i8) -> RValue<'gcc> {
108-
self.const_int(self.type_i8(), i as i64)
99+
fn const_int(&self, typ: Type<'gcc>, int: i64) -> RValue<'gcc> {
100+
self.gcc_int(typ, int)
101+
}
102+
103+
fn const_u8(&self, i: u8) -> RValue<'gcc> {
104+
self.const_uint(self.type_u8(), i as u64)
109105
}
110106

111107
fn const_u32(&self, i: u32) -> RValue<'gcc> {
@@ -130,8 +126,12 @@ impl<'gcc, 'tcx> ConstCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
130126
self.const_uint(self.usize_type, i)
131127
}
132128

133-
fn const_u8(&self, i: u8) -> RValue<'gcc> {
134-
self.const_uint(self.type_u8(), i as u64)
129+
fn const_uint(&self, typ: Type<'gcc>, int: u64) -> RValue<'gcc> {
130+
self.gcc_uint(typ, int)
131+
}
132+
133+
fn const_uint_big(&self, typ: Type<'gcc>, num: u128) -> RValue<'gcc> {
134+
self.gcc_uint_big(typ, num)
135135
}
136136

137137
fn const_real(&self, typ: Type<'gcc>, val: f64) -> RValue<'gcc> {

0 commit comments

Comments
 (0)