64-bit constants in source code

David Holmes - Sun Microsystems David.Holmes at Sun.COM
Tue Jun 16 05:13:27 PDT 2009


Christian,

According to the definition of the macro you should have used a LL 
suffix not just L.

The macros deal with compiler specific mechanisms for defining 64-bit 
constants. Looks like gcc and SS have converged these days, but Visual 
Studio is quite different:

globalDefinitions_gcc.hpp:#define CONST64(x)  (x ## LL)
globalDefinitions_gcc.hpp:#define UCONST64(x) (x ## ULL)
globalDefinitions_sparcWorks.hpp:#define CONST64(x)  (x ## LL)
globalDefinitions_sparcWorks.hpp:#define UCONST64(x) (x ## ULL)
globalDefinitions_visCPP.hpp:#define CONST64(x)  (x ## i64)
globalDefinitions_visCPP.hpp:#define UCONST64(x) ((uint64_t)CONST64(x))

Cheers,
David Holmes


Christian Thalinger said the following on 06/16/09 21:52:
> Hi!
> 
> Yesterday I noticed that there are compiler specific CONST64 macros 
> which emit the correct syntax for 64-bit constants for the various 
> compilers HotSpot supports.
> 
> Is it recommended/required to use:
> 
> CONST64(0x00000000FFFFFFFF)
> 
> instead of:
> 
> 0x00000000FFFFFFFFL
> 
> (I commited some code lately that uses the later.)
> 
> -- Christian



More information about the hotspot-dev mailing list