diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-06-02 11:54:32 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-06-02 15:39:37 +0100 |
commit | a891c5b85e3ada0f6180c4ec3cc53013d5a4994d (patch) | |
tree | d1f74869a18f61cafd79f118ec9bd4e35087d02f /config.h.in | |
parent | 5ea511241d12d5f9dc2709fa01860e1d9ab430bb (diff) | |
download | rspamd-a891c5b85e3ada0f6180c4ec3cc53013d5a4994d.tar.gz rspamd-a891c5b85e3ada0f6180c4ec3cc53013d5a4994d.zip |
Move bits compatibility function.
Diffstat (limited to 'config.h.in')
-rw-r--r-- | config.h.in | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/config.h.in b/config.h.in index 1ebac8fa0..ca03751cf 100644 --- a/config.h.in +++ b/config.h.in @@ -488,6 +488,26 @@ typedef off_t goffset; #endif #endif +#ifndef PARAM_H_HAS_BITSET +/* Bit map related macros. */ +#define NBBY 8 /* number of bits in a byte */ +#define setbit(a, \ + i) (((unsigned char *)(a))[(i) / NBBY] |= 1 << ((i) % NBBY)) +#define clrbit(a, \ + i) (((unsigned char *)(a))[(i) / NBBY] &= ~(1 << ((i) % NBBY))) +#define isset(a,i) \ + (((const unsigned char *)(a))[(i) / NBBY] & (1 << ((i) % NBBY))) +#define isclr(a,i) \ + ((((const unsigned char *)(a))[(i) / NBBY] & (1 << ((i) % NBBY))) == 0) +#endif + +#ifndef BITSPERBYTE +# define BITSPERBYTE (NBBY * sizeof (char)) +#endif +#ifndef NBYTES +# define NBYTES(nbits) (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE) +#endif + /* Forwarded declaration */ struct module_ctx; struct rspamd_config; |