Author: Gerd Isenberg
Date: 07:56:35 12/23/05
Go up one level in this thread
Ok, for better readability ;-)
Cheers,
Gerd
typedef unsigned __int64 OneSizeFits;
typedef unsigned int HotRats;
const HotRats s = 0;
const HotRats heik = 457;
const HotRats y = s+1;
const HotRats e = y+y;
const HotRats r = e+y;
const HotRats b = e+e;
const HotRats o = b+y;
const HotRats u = e*b;
const HotRats t = e*u;
const HotRats i = e*t;
const HotRats ka = (y<<b)-y;
const HotRats waka = (y<<u)-y;
const HotRats jawaka = (y<<t)-y;
const HotRats jazzFromHell = s-(t*r*heik);
HotRats freakOut(OneSizeFits all) {
HotRats so,fa;
fa = (HotRats)(all >> i);
so = (fa!=s) << o;
fa ^= (HotRats) all & (fa!=s)-y;
so ^= (jawaka < fa) << b;
fa >>= (jawaka < fa) << b;
so ^= ( waka - fa) >> t & u;
fa >>= ( waka - fa) >> t & u;
so ^= ( ka - fa) >> u & b;
fa >>= ( ka - fa) >> u & b;
so ^= jazzFromHell >> e*fa & r;
return so;
}
generated assembly - fastcall does not help:
_TEXT SEGMENT
_all$ = 8
?freakOut@@YII_K@Z PROC NEAR ; freakOut, COMDAT
00000 8b 54 24 08 mov edx, DWORD PTR _all$[esp]
00004 33 c0 xor eax, eax
00006 8b 4c 24 04 mov ecx, DWORD PTR _all$[esp-4]
0000a 56 push esi
0000b 85 d2 test edx, edx
0000d 0f 95 c0 setne al
00010 57 push edi
00011 8b f8 mov edi, eax
00013 c1 e7 05 shl edi, 5
00016 48 dec eax
00017 be 0f 00 00 00 mov esi, 15 ; 0000000fH
0001c 23 c1 and eax, ecx
0001e 33 d0 xor edx, eax
00020 b8 ff ff 00 00 mov eax, 65535 ; 0000ffffH
00025 3b c2 cmp eax, edx
00027 b8 50 aa ff ff mov eax, -21936 ; ffffaa50H
0002c 1b c9 sbb ecx, ecx
0002e f7 d9 neg ecx
00030 c1 e1 04 shl ecx, 4
00033 d3 ea shr edx, cl
00035 33 f9 xor edi, ecx
00037 b9 ff 00 00 00 mov ecx, 255 ; 000000ffH
0003c 2b ca sub ecx, edx
0003e c1 e9 10 shr ecx, 16 ; 00000010H
00041 83 e1 08 and ecx, 8
00044 d3 ea shr edx, cl
00046 33 f9 xor edi, ecx
00048 2b f2 sub esi, edx
0004a c1 ee 08 shr esi, 8
0004d 83 e6 04 and esi, 4
00050 8b ce mov ecx, esi
00052 d3 ea shr edx, cl
00054 d1 e2 shl edx, 1
00056 8b ca mov ecx, edx
00058 d3 e8 shr eax, cl
0005a 83 e0 03 and eax, 3
0005d 33 c6 xor eax, esi
0005f 33 c7 xor eax, edi
00061 5f pop edi
00062 5e pop esi
00063 c2 08 00 ret 8
?freakOut@@YII_K@Z ENDP ; freakOut
_TEXT ENDS
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.