diff options
| author | Ben Pfaff <blp@nicira.com> | 2009-09-17 15:12:34 -0700 |
|---|---|---|
| committer | Ben Pfaff <blp@nicira.com> | 2009-09-17 15:12:34 -0700 |
| commit | ba25c9d14ad6de05f13d3ebb1fa9242eebf34266 (patch) | |
| tree | c9c780e1edd12a3d21675c2f6fd2058d6214bfc3 /lib/util.h | |
| parent | d0c9d304ffe9282c1f75d44c86e471d614af632c (diff) | |
| download | openvswitch-ba25c9d14ad6de05f13d3ebb1fa9242eebf34266.tar.gz | |
util: Add comments.
Diffstat (limited to 'lib/util.h')
| -rw-r--r-- | lib/util.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/util.h b/lib/util.h index dad7b7c40..962bad2f3 100644 --- a/lib/util.h +++ b/lib/util.h @@ -52,10 +52,19 @@ extern const char *program_name; +/* Returns the number of elements in ARRAY. */ #define ARRAY_SIZE(ARRAY) (sizeof ARRAY / sizeof *ARRAY) + +/* Returns X / Y, rounding up. X must be nonnegative to round correctly. */ #define DIV_ROUND_UP(X, Y) (((X) + ((Y) - 1)) / (Y)) + +/* Returns X rounded up to the nearest multiple of Y. */ #define ROUND_UP(X, Y) (DIV_ROUND_UP(X, Y) * (Y)) + +/* Returns X rounded down to the nearest multiple of Y. */ #define ROUND_DOWN(X, Y) ((X) / (Y) * (Y)) + +/* Returns true if X is a power of 2, otherwise false. */ #define IS_POW2(X) ((X) && !((X) & ((X) - 1))) #ifndef MIN |
