1 /* 2 * type and other definitions 3 * 4 * written by ITOH Yasufumi 5 * public domain 6 * 7 * $NetBSD: type_local.h,v 1.3 2011/02/21 02:31:58 itohy Exp $ 8 */ 9 10 #ifndef __STDC__ 11 # ifndef const 12 # define const 13 # endif 14 #endif 15 16 #ifndef __BIT_TYPES_DEFINED__ 17 typedef unsigned char u_int8_t; 18 typedef unsigned short u_int16_t; 19 typedef unsigned int u_int32_t; 20 #endif 21 22 /* 23 * big-endian integer types 24 */ 25 typedef union be_uint16 { 26 u_int8_t val[2]; 27 u_int16_t hostval; 28 } be_uint16_t; 29 30 typedef union be_uint32 { 31 u_int8_t val[4]; 32 u_int32_t hostval; 33 be_uint16_t half[2]; 34 } be_uint32_t; 35 36 #define SIZE_16 sizeof(be_uint16_t) 37 #define SIZE_32 sizeof(be_uint32_t) 38