File size: 4,304 Bytes
1e94262
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
--TEST--
FFI 021: packed enums
--EXTENSIONS--
ffi
--INI--
ffi.enable=1
--FILE--
<?php
function test($size, $type) {
    if (FFI::sizeof(FFI::new($type)) !== $size) {
        echo "FAIL: sizeof($type) != $size\n";
    }
}

test(4, "enum {a1, b1}");
test(1, "enum __attribute__((packed)) {a2, b2}");

test(4, "enum {a3=0, b3=0x80000000}");
test(8, "enum {a4=-1, b4=0x80000000}");
test(8, "enum {a5=0x80000000, b5=-1}");
test(4, "enum {a6=-1, b6=0x7fffffff}");
test(8, "enum {a7=-1, b7=0x7fffffff, c7}");

test(1, "enum __attribute__((packed)) {a8=0, b8=0xff}");
test(2, "enum __attribute__((packed)) {a9=0, b9=0x100}");

test(1, "enum __attribute__((packed)) {a10=-1, b10=0x7f}");
test(2, "enum __attribute__((packed)) {a11=-1, b11=0x80}");
test(1, "enum __attribute__((packed)) {a12=0x7f, b12=-0x80}");
test(2, "enum __attribute__((packed)) {a13=0x7f, b13=-0x81}");

test(2, "enum __attribute__((packed)) {a8=0, b8=0xffff}");
test(4, "enum __attribute__((packed)) {a9=0, b9=0x10000}");

test(2, "enum __attribute__((packed)) {a10=-1, b10=0x7f00}");
test(4, "enum __attribute__((packed)) {a11=-1, b11=0x8000}");
test(2, "enum __attribute__((packed)) {a12=0x7f00, b12=-0x8000}");
test(4, "enum __attribute__((packed)) {a13=0x7f00, b13=-0x8001}");

test(4, "enum __attribute__((packed)) {a8=0, b8=0xffffffff}");
test(8, "enum __attribute__((packed)) {a9=0, b9=0x100000000}");

test(4, "enum __attribute__((packed)) {a10=-1, b10=0x7f000000}");
test(8, "enum __attribute__((packed)) {a11=-1, b11=0x80000000}");
test(4, "enum __attribute__((packed)) {a12=0x7f000000, b12=-0x80000000}");
test(8, "enum __attribute__((packed)) {a13=0x7f000000, b13=-0x80000001}");

test(1, "enum __attribute__((packed)) {a14=-0x80}");
test(2, "enum __attribute__((packed)) {a14=-0x81}");
test(2, "enum __attribute__((packed)) {a14=-0x8000}");
test(4, "enum __attribute__((packed)) {a14=-0x8001}");
test(4, "enum __attribute__((packed)) {a14=-0x80000000}");
test(8, "enum __attribute__((packed)) {a14=-0x80000001}");
?>
ok
--EXPECTF--
Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d

Deprecated: Calling FFI::new() statically is deprecated in %s on line %d
ok