Commit 46c613ee authored by Yann Gautier's avatar Yann Gautier
Browse files

utils_def: add an assembly version for GENMASK



When compiling assembly files, stdint.h is not included.
UINT32_C and UINT64_C are then not defined.
A new GENMASK macro for assembly is then created.
Signed-off-by: default avatarYann Gautier <yann.gautier@st.com>
parent 35c4b414
...@@ -30,11 +30,19 @@ ...@@ -30,11 +30,19 @@
* position @h. For example * position @h. For example
* GENMASK_64(39, 21) gives us the 64bit vector 0x000000ffffe00000. * GENMASK_64(39, 21) gives us the 64bit vector 0x000000ffffe00000.
*/ */
#if defined(__LINKER__) || defined(__ASSEMBLY__)
#define GENMASK_32(h, l) \
(((0xFFFFFFFF) << (l)) & (0xFFFFFFFF >> (32 - 1 - (h))))
#define GENMASK_64(h, l) \
((~0 << (l)) & (~0 >> (64 - 1 - (h))))
#else
#define GENMASK_32(h, l) \ #define GENMASK_32(h, l) \
(((~UINT32_C(0)) << (l)) & (~UINT32_C(0) >> (32 - 1 - (h)))) (((~UINT32_C(0)) << (l)) & (~UINT32_C(0) >> (32 - 1 - (h))))
#define GENMASK_64(h, l) \ #define GENMASK_64(h, l) \
(((~UINT64_C(0)) << (l)) & (~UINT64_C(0) >> (64 - 1 - (h)))) (((~UINT64_C(0)) << (l)) & (~UINT64_C(0) >> (64 - 1 - (h))))
#endif
#ifdef AARCH32 #ifdef AARCH32
#define GENMASK GENMASK_32 #define GENMASK GENMASK_32
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment