summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorVarun Wadekar <vwadekar@nvidia.com>2017-05-18 10:32:51 -0700
committerVarun Wadekar <vwadekar@nvidia.com>2017-06-14 16:58:46 -0700
commit6176b4fcb4175a25d918345a729cce560b9356c2 (patch)
treebad5f0634018d0f698effc7d66b8afd13fe4be36 /include
parentfb7d32e5881ef2445e8fe2305005f5590d4a7cfa (diff)
Add U() macro to share constants between C and other sources
This patch adds the U(_x) macros to utils_def.h to allow constants to be shared between C and other sources. Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Diffstat (limited to 'include')
-rw-r--r--include/lib/utils_def.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/include/lib/utils_def.h b/include/lib/utils_def.h
index 98e78347..52496000 100644
--- a/include/lib/utils_def.h
+++ b/include/lib/utils_def.h
@@ -57,16 +57,19 @@
(((ptr) > UINTPTR_MAX - (inc)) ? 1 : 0)
/*
- * For those constants to be shared between C and other sources, apply a 'ull'
- * suffix to the argument only in C, to avoid undefined or unintended behaviour.
+ * For those constants to be shared between C and other sources, apply a 'u'
+ * or 'ull' suffix to the argument only in C, to avoid undefined or unintended
+ * behaviour.
*
- * The GNU assembler and linker do not support the 'ull' suffix (it causes the
- * build process to fail) therefore the suffix is omitted when used in linker
- * scripts and assembler files.
+ * The GNU assembler and linker do not support the 'u' and 'ull' suffix (it
+ * causes the build process to fail) therefore the suffix is omitted when used
+ * in linker scripts and assembler files.
*/
#if defined(__LINKER__) || defined(__ASSEMBLY__)
+# define U(_x) (_x)
# define ULL(_x) (_x)
#else
+# define U(_x) (_x##u)
# define ULL(_x) (_x##ull)
#endif