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:
parent
1f3de84cd2
commit
60efc68c14
1 changed files with 16 additions and 0 deletions
|
@ -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))
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue