diff options
author | Patrick McHardy <kaber@trash.net> | 2008-05-18 18:35:35 +0200 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2008-05-18 18:35:35 +0200 |
commit | 835110044bd970518e10b28348ce6619818ce363 (patch) | |
tree | 76abdc04a3b9b8a29e3daded34cb2779a939df9b /extensions/chtons.h | |
parent | dce17ab4526920f1930f1fee4245ea66c33093ec (diff) |
Remove obsolete patches and files and move ulogd to repository top-level directory
Diffstat (limited to 'extensions/chtons.h')
-rw-r--r-- | extensions/chtons.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/extensions/chtons.h b/extensions/chtons.h new file mode 100644 index 0000000..4506e33 --- /dev/null +++ b/extensions/chtons.h @@ -0,0 +1,32 @@ +#ifndef _CHTONS_H_ +#define _CHTONS_H_ + +#include <endian.h> + +#if __BYTE_ORDER == __BIG_ENDIAN +# define BITNR(X) ((X)^31) +# if !defined(__constant_htonl) +# define __constant_htonl(x) (x) +# endif +# if !defined(__constant_htons) +# define __constant_htons(x) (x) +# endif +#elif __BYTE_ORDER == __LITTLE_ENDIAN +# define BITNR(X) ((X)^7) +# if !defined(__constant_htonl) +# define __constant_htonl(x) \ + ((unsigned long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \ + (((unsigned long int)(x) & 0x0000ff00U) << 8) | \ + (((unsigned long int)(x) & 0x00ff0000U) >> 8) | \ + (((unsigned long int)(x) & 0xff000000U) >> 24))) +# endif +# if !defined(__constant_htons) +# define __constant_htons(x) \ + ((unsigned short int)((((unsigned short int)(x) & 0x00ff) << 8) | \ + (((unsigned short int)(x) & 0xff00) >> 8))) +# endif +#else +# error "Don't know if bytes are big- or little-endian!" +#endif + +#endif |