forked from M-Labs/nac3
meta: Remove redundant casts and brackets
This commit is contained in:
parent
5182453bd9
commit
fd9f66b8d9
|
@ -132,7 +132,7 @@ impl StaticValue for PythonValue {
|
||||||
PrimitiveValue::I32(val) => ctx.ctx.i32_type().const_int(*val as u64, false).into(),
|
PrimitiveValue::I32(val) => ctx.ctx.i32_type().const_int(*val as u64, false).into(),
|
||||||
PrimitiveValue::I64(val) => ctx.ctx.i64_type().const_int(*val as u64, false).into(),
|
PrimitiveValue::I64(val) => ctx.ctx.i64_type().const_int(*val as u64, false).into(),
|
||||||
PrimitiveValue::U32(val) => ctx.ctx.i32_type().const_int(*val as u64, false).into(),
|
PrimitiveValue::U32(val) => ctx.ctx.i32_type().const_int(*val as u64, false).into(),
|
||||||
PrimitiveValue::U64(val) => ctx.ctx.i64_type().const_int(*val as u64, false).into(),
|
PrimitiveValue::U64(val) => ctx.ctx.i64_type().const_int(*val, false).into(),
|
||||||
PrimitiveValue::F64(val) => ctx.ctx.f64_type().const_float(*val).into(),
|
PrimitiveValue::F64(val) => ctx.ctx.f64_type().const_float(*val).into(),
|
||||||
PrimitiveValue::Bool(val) => ctx.ctx.i8_type().const_int(*val as u64, false).into(),
|
PrimitiveValue::Bool(val) => ctx.ctx.i8_type().const_int(*val as u64, false).into(),
|
||||||
});
|
});
|
||||||
|
|
|
@ -107,7 +107,7 @@ impl<'ctx, 'a> CodeGenContext<'ctx, 'a> {
|
||||||
SymbolValue::I32(v) => self.ctx.i32_type().const_int(*v as u64, true).into(),
|
SymbolValue::I32(v) => self.ctx.i32_type().const_int(*v as u64, true).into(),
|
||||||
SymbolValue::I64(v) => self.ctx.i64_type().const_int(*v as u64, true).into(),
|
SymbolValue::I64(v) => self.ctx.i64_type().const_int(*v as u64, true).into(),
|
||||||
SymbolValue::U32(v) => self.ctx.i32_type().const_int(*v as u64, false).into(),
|
SymbolValue::U32(v) => self.ctx.i32_type().const_int(*v as u64, false).into(),
|
||||||
SymbolValue::U64(v) => self.ctx.i64_type().const_int(*v as u64, false).into(),
|
SymbolValue::U64(v) => self.ctx.i64_type().const_int(*v, false).into(),
|
||||||
SymbolValue::Bool(v) => self.ctx.i8_type().const_int(*v as u64, true).into(),
|
SymbolValue::Bool(v) => self.ctx.i8_type().const_int(*v as u64, true).into(),
|
||||||
SymbolValue::Double(v) => self.ctx.f64_type().const_float(*v).into(),
|
SymbolValue::Double(v) => self.ctx.f64_type().const_float(*v).into(),
|
||||||
SymbolValue::Str(v) => {
|
SymbolValue::Str(v) => {
|
||||||
|
|
|
@ -758,7 +758,7 @@ impl TopLevelComposer {
|
||||||
let target_ty =
|
let target_ty =
|
||||||
get_type_from_type_annotation_kinds(&temp_def_list, unifier, primitives, &def, &mut subst_list)?;
|
get_type_from_type_annotation_kinds(&temp_def_list, unifier, primitives, &def, &mut subst_list)?;
|
||||||
unifier.unify(ty, target_ty).map_err(|e| e.to_display(unifier).to_string())?;
|
unifier.unify(ty, target_ty).map_err(|e| e.to_display(unifier).to_string())?;
|
||||||
Ok(()) as Result<(), String>
|
Ok(())
|
||||||
};
|
};
|
||||||
for (ty, def) in type_var_to_concrete_def {
|
for (ty, def) in type_var_to_concrete_def {
|
||||||
if let Err(e) = unification_helper(ty, def) {
|
if let Err(e) = unification_helper(ty, def) {
|
||||||
|
|
|
@ -207,7 +207,7 @@ impl<'a> Linker<'a> {
|
||||||
STN_UNDEF => None,
|
STN_UNDEF => None,
|
||||||
sym_index => Some(
|
sym_index => Some(
|
||||||
self.symtab
|
self.symtab
|
||||||
.get(sym_index as usize)
|
.get(sym_index)
|
||||||
.ok_or("symbol out of bounds of symbol table")?,
|
.ok_or("symbol out of bounds of symbol table")?,
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
@ -1463,7 +1463,7 @@ impl<'a> Linker<'a> {
|
||||||
// Update the EHDR
|
// Update the EHDR
|
||||||
let ehdr_ptr = linker.image.as_mut_ptr() as *mut Elf32_Ehdr;
|
let ehdr_ptr = linker.image.as_mut_ptr() as *mut Elf32_Ehdr;
|
||||||
unsafe {
|
unsafe {
|
||||||
(*ehdr_ptr) = Elf32_Ehdr {
|
*ehdr_ptr = Elf32_Ehdr {
|
||||||
e_ident: ehdr.e_ident,
|
e_ident: ehdr.e_ident,
|
||||||
e_type: ET_DYN,
|
e_type: ET_DYN,
|
||||||
e_machine: ehdr.e_machine,
|
e_machine: ehdr.e_machine,
|
||||||
|
|
Loading…
Reference in New Issue