diff options
author | Marti Bolivar <mbolivar@leaflabs.com> | 2012-05-08 15:00:32 -0400 |
---|---|---|
committer | Marti Bolivar <mbolivar@leaflabs.com> | 2012-05-16 13:23:38 -0400 |
commit | 3718450ce3b033bcb4fa1ea80701566b1a7003d7 (patch) | |
tree | e7639bfd5bf6241e435fa826013a2754dd508783 /source | |
parent | 21cda933aeacb8f4e3bdb9a0f5c518b0db943585 (diff) | |
download | librambutan-3718450ce3b033bcb4fa1ea80701566b1a7003d7.tar.gz librambutan-3718450ce3b033bcb4fa1ea80701566b1a7003d7.zip |
libmaple/api/util.rst: Fixes and tweaks.
Update title for new libmaple include style.
Fix up the bit-manipulation macros; we can't use doxygendefine yet, as
its output is missing macro parameter names.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Diffstat (limited to 'source')
-rw-r--r-- | source/libmaple/api/util.rst | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/source/libmaple/api/util.rst b/source/libmaple/api/util.rst index 06c9246..434307e 100644 --- a/source/libmaple/api/util.rst +++ b/source/libmaple/api/util.rst @@ -1,8 +1,8 @@ .. highlight:: c .. _libmaple-util: -``util.h`` -========== +``<libmaple/util.h>`` +===================== .. TODO [0.2.0?] clean this up. @@ -14,13 +14,15 @@ Miscellaneous utility macros and procedures. Bit Manipulation ---------------- -:: +The following macros are useful for bit manipulation. - #define BIT(shift) (1UL << (shift)) - #define BIT_MASK_SHIFT(mask, shift) ((mask) << (shift)) - /** Gets bits m to n of x */ - #define GET_BITS(x, m, n) ((((uint32)x) << (31 - (n))) >> ((31 - (n)) + (m))) - #define IS_POWER_OF_TWO(v) (v && !(v & (v - 1))) +**BIT(shift)**: ``1UL << (shift)`` + +**BIT_MASK_SHIFT(mask, shift)**: ``mask << shift`` + +**GET_BITS(x, m, n)**: Bits ``m`` to ``n`` of ``x``, right-aligned. + +**IS_POWER_OF_TWO(v)**: True iff ``v`` is a power of two (1, 2, 4, etc.) Failure Routines ---------------- |