Initial import from FreeBSD RELENG_4:
[dragonfly.git] / crypto / kerberosIV / lib / krb / sizetest.c
1 #include "krb_locl.h"
2
3 RCSID("$Id: sizetest.c,v 1.6 1998/01/01 22:29:04 assar Exp $");
4
5 static void
6 fatal(const char *msg)
7 {
8   fputs(msg, stderr);
9   exit(1);
10 }
11
12 int
13 main(void)
14 {
15   if (sizeof(u_int8_t) < 1)
16     fatal("sizeof(u_int8_t) is smaller than 1 byte\n");
17   if (sizeof(u_int16_t) < 2)
18     fatal("sizeof(u_int16_t) is smaller than 2 bytes\n");
19   if (sizeof(u_int32_t) < 4)
20     fatal("sizeof(u_int32_t) is smaller than 4 bytes\n");
21
22   if (sizeof(u_int8_t) > 1)
23     fputs("warning: sizeof(u_int8_t) is larger than 1 byte, "
24           "some stuff may not work properly!\n", stderr);
25
26   {
27     u_int8_t u = 1;
28     int i;
29     for (i = 0; u != 0 && i < 100; i++)
30       u <<= 1;
31
32     if (i < 8)
33       fatal("u_int8_t is smaller than 8 bits\n");
34     else if (i > 8)
35       fputs("warning: u_int8_t is larger than 8 bits, "
36             "some stuff may not work properly!\n", stderr);
37   }
38
39   exit(0);
40 }