Skip to content

Alignment of u64/i64 etc. #197

Answered by FenrirWolf
DeltaF1 asked this question in Q&A
Nov 14, 2024 · 2 comments · 4 replies
Discussion options

You must be logged in to vote

I think you might have misread the chart you linked, as u64/i64 are equivalent to (unsigned) long long int and those types are specified to have an 8-byte alignment. You can confirm this yourself by building C program with devkitARM using __alignof__ on a long long int, and it will report that the variable has an alignment of 8. So Rust is already doing the right thing here and we absolutely wouldn't want to change that, and I'm pretty sure that you're stuck using #[repr(packed)] when interfacing with those kind of APIs.

But for future reference, this file is where the 3DS target spec is implemented in rustc, with the data_layout field in particular being where things like integer size an…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@DeltaF1
Comment options

Answer selected by DeltaF1
Comment options

You must be logged in to vote
3 replies
@DeltaF1
Comment options

@Jhynjhiruu
Comment options

@DeltaF1
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants