dovecot-2.2: lib: bits - Add macro for '1 << i'

dovecot at dovecot.org dovecot at dovecot.org
Wed Mar 18 15:11:17 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/305f5c2cf13e
changeset: 18366:305f5c2cf13e
user:      Phil Carmody <phil at dovecot.fi>
date:      Wed Mar 18 17:09:30 2015 +0200
description:
lib: bits - Add macro for '1 << i'
It's used all over the place. It feels weird not having access to such a macro.

Signed-off-by: Phil Carmody <phil at dovecot.fi>

diffstat:

 src/lib/bits.h |  2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diffs (12 lines):

diff -r 128115b3807c -r 305f5c2cf13e src/lib/bits.h
--- a/src/lib/bits.h	Wed Mar 18 13:43:35 2015 +0200
+++ b/src/lib/bits.h	Wed Mar 18 17:09:30 2015 +0200
@@ -15,6 +15,8 @@
 #define UINT64_SUM_OVERFLOWS(a, b) \
 	(a > (uint64_t)-1 - b)
 
+#define BIT(n) (1u << (n))
+
 size_t nearest_power(size_t num) ATTR_CONST;
 
 unsigned int bits_required8(uint8_t num) ATTR_CONST;


More information about the dovecot-cvs mailing list