Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef TYPEDEFS_SHADOW_H_INCLUDED
00019 #define TYPEDEFS_SHADOW_H_INCLUDED
00020
00021 #include <limits.h>
00022 #include <stdint.h>
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 typedef int8_t int8s;
00042 typedef int16_t int16s;
00043 typedef int32_t int32s;
00044
00045
00046 typedef uint8_t int8u;
00047 typedef uint16_t int16u;
00048 typedef uint32_t int32u;
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00090 #ifdef UNUSED
00091 #elif defined(__GNUC__)
00092 #define UNUSED(x) UNUSED_ ## x __attribute__((unused))
00093 #elif defined(__LCLINT__)
00094 #define UNUSED(x) x
00095 #else
00096 #define UNUSED(x) x
00097 #endif
00098
00099
00100 typedef union
00101 {
00102 int16u U16;
00103 int16s S16;
00104 int8u U8[2];
00105 int8s S8[2];
00106 }union16;
00107
00108 typedef union
00109 {
00110 int32u U32;
00111 int32s S32;
00112 int16u U16[2];
00113 int16s S16[2];
00114 int8u U8[4];
00115 int8s S8[4];
00116 }union32;
00117
00118
00119 #define SWAP_BYTES(u) {int8u t; t=u.U8[0]; u.U8[0]=u.U8[1]; u.U8[1]=t;}
00120 #define SWAP_ENDIANNESS(x) (((x&0x000000FF)<<24) | ((x&0x0000FF00)<<8) | ((x&0xFF000000)>>24) | ((x&0x00FF0000)>>8))
00121
00122
00123 int32u bit_count_32(int32u n);
00124 void safe_string_copy(char* source, char* dest, int max_chars);
00125 int32u atoiu_safe(char *s, int32u max_chars);
00126 void swap_bytes(int16u *i);
00127 int typedef_tests(void);
00128
00129
00130
00131
00132 #endif