i128 / u128 are not compatible with C's definition.
While fixing various bindgen bugs related to long double, int128, (rust-lang/rust-bindgen#1370, etc).
I realized that the following Rust program, in my x86_64 Linux machine:
#[repr(C)] struct Foo { f: u128, } fn main() { println!("Align: {}", ::std::mem::align_of::<Foo>()); }
Prints 8.
While the following C program:
#include <stdio.h> struct foo { unsigned __int128 t; }; int main() { printf("Align: %ld\n", _Alignof(struct foo)); }
Prints 16 on the same system. This is pretty unexpected, and means that i128 / u128 are not really usable for FFI / alignment purposes.