| 1 |
/* Test whether bit field boundaries aren't advanced if bit field type |
| 2 |
has alignment large enough. */ |
| 3 |
extern void abort (void); |
| 4 |
extern void exit (int); |
| 5 |
|
| 6 |
struct A { |
| 7 |
unsigned short a : 5; |
| 8 |
unsigned short b : 5; |
| 9 |
unsigned short c : 6; |
| 10 |
}; |
| 11 |
|
| 12 |
struct B { |
| 13 |
unsigned short a : 5; |
| 14 |
unsigned short b : 3; |
| 15 |
unsigned short c : 8; |
| 16 |
}; |
| 17 |
|
| 18 |
int main () |
| 19 |
{ |
| 20 |
/* If short is not at least 16 bits wide, don't test anything. */ |
| 21 |
if ((unsigned short) 65521 != 65521) |
| 22 |
exit (0); |
| 23 |
|
| 24 |
if (sizeof (struct A) != sizeof (struct B)) |
| 25 |
abort (); |
| 26 |
|
| 27 |
exit (0); |
| 28 |
} |