aboutsummaryrefslogtreecommitdiff
path: root/SingleSource/UnitTests/2007-04-10-BitfieldTest.c
blob: df7c435730670207ff233007a111ea416a47035c (plain)
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
#include <stdio.h>
#include <stdlib.h>

union u {
        struct {
                unsigned int a : 8;
                unsigned int b : 3;
                unsigned int c : 3;
                unsigned int d : 3;
                unsigned int e : 3;
                unsigned int f : 3;
                unsigned int g : 3;
                unsigned int h : 3;
                unsigned int i : 3;

                unsigned int n : 8;
                unsigned int o : 8;
                unsigned int p : 8;
                unsigned int q : 8;
        } s;
        unsigned long long token;
};

int main(int argc, char *argv[])
{
        union u uu;
        uu.token = 0x012492490000FFFFULL;
        printf("p = 0x%02X\n", uu.s.p);
        return 0;
}