summaryrefslogtreecommitdiff
path: root/src/helper/types.h
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-16 02:53:57 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-16 09:58:11 -0800
commita94748ec6da9bdc6e25a7f73bbea723b8b55fa33 (patch)
treec6aebc5e8f39d0918f9a88dd43e373ea9d28e210 /src/helper/types.h
parentf0ce88b3af9a6090ac986160950d66317de5087e (diff)
downloadopenocd+libswd-a94748ec6da9bdc6e25a7f73bbea723b8b55fa33.tar.gz
openocd+libswd-a94748ec6da9bdc6e25a7f73bbea723b8b55fa33.tar.bz2
openocd+libswd-a94748ec6da9bdc6e25a7f73bbea723b8b55fa33.tar.xz
openocd+libswd-a94748ec6da9bdc6e25a7f73bbea723b8b55fa33.zip
rename CEIL as DIV_ROUND_UP
Improves the name of this macro, moves it to types.h, and adds a block of Doxygen comments to describe what it does.
Diffstat (limited to 'src/helper/types.h')
-rw-r--r--src/helper/types.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/helper/types.h b/src/helper/types.h
index a8753c5f..8f6283b5 100644
--- a/src/helper/types.h
+++ b/src/helper/types.h
@@ -73,6 +73,15 @@ typedef bool _Bool;
(type *)( (char *)__mptr - offsetof(type,member) );})
+/**
+ * Rounds @c m up to the nearest multiple of @c n using division.
+ * @params m The value to round up to @c n.
+ * @params n Round @c m up to a multiple of this number.
+ * @returns The rounded integer value.
+ */
+#define DIV_ROUND_UP(m, n) (((m) + (n) - 1) / (n))
+
+
/* DANGER!!!! here be dragons!
*
* Leave these fn's as byte accesses because it is safe