Archived

This topic is now archived and is closed to further replies.

__int64 on Athlon64 and FX CPUs

This topic is 5017 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, I''m realize this might be a dumb question (since the answer would seem to be obvious).... Anyway... I''m thinking about replacing the board representation of my chess engine from arrays to bitboards. For this to provide a significant performance boost, I have to have real 64 bit integers. An __int64 in C on windows seems to be a struct containing an upper and a lower DWORD that are combined together with some compiler trickery to provide the illusion of 64 bit ints on a 32bit CPU. My question is if I were to have a Athlon64, will the __int64''s in my code be "real 64 bit ints" (by this I mean fast bitshifts, adds, and multiplies)? I assume I would have to recompile specifically for the Athlon64. Can Visual Studio do this? I''m a little confused because I have heard that Windows XP doesn''t support 64 bit CPUs. Does that mean that I can''t use 64 bit ints, or only that the operating system itself isn''t 64-bit optimized? On a 64bit CPU, are integer additions, shifts, multiplies, and modulo division all 1 cycle operations? I''m under the impression that they are on the 32bit Pentium 4s. Is this correct? ---------------------------------------- Let be be finale of seem, seems to me. ---------------------------------------- Coding: http://www.stanford.edu/~jjshed/coding Miscellany: http://www.stanford.edu/~jjshed

Share this post


Link to post
Share on other sites
I don''t recall there being any 64-bit versions of Visual Studio, so you might have to compile with the newest GCC or something to get actual 64-bit code...

Share this post


Link to post
Share on other sites
if you can compile to x86-64 code (and one day, you can, for sure.. depending on who you are, and what tools you can get, you can, even now), yes, 64bit integers will be native => directly accessed with individual assembler-instructions.

this doesn''t mean everything is one clockcycle. this is cpu dependent, but you can read up on the amd page about this. in general, they will be 1, 2 cycles at max, i guess all bitwise ops will be one-cycle. but thats just a guess.

you can just have some typedef __int64 chessboard; for now, and compile with it, even if it''s, in the back, a struct, on 32bit compiled executables. just wait till you can compile for x86-64, possibly rewrite the typedef to typedef int chessboard (not sure if in gets 64bits then), recompile, and done.




If that''s not the help you''re after then you''re going to have to explain the problem better than what you have. - joanusdmentia

davepermen.net

Share this post


Link to post
Share on other sites
it is unlikely that int will be promoted to 64 bits, as that would cause all kinds of havok. on some 64 bit machines & compilers ''long'' becomes 64 bits, but it is more than likely that that too will not change. if you do want an actual 64bit register chances are you will have to use size_t

Share this post


Link to post
Share on other sites