From: Ben Pfaff Date: Wed, 24 Dec 2008 01:02:54 +0000 (-0800) Subject: New macro IS_POW2(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=865f8cf36107c899782f7b325e106a5c20a6ee5c;p=openvswitch New macro IS_POW2(). --- diff --git a/lib/util.h b/lib/util.h index 8172b69e..2086a2ba 100644 --- a/lib/util.h +++ b/lib/util.h @@ -69,6 +69,7 @@ extern const char *program_name; #define ARRAY_SIZE(ARRAY) (sizeof ARRAY / sizeof *ARRAY) #define ROUND_UP(X, Y) (((X) + ((Y) - 1)) / (Y) * (Y)) #define ROUND_DOWN(X, Y) ((X) / (Y) * (Y)) +#define IS_POW2(X) ((X) && !((X) & ((X) - 1))) #ifndef MIN #define MIN(X, Y) ((X) < (Y) ? (X) : (Y))