コード例 #1
0
ファイル: struct.c プロジェクト: 4ker/8cc
void testmain() {
    print("struct");
    t1();
    t2();
    t3();
    t4();
    t5();
    t6();
    t7();
    t8();
    t9();
    t10();
    t11();
    t12();
    t13();
    t14();
    unnamed();
    assign();
    arrow();
    incomplete();
    bitfield_basic();
    bitfield_mix();
    bitfield_union();
    bitfield_unnamed();
    bitfield_initializer();
    test_offsetof();
    flexible_member();
    empty_struct();
}
コード例 #2
0
ファイル: bitfield.c プロジェクト: CoryXie/BarrelfishOS
int main(int argc, char** argv)
{
	struct bitfield* b = malloc(sizeof(struct bitfield));
	memset(b, 0, sizeof(struct bitfield));

	*(uint64_t*)b->field = 0xffff;
	struct bitfield* b2 = malloc(sizeof(struct bitfield));
	memset(b2, 0, sizeof(struct bitfield));
	*(uint64_t*)b2->field = 0xFFffffff0000;

	struct bitfield* fields[2] = {b, b2};
	size_t next = -1;
	while( (next = bitfield_union(fields, 2, next)) != -1) {
		printf("union found next: %lu\n", next);
	}

	//printf("before print\n");
	//print_bitfield(b, 0, 1256);
	//printf("\ndone.\n");
	
	return 0;
}