aboutsummaryrefslogtreecommitdiff
path: root/SingleSource/UnitTests/2010-05-24-BitfieldTest.c
blob: 1e355176d8a1e05c7cc23d4583019ca4ab4c0039 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* From Radar 7980096.  Test case by Shantonu Sen! */
#include <assert.h>

typedef union {
	struct {
		unsigned long long        count                   :8;
		unsigned long long        mcg_ctl_p               :1;
	}          bits;
	unsigned long long   u64;
} ia32_mcg_cap_t;

int main(int argc, char *argv[]) {
	unsigned long long ctl_p;
	ia32_mcg_cap_t   ia32_mcg_cap;

	ia32_mcg_cap.u64 = 0x806;

	ctl_p = ia32_mcg_cap.bits.mcg_ctl_p;
	assert(ctl_p == 0);

	return 0;
}