2
* This testing program makes sure the stdint.h header file
4
* Copyright (C) 2006 by Theodore Ts'o.
7
* This file may be redistributed under the terms of the GNU Public
12
#include <sys/types.h>
18
int main(int argc, char **argv)
20
if (sizeof(uint8_t) != 1) {
21
printf("Sizeof(uint8_t) is %d should be 1\n",
22
(int)sizeof(uint8_t));
25
if (sizeof(int8_t) != 1) {
26
printf("Sizeof(int8_t) is %d should be 1\n",
30
if (sizeof(uint16_t) != 2) {
31
printf("Sizeof(uint16_t) is %d should be 2\n",
32
(int)sizeof(uint16_t));
35
if (sizeof(int16_t) != 2) {
36
printf("Sizeof(int16_t) is %d should be 2\n",
37
(int)sizeof(int16_t));
40
if (sizeof(uint32_t) != 4) {
41
printf("Sizeof(uint32_t) is %d should be 4\n",
42
(int)sizeof(uint32_t));
45
if (sizeof(int32_t) != 4) {
46
printf("Sizeof(int32_t) is %d should be 4\n",
47
(int)sizeof(int32_t));
50
if (sizeof(uint64_t) != 8) {
51
printf("Sizeof(uint64_t) is %d should be 8\n",
52
(int)sizeof(uint64_t));
55
if (sizeof(int64_t) != 8) {
56
printf("Sizeof(int64_t) is %d should be 8\n",
57
(int)sizeof(int64_t));
60
printf("The stdint.h types are correct.\n");