1 #ifndef RH_MEMZERO_INLINE_H
 2 #define RH_MEMZERO_INLINE_H 1
 3 
 4 #include <sys/types.h>
 5 #include <stdint.h>
 6 
 7 #define rh_memzero1(_s)         { *((uint8_t*)(_s)) = 0U; }
 8 
 9 #define rh_memzero2(_s)         { *((uint16_t*)(_s)) = 0U; }
10 
11 #define rh_memzero3(_s)         { rh_memzero1(_s); \
12                                   rh_memzero2( ((uint8_t*)(_s))+1 ); }
13 
14 #define rh_memzero4(_s)         { *((uint32_t*)(_s)) = 0U; }
15 
16 #define rh_memzero5(_s)         { rh_memzero1(_s); \
17                                   rh_memzero4( ((uint8_t*)(_s))+1 ); }
18 
19 #define rh_memzero6(_s)         { rh_memzero2(_s); \
20                                   rh_memzero4( ((uint8_t*)(_s))+2 ); }
21 
22 #define rh_memzero7(_s)         { rh_memzero3(_s); \
23                                   rh_memzero4( ((uint8_t*)(_s))+3); }
24 
25 #ifdef HAVE_64BIT
26  #define rh_memzero8(_s)        { *((uint64_t*)(_s)) = 0U; }
27 #else
28  #define rh_memzero8(_s)        { rh_memzero4(_s); \
29                                   rh_memzero4(((uint32_t*)(_s)) + 1); }
30 #endif
31 
32 #endif /* ! RH_MEMZERO_INLINE_H */


syntax highlighted by Code2HTML, v. 0.9.1