v2 / vlib / v / tests / structs / struct_aligned_test.v
13 lines · 11 sloc · 192 bytes · fa904c495e94176fbeda9b9b8751b43a667321a8
Raw
1@[aligned: 512]
2struct MyStruct {
3 a int
4}
5
6fn test_struct_aligned() {
7 x := u64(voidptr(&MyStruct{}))
8 assert x % 512 == 0
9
10 y := MyStruct{}
11 ptr := u64(voidptr(&y))
12 assert ptr % 512 == 0
13}
14