This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Warning with 64-Bit datatype


Michael Pfeiffer <pfeiffer@swac.de> writes:

> Hi,
>
> I get some warnings with following code:
>
> __int64 hash;
>
> hash=(hash<<1) & 0x7FFFFFFFFFFFFFFFL;
>
> The warnings tell me that the constant is too long for the datatype of
> "hash". But when I count the digits of 0x7FFFFFFFFFFFFFFFL there are
> exactly 16 which are equal to 64 bit. It doesn't helps either when I
> change the datatype from __int64 to (unsigned) long long, so what
> could be the reason for this warning?

This is a list about development of GCC and not development with GCC.
Better ask on the gcc-help list next time.

The answer is: 0x7..L is of type long - which is under a 32-bit system a
32-bit type.  You need a long long constant or a 64-bit long type,

Andreas
-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SUSE Linux AG, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]