aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorYann Gautier <yann.gautier@st.com>2018-06-14 13:28:31 +0200
committerYann Gautier <yann.gautier@st.com>2018-06-14 18:35:38 +0200
commit167c5f8098d372e15e2ec0791beb323e880cdfff (patch)
treec081cc3e6cdcaeb5ac121eb80a56292f81ca87d6 /include
parent39676357af8318b7ec624f8a26bcc7ea0fbc7040 (diff)
downloadplatform_external_arm-trusted-firmware-167c5f8098d372e15e2ec0791beb323e880cdfff.tar.gz
platform_external_arm-trusted-firmware-167c5f8098d372e15e2ec0791beb323e880cdfff.tar.bz2
platform_external_arm-trusted-firmware-167c5f8098d372e15e2ec0791beb323e880cdfff.zip
utils: Add BIT_32 and BIT_64 macros
When applying some MISRA rules, lots of issues are raised with BIT macro on AARCH32, and cast on uint32_t would be required (Rule 10.3). The macros BIT_32 and BIT_64 are then created for 32bit and 64bit. Then the BIT macro defaults on BIT_64 on AARCH64, and on BIT_32 on AARCH32. Signed-off-by: Yann Gautier <yann.gautier@st.com>
Diffstat (limited to 'include')
-rw-r--r--include/lib/utils_def.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/lib/utils_def.h b/include/lib/utils_def.h
index 2975103f5..7335103b1 100644
--- a/include/lib/utils_def.h
+++ b/include/lib/utils_def.h
@@ -16,7 +16,14 @@
#define SIZE_FROM_LOG2_WORDS(n) (4 << (n))
-#define BIT(nr) (ULL(1) << (nr))
+#define BIT_32(nr) (U(1) << (nr))
+#define BIT_64(nr) (ULL(1) << (nr))
+
+#ifdef AARCH32
+#define BIT BIT_32
+#else
+#define BIT BIT_64
+#endif
/*
* Create a contiguous bitmask starting at bit position @l and ending at