Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: 64-bit long long in GNU C

Author: Stuart Cracraft

Date: 20:21:32 07/24/04

Go up one level in this thread


On July 24, 2004 at 18:45:28, Omid David Tabibi wrote:

>On July 24, 2004 at 15:38:36, Dieter Buerssner wrote:
>
>>On July 24, 2004 at 14:58:51, Stuart Cracraft wrote:
>>
>>>I am printing it out with
>>>
>>>  long long variable;
>>>  ... do stuff to set variable ...
>>>  printf("llx\n",variable);

Dieter -- sorry I was using a % -- just sleepy lately from too much
chess work.

>>
>>% sign is missing. Note that "llx" expects unsigned long long, not (signed) long
>>long. It will most probably work, but is not totally correct.
>>
>>>but when I put this elsewhere in the code
>>>
>>>  if (variable == 0x....)
>>>
>>>the compilation balks with
>>>
>>>  ga.c:2959: warning: integer constant is too large for "long" type
>>
>>Is variable really long long, and not long? If yes:
>>
>>It's just a harmless warning. You can ignore it. The code is correct (according
>>to the C-Standard). You can get rid of the warning with
>>
>>if (variable == 0x123456789abcdefULL)
>>
>>It is unfortunately not very portable yet (although it is in the the ISO C
>>Standard of 1999).
>
>I do the following:
>
>
>#if defined (_MSC_VER)
>#  define _LL(n)		(n ## I64)
>#  define _ULL(n)		(n ## UI64)
>#else
>#  define _LL(n)		(n ## LL)
>#  define _ULL(n)		(n ## ULL)
>#endif
>
>So, in the above example I will do:
>
>if (variable == _ULL(0x123456789abcdef))
>
>
>

Omid -- thanks -p erfect -- Have implemented above. Now facing
the big search bug. :-(



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.