lib: bsp: Add UPPER_32_BITS and LOWER_32_BITS macro's

UPPER_32_BITS(x) macro to handle shifts that may be >= the width of
the data type.
LOWER_32_BITS(x) macro to handle masking of 32-bit data types.

Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
Acked-by: Anirudha Sarangi   <anirudh@xilinx.com>
This commit is contained in:
Kedareswara rao Appana 2015-07-27 15:07:13 +05:30 committed by Nava kishore Manne
parent 1f3de84cd2
commit 60efc68c14

View file

@ -164,6 +164,22 @@ typedef void (*XInterruptHandler) (void *InstancePtr);
*/
typedef void (*XExceptionHandler) (void *InstancePtr);
/**
* UPPER_32_BITS - return bits 32-63 of a number
* @n: the number we're accessing
*
* A basic shift-right of a 64- or 32-bit quantity. Use this to suppress
* the "right shift count >= width of type" warning when that quantity is
* 32-bits.
*/
#define UPPER_32_BITS(n) ((u32)(((n) >> 16) >> 16))
/**
* LOWER_32_BITS - return bits 0-31 of a number
* @n: the number we're accessing
*/
#define LOWER_32_BITS(n) ((u32)(n))
/*@}*/