fix(from_low_high): Renamed according to clippy requirements

Changed for clippy naming convention requirement:
```
warning: methods called `from_*` usually take no `self`
   --> src/int.rs:996:22
    |
996 |     fn from_low_high(&self, typ: Type<'gcc>, low: i64, high: i64) -> RValue<'gcc> {
    |                      ^^^^^
    |
    = help: consider choosing a less ambiguous name
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention
    = note: `#[warn(clippy::wrong_self_convention)]` on by default
```
This commit is contained in:
tempdragon 2024-03-11 12:55:28 +08:00
parent 3fd9db31bf
commit a7d39b852a

View File

@ -38,7 +38,7 @@ pub fn gcc_not(&self, a: RValue<'gcc>) -> RValue<'gcc> {
self.cx.context.new_unary_op(self.location, operation, typ, a)
} else {
let element_type = typ.dyncast_array().expect("element type");
self.from_low_high_rvalues(
self.concat_low_high_rvalues(
typ,
self.cx.context.new_unary_op(
self.location,
@ -112,7 +112,7 @@ pub fn gcc_lshr(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
let shift_value = self.gcc_sub(b, sixty_four);
let high = self.high(a);
let sign = if a_type.is_signed(self) { high >> sixty_three } else { zero };
let array_value = self.from_low_high_rvalues(a_type, high >> shift_value, sign);
let array_value = self.concat_low_high_rvalues(a_type, high >> shift_value, sign);
then_block.add_assignment(self.location, result, array_value);
then_block.end_with_jump(self.location, after_block);
@ -128,8 +128,11 @@ pub fn gcc_lshr(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
let casted_low = self.context.new_cast(self.location, self.low(a), unsigned_type);
let shifted_low = casted_low >> self.context.new_cast(self.location, b, unsigned_type);
let shifted_low = self.context.new_cast(self.location, shifted_low, native_int_type);
let array_value =
self.from_low_high_rvalues(a_type, (high << shift_value) | shifted_low, high >> b);
let array_value = self.concat_low_high_rvalues(
a_type,
(high << shift_value) | shifted_low,
high >> b,
);
actual_else_block.add_assignment(self.location, result, array_value);
actual_else_block.end_with_jump(self.location, after_block);
@ -610,7 +613,7 @@ pub fn gcc_xor(&self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
{
a ^ b
} else {
self.from_low_high_rvalues(
self.concat_low_high_rvalues(
a_type,
self.low(a) ^ self.low(b),
self.high(a) ^ self.high(b),
@ -659,7 +662,7 @@ pub fn gcc_shl(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
self.llbb().end_with_conditional(self.location, condition, then_block, else_block);
let array_value =
self.from_low_high_rvalues(a_type, zero, self.low(a) << (b - sixty_four));
self.concat_low_high_rvalues(a_type, zero, self.low(a) << (b - sixty_four));
then_block.add_assignment(self.location, result, array_value);
then_block.end_with_jump(self.location, after_block);
@ -677,7 +680,7 @@ pub fn gcc_shl(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
let high_low =
self.context.new_cast(self.location, casted_low >> shift_value, native_int_type);
let array_value = self.from_low_high_rvalues(
let array_value = self.concat_low_high_rvalues(
a_type,
self.low(a) << b,
(self.high(a) << b) | high_low,
@ -706,7 +709,7 @@ pub fn gcc_bswap(&mut self, mut arg: RValue<'gcc>, width: u64) -> RValue<'gcc> {
// NOTE: we also need to swap the two elements here, in addition to swapping inside
// the elements themselves like done above.
return self.from_low_high_rvalues(arg_type, swapped_msb, swapped_lsb);
return self.concat_low_high_rvalues(arg_type, swapped_msb, swapped_lsb);
}
// TODO(antoyo): check if it's faster to use string literals and a
@ -728,7 +731,7 @@ pub fn gcc_int(&self, typ: Type<'gcc>, int: i64) -> RValue<'gcc> {
self.context.new_rvalue_from_long(typ, int)
} else {
// NOTE: set the sign in high.
self.from_low_high(typ, int, -(int.is_negative() as i64))
self.concat_low_high(typ, int, -(int.is_negative() as i64))
}
}
@ -740,7 +743,7 @@ pub fn gcc_uint(&self, typ: Type<'gcc>, int: u64) -> RValue<'gcc> {
} else if self.is_native_int_type_or_bool(typ) {
self.context.new_rvalue_from_long(typ, int as i64)
} else {
self.from_low_high(typ, int as i64, 0)
self.concat_low_high(typ, int as i64, 0)
}
}
@ -757,7 +760,7 @@ pub fn gcc_uint_big(&self, typ: Type<'gcc>, num: u128) -> RValue<'gcc> {
let shift = high << sixty_four;
shift | self.context.new_cast(None, low, typ)
} else {
self.from_low_high(typ, low as i64, high as i64)
self.concat_low_high(typ, low as i64, high as i64)
}
} else if typ.is_i128(self) {
// FIXME(antoyo): libgccjit cannot create 128-bit values yet.
@ -772,7 +775,7 @@ pub fn gcc_zero(&self, typ: Type<'gcc>) -> RValue<'gcc> {
if self.is_native_int_type_or_bool(typ) {
self.context.new_rvalue_zero(typ)
} else {
self.from_low_high(typ, 0, 0)
self.concat_low_high(typ, 0, 0)
}
}
@ -810,7 +813,7 @@ fn bitwise_operation(
"both types should either be native or non-native for or operation"
);
let native_int_type = a_type.dyncast_array().expect("get element type");
self.from_low_high_rvalues(
self.concat_low_high_rvalues(
a_type,
self.context.new_binary_op(
loc,
@ -855,7 +858,7 @@ pub fn gcc_int_cast(&self, value: RValue<'gcc>, dest_typ: Type<'gcc>) -> RValue<
let is_negative =
self.context.new_comparison(None, ComparisonOp::LessThan, value, zero);
let is_negative = self.gcc_int_cast(is_negative, dest_element_type);
self.from_low_high_rvalues(
self.concat_low_high_rvalues(
dest_typ,
self.context.new_cast(None, value, dest_element_type),
self.context.new_unary_op(None, UnaryOp::Minus, dest_element_type, is_negative),
@ -975,7 +978,7 @@ fn low(&self, value: RValue<'gcc>) -> RValue<'gcc> {
.to_rvalue()
}
fn from_low_high_rvalues(
fn concat_low_high_rvalues(
&self,
typ: Type<'gcc>,
low: RValue<'gcc>,
@ -990,7 +993,7 @@ fn from_low_high_rvalues(
self.context.new_array_constructor(None, typ, &values)
}
fn from_low_high(&self, typ: Type<'gcc>, low: i64, high: i64) -> RValue<'gcc> {
fn concat_low_high(&self, typ: Type<'gcc>, low: i64, high: i64) -> RValue<'gcc> {
let (first, last) = match self.sess().target.options.endian {
Endian::Little => (low, high),
Endian::Big => (high, low),