blob: 11252bbaf84bd38063748a96e29751654e3c3fbb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
local ffi = require "ffi"
ffi.cdef[[
typedef struct { int a; char b; } __attribute__((packed)) myty1;
typedef struct { int a; char b; } __attribute__((__packed__)) myty1_a;
typedef struct { int a; char b; } __attribute__((aligned(16))) myty2_a;
typedef struct { int a; char b; } __attribute__((__aligned__(16))) myty2;
typedef int __attribute__ ((vector_size (32))) myty3;
typedef int __attribute__ ((__vector_size__ (32))) myty3_a;
typedef int __attribute__ ((mode(DI))) myty4;
]]
assert(ffi.sizeof("myty1") == 5 and
ffi.sizeof("myty1_a") == 5 and
ffi.alignof("myty2") == 16 and
ffi.alignof("myty2_a") == 16 and
ffi.sizeof("myty3") == 32 and
ffi.sizeof("myty3_a") == 32 and
ffi.sizeof("myty4") == 8)
|