Author: Bo Persson
Date: 04:14:35 01/17/04
Go up one level in this thread
On January 16, 2004 at 22:35:55, Robert Hyatt wrote: >On January 16, 2004 at 22:15:34, Federico Corigliano wrote: > >>Hi >> >>In my engine I have a lot of #defines as: >>#define FileA 0xFFFFFFFF <- I don't remember the real value >>and I want to convert it to: >>const UINT64 FileA = 0xFFFFFFFFF; >>I the change can affect the speed. As I often use MSVC Debugger, it's boring to >>translate every #define to the respective number. >> >>Federico > >I don't think there will be much difference. Using a #define might produce >some asm code with 32 bit immediate values which will bloat the code a bit, >while using the const int64 will plop one copy of the value in memory making >it fit in cache maybe a bit better. <nitpicking> There is a minute difference between C and C++, in that const values have internal linkage by default in C++ (in C that would be 'static const'). That saves the compiler from having to store the value in memory, as it cannot be accessed from other compilation units anyway. </nitpicking> > >Best bet is to try it and see which is faster for _your_ program and machine. A good idea anyway. Bo Persson
This page took 0.02 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.