Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Outputting u64 word using printf?

Author: James Swafford

Date: 07:47:17 06/07/04

Go up one level in this thread


On June 07, 2004 at 10:36:58, Vincent Diepeveen wrote:

>On June 07, 2004 at 10:30:50, Fabien Letouzey wrote:
>
>>>Like when I tried this,
>>
>>>void main()
>>>{
>>>	typedef unsigned __int64 u64;
>>>	u64 r;
>>>	r=1<<36;
>>>	printf("%I64u",r);
>>>	getchar();
>>>}
>>


The problem is 1 is a 32 bit int.
Try something like this:

u64 a,b=1;

a=b<<36;

--
James


>>>The r value was printed as 0.Also for other numbers >36 its printing as 0.Is
>>>this correct value that r is having?
>>
>>Yes, you shift "1" which is a 32-bit integer (int).
>>It should be r = 1ui64 << 36;
>>I suppose "1i64u" or "(unsigned __int64) 1" also work.
>>
>>Fabien.
>
>r = 1<<36; // works for good compilers not for the rest



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.