4 * Test for comparing pointers vs bit-testing.
6 * $DragonFly: src/test/sysperf/cmp.c,v 1.1 2005/08/03 13:37:27 hmp Exp $
11 #define LOOP 1000000000
13 static void nop(void) { }
16 void (*nop_ptr
)(void);
19 #define SOME_MASK 0x00800
24 main(int ac
, char **av
)
31 printf("compare nop() function pointer against NULL (struct not pointer)\n");
33 for (i
= 0; i
< LOOP
; ++i
)
34 if (foo
.nop_ptr
== NULL
)
36 stop_timing(LOOP
, "loop1/cmp-pointer");
38 printf("compare nop() function pointer against NULL (struct pointer)\n");
40 for (i
= 0; i
< LOOP
; ++i
)
41 if (fp
->nop_ptr
== NULL
)
43 stop_timing(LOOP
, "loop2/cmp-pointer");
45 printf("compare bitmask checking\n");
47 for (i
= 0; i
< LOOP
; ++i
)
48 if (foo
.mask
& SOME_MASK
)
50 stop_timing(LOOP
, "loop3/cmp-bitmask");