Commit 6176b4fc authored by Varun Wadekar's avatar Varun Wadekar
Browse files

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: default avatarVarun Wadekar <vwadekar@nvidia.com>
parent fb7d32e5
...@@ -57,16 +57,19 @@ ...@@ -57,16 +57,19 @@
(((ptr) > UINTPTR_MAX - (inc)) ? 1 : 0) (((ptr) > UINTPTR_MAX - (inc)) ? 1 : 0)
/* /*
* For those constants to be shared between C and other sources, apply a 'ull' * For those constants to be shared between C and other sources, apply a 'u'
* suffix to the argument only in C, to avoid undefined or unintended behaviour. * 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 * The GNU assembler and linker do not support the 'u' and 'ull' suffix (it
* build process to fail) therefore the suffix is omitted when used in linker * causes the build process to fail) therefore the suffix is omitted when used
* scripts and assembler files. * in linker scripts and assembler files.
*/ */
#if defined(__LINKER__) || defined(__ASSEMBLY__) #if defined(__LINKER__) || defined(__ASSEMBLY__)
# define U(_x) (_x)
# define ULL(_x) (_x) # define ULL(_x) (_x)
#else #else
# define U(_x) (_x##u)
# define ULL(_x) (_x##ull) # define ULL(_x) (_x##ull)
#endif #endif
......
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