.net framework 2.0
-
bir bit count tablosunu initialize etmek icin .net framework 2.0 64-bit'te:
c#
byte[] bitcounts = new byte[256];
for (int n = 0; n < 256; n++) for (int i = n; i > 0; i >>= 1) bitcounts[n] += (byte)(i & 1);
c# compiler'in urettigi x64 kodu:
mov r11,rax
xor r8d,r8d
xor r9d,r9d
xchg ax,ax
mov edx,r8d
test edx,edx
jle 00000642`80150200
xchg ax,ax
xchg ax,ax
xchg ax,ax
mov al,byte ptr [r11+r9+10h]
movzx ecx,al
mov eax,edx
and eax,1
movzx eax,al
add ecx,eax
mov byte ptr [r11+r9+10h],cl
sar edx,1
test edx,edx
jg 00000642`801501e0
xchg ax,ax
add r8d,1
add r9,1
cmp r9,100h
jl 00000642`801501d0
bu da ayni kodun c hali:
unsigned char bitcounts[256];
for (int n = 0; n < 256; n++) for (int i = n; i > 0; i >>= 1) bitcounts[n] += i & 1;
visual studio 2005 c/c++ compiler'inin native olarak x64 icin urettigi kod:
xor r8d,r8d
xchg ax,ax
test r8d,r8d
mov ecx,r8d
je main+18dh (40118dh)
movzx edx,byte ptr [rbx]
xchg ax,ax
xchg ax,ax
movzx eax,cl
and al,1
add dl,al
sar ecx,1
jne main+180h (401180h)
mov byte ptr [rbx],dl
add r8d,1
add rbx,1
cmp r8d,100h
jl main+170h (401170h)
netice olarak diyorum ki .net framework gibi luks bir ortam icin super.
java'nin jit'inin (eger 64-bit destekliyorsa) ne marifetler yaptigini da gormek isterdim ama o imkanimiz yok sanirim.
ekşi sözlük kullanıcılarıyla mesajlaşmak ve yazdıkları entry'leri
takip etmek için giriş yapmalısın.
hesabın var mı? giriş yap