On Mon, 2 Jun 2014, Richard Sandiford wrote: > Richard Biener <rguent...@suse.de> writes: > > On Wed, 28 May 2014, Richard Sandiford wrote: > > > >> Richard Biener <rguent...@suse.de> writes: > >> > The following changes the configury to insist on [u]int64_t being > >> > available and removes the very old __int64 case. Autoconf doesn't > >> > check for it, support came in via a big merge in Dec 2002, r60174, > >> > and it was never used on the libcpp side until I fixed that with > >> > the last patch of this series, so we couldn't have relied on it > >> > at least since libcpp was introduced. > >> > > >> > Both libcpp and vmsdbg.h now use [u]int64_t, switching HOST_WIDE_INT > >> > to literally use int64_t has to be done with the grand renaming of > >> > all users due to us using 'unsigned HOST_WIDE_INT'. > >> > > >> > Btw, I couldn't find any "standard" way of writing > >> > [u]int64_t literals (substitution for HOST_WIDE_INT_C) nor > >> > one for printf formats (substitutions for HOST_WIDE_INT_PRINT > >> > and friends). I'll consider doing s/HOST_WIDE_INT/[U]INT64/ > >> > there if nobody comes up with a better plan. > >> > >> Not sure whether you meant that to apply to both groups, but as far as > >> the HOST_WIDE_INT_C replacement goes, how about just using int64_t (N) > >> instead of HOST_WIDE_INT_C (N) or INT64_C (N)? > > > > int64_t (N) would already be "taken", but yes, I considered [U]INT64_C > > (N). > > Not sure what you mean by "taken" though. Isn't it just a C++-style cast? > The nice thing about [u]int64_t (N) is that it Just Works for both constant > and non-constant N. We shouldn't really need a special macro that can only > handle constant N. > > E.g.: > > #include <stdint.h> > uint64_t x = uint64_t (1) << 48
But HOST_WIDE_INT_C can also be used to write 12443875182037483LL. Not sure if "large" numbers are parsed as 'long long' (give that C++04 doesn't have long long and integer literals not fitting long invoke undefined behavior). For example config/alpha/alpha.c: GEN_INT (HOST_WIDE_INT_C (0xffff0fff0000fff0)), config/alpha/alpha.c: word1 = GEN_INT (HOST_WIDE_INT_C (0xa77b0010a43b0018)); ... config/rs6000/rs6000.c: const HOST_WIDE_INT lower_32bits = HOST_WIDE_INT_C(0xffffffff); config/rs6000/rs6000.c: const HOST_WIDE_INT sign_bit = HOST_WIDE_INT_C(0x80000000); ... (no significant other uses). Richard.