aboutgitcodebugslistschat
path: root/util.h
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2023-02-27 03:30:01 +0100
committerStefano Brivio <sbrivio@redhat.com>2023-02-27 18:55:31 +0100
commit26a0e4d6ee17fa174a401d8e8d9a4c189f11f258 (patch)
tree233888516fe2b8d021b2d09897e82025cc3aa390 /util.h
parent4f523c3276741781346478328f863e60f30cba8e (diff)
downloadpasst-26a0e4d6ee17fa174a401d8e8d9a4c189f11f258.tar
passt-26a0e4d6ee17fa174a401d8e8d9a4c189f11f258.tar.gz
passt-26a0e4d6ee17fa174a401d8e8d9a4c189f11f258.tar.bz2
passt-26a0e4d6ee17fa174a401d8e8d9a4c189f11f258.tar.lz
passt-26a0e4d6ee17fa174a401d8e8d9a4c189f11f258.tar.xz
passt-26a0e4d6ee17fa174a401d8e8d9a4c189f11f258.tar.zst
passt-26a0e4d6ee17fa174a401d8e8d9a4c189f11f258.zip
Fix definitions of SOCKET_MAX, TCP_MAX_CONNS
...and, given that I keep getting this wrong, add a convenience macro, MAX_FROM_BITS(). Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'util.h')
-rw-r--r--util.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/util.h b/util.h
index 6303c17..570094c 100644
--- a/util.h
+++ b/util.h
@@ -40,6 +40,8 @@
#define ROUND_DOWN(x, y) ((x) & ~((y) - 1))
#define ROUND_UP(x, y) (((x) + (y) - 1) & ~((y) - 1))
+#define MAX_FROM_BITS(n) ((int)((1U << (n)) - 1))
+
#define BIT(n) (1UL << (n))
#define BITMAP_BIT(n) (BIT((n) % (sizeof(long) * 8)))
#define BITMAP_WORD(n) (n / (sizeof(long) * 8))