diff options
| author | 2025-09-15 22:43:25 +0200 | |
|---|---|---|
| committer | 2025-09-15 22:43:25 +0200 | |
| commit | 0368070045f0ebcdcb12d49da9edc4d10ca30c60 (patch) | |
| tree | d61e83e74f1ed377c8583db17888277a3c124530 /test/test4.c | |
| parent | b83716158393dbb4e8da169c799cb387e4c99b73 (diff) | |
frontend: more bitfield work
Diffstat (limited to 'test/test4.c')
| -rw-r--r-- | test/test4.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/test/test4.c b/test/test4.c index c2dcd5f..c1c9429 100644 --- a/test/test4.c +++ b/test/test4.c @@ -1,5 +1,5 @@ int xor(int a) { - return a ^ 3 | 233333; + return a ^ 3 | 555; } int cmp(float x, float y) { @@ -7,18 +7,34 @@ int cmp(float x, float y) { } struct foo { - int x : 10; + unsigned int x : 10; unsigned y : 7; short k:3; int : 0; short a:15; + long long h:60; }; int bitf(struct foo *q) { + extern void aeiou(int); + aeiou(q->h); return q->x + q->y - q->k + q->a; } -int main() { +int main(int p) { + extern int printf(const char *, ...); + + static struct foo foo; + + foo.x = 5+p; + foo.k = 3; + foo.h += 7; + bitf(&foo); + foo.a = -1; + foo.a = xor(foo.a |= 3); + printf("expect %d, -4, 7, %d\n", 5+p, (short)((-1|3)^3|555)); + printf(" %d, %d, %lld, %d\n", foo.x, foo.k+=1, foo.h, foo.a); + int x = 42, *a = &x, **b = &a, @@ -29,3 +45,4 @@ int main() { return ******f; } +void aeiou(int _){} |