From 3718450ce3b033bcb4fa1ea80701566b1a7003d7 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Tue, 8 May 2012 15:00:32 -0400 Subject: 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 --- source/libmaple/api/util.rst | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'source') 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`` -========== +```` +===================== .. 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 ---------------- -- cgit v1.2.3