mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
provide target info to number alignment function
This commit is contained in:
parent
0298013346
commit
fbd26c598e
3 changed files with 32 additions and 16 deletions
|
@ -1,4 +1,5 @@
|
|||
use roc_module::symbol::Symbol;
|
||||
use roc_target::TargetInfo;
|
||||
use std::ops::Index;
|
||||
|
||||
pub const BUILTINS_HOST_OBJ_PATH: &str = env!(
|
||||
|
@ -46,7 +47,7 @@ impl FloatWidth {
|
|||
}
|
||||
}
|
||||
|
||||
pub const fn alignment_bytes(&self) -> u32 {
|
||||
pub const fn alignment_bytes(&self, target_info: TargetInfo) -> u32 {
|
||||
use std::mem::align_of;
|
||||
use FloatWidth::*;
|
||||
|
||||
|
@ -106,11 +107,10 @@ impl IntWidth {
|
|||
}
|
||||
}
|
||||
|
||||
pub const fn alignment_bytes(&self) -> u32 {
|
||||
pub const fn alignment_bytes(&self, target_info: TargetInfo) -> u32 {
|
||||
use std::mem::align_of;
|
||||
use IntWidth::*;
|
||||
|
||||
// TODO actually alignment is architecture-specific
|
||||
match self {
|
||||
U8 | I8 => align_of::<i8>() as u32,
|
||||
U16 | I16 => align_of::<i16>() as u32,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue