Skip to content

Commit

Permalink
Target - Set alignment for u64/i64 to 4 on 32-bit platforms (fixes #78)
Browse files Browse the repository at this point in the history
  • Loading branch information
thepowersgang committed Aug 12, 2018
1 parent ec907f5 commit c817536
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/trans/target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -684,13 +684,14 @@ bool Target_GetSizeAndAlignOf(const Span& sp, const StaticTraitResolve& resolve,
case ::HIR::CoreType::U64:
case ::HIR::CoreType::I64:
out_size = 8;
out_align = 8;
// TODO: on x86, u64/i64 has an alignment of 4, while x86_64 has 8. What do other platforms have?
out_align = g_target.m_arch.m_pointer_bits == 32 ? 4 : 8;
return true;
case ::HIR::CoreType::U128:
case ::HIR::CoreType::I128:
out_size = 16;
// TODO: If i128 is emulated, this can be 8
out_align = 16;
// TODO: If i128 is emulated, this can be 8 (as it is on x86, where it's actually 4 due to the above comment)
out_align = g_target.m_arch.m_pointer_bits == 32 ? 4 : 16;
return true;
case ::HIR::CoreType::Usize:
case ::HIR::CoreType::Isize:
Expand Down

0 comments on commit c817536

Please sign in to comment.