Author: Dezhi Zhao
Date: 13:10:01 09/04/03
Go up one level in this thread
On September 04, 2003 at 15:27:45, Dieter Buerssner wrote:
>On September 04, 2003 at 15:08:37, Dezhi Zhao wrote:
>
>>__declspec(naked) void __fastcall update_key_non_capture_asm(int move)
>>{
>> __asm
>> {
>> movzx eax, cl // from
>
>Does the __fastcall guarantee, that move is in ecx?
>
>> movzx edx, ch // to
>> shr ecx, 10 // type * 64
>
>You change ecx. Does the compiler note this? Or will the caller see move
>magically changed (like a call by reference)?
>>__int64 rand64()
>>{
>> union
>> {
>> __int64 q;
>> struct
>> {
>> int low;
>> int high;
>> };
>> } r;
>>
>> r.low = rand() | (rand() << 16);
>
>This will make the code somewhat unreproducable. The order in which the 2
>rand() are called is not specified, and can depend on the compiler or even on
>options to the compiler. Also, many libraries only have only 15 bit rand(), so
>it will leave 4 bits unset always. For libraries, that use more than 16 bits for
>rand, it will produce suboptimal values, with more set than unset bits. Using
>xor instead of or would get rid of that problem. For a practical chess engine,
>and especially with portability (which of course somehow contradicts the whole
>sense of your test) and reproducability in mind, it would probably be best to
>use some (small) random number generator in source code.
>
>I would use unsigned values.
>
>Sure, that all is no problem for this speed test.
>
>Regards,
>Dieter
Yes. You are right. For the test purpose you can even leave them uninitialized
and do not use any random number generator at all. I enclude this simple one so
that the correctness of the assembly code can be easily verified.
Have fun.
Zhao
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.