AMD Athlon(tm) II X2 220 Processor (SSE3)
833 cycles for 100 * C2D_J
2410 cycles for 100 * atodw
34220 cycles for 100 * sscanf
1296 cycles for 100 * min2cvt
1057 cycles for 100 * min1cvt
806 cycles for 100 * C2D_J
2437 cycles for 100 * atodw
34498 cycles for 100 * sscanf
1297 cycles for 100 * min2cvt
1053 cycles for 100 * min1cvt
805 cycles for 100 * C2D_J
2436 cycles for 100 * atodw
34558 cycles for 100 * sscanf
1297 cycles for 100 * min2cvt
1055 cycles for 100 * min1cvt
805 cycles for 100 * C2D_J
2410 cycles for 100 * atodw
34503 cycles for 100 * sscanf
1296 cycles for 100 * min2cvt
1060 cycles for 100 * min1cvt
50 bytes for C2D_J
10 bytes for atodw
22 bytes for sscanf
98 bytes for min2cvt
62 bytes for min1cvt
1234 = eax C2D_J
1234 = eax atodw
1234 = eax sscanf
1234 = eax min2cvt
1234 = eax min1cvt
--- ok ---LUT with Pelles C1: #include <stdio.h>
2: int a10[] = {0,10,20,30,40,50,60,70,80,90};
3: int a100[] = {0,100,200,300,400,500,600,700,800,900};
4: int a1000[] = {0,1000,2000,3000,4000,5000,6000,7000,8000,9000};
5:
6: int __cdecl main(void)
_main:
[00000000] 55 push ebp
[00000001] 89E5 mov ebp,esp
[00000003] 83EC08 sub esp,8
7: {
8: char anum[] = "1234";
[00000006] C745FB31323334 mov dword ptr [ebp-5],34333231
[0000000D] C645FF00 mov byte ptr [ebp-1],0
9: int num;
10:
11: (*(int*)&anum) &= 0x0f0f0f0f;
[00000011] 8165FB0F0F0F0F and dword ptr [ebp-5],F0F0F0F
12: num = a1000[anum[0]] + a100[anum[1]] + a10[anum[2]] + anum[3];
[00000018] 0FBE45FB movsx eax,byte ptr [ebp-5]
[0000001C] 8B048500000000 mov eax,dword ptr [eax*4+_a1000]
[00000023] 0FBE55FC movsx edx,byte ptr [ebp-4]
[00000027] 03049500000000 add eax,dword ptr [edx*4+_a100]
[0000002E] 0FBE55FD movsx edx,byte ptr [ebp-3]
[00000032] 03049500000000 add eax,dword ptr [edx*4+_a10]
[00000039] 0FBE55FE movsx edx,byte ptr [ebp-2]
[0000003D] 01D0 add eax,edx
13: printf("%u\n", num);
[0000003F] 50 push eax
[00000040] 6800000000 push @6
[00000045] E800000000 call _printf
[0000004A] 83C408 add esp,8
14: return 0;
[0000004D] 31C0 xor eax,eax
[0000004F] 89EC mov esp,ebp
[00000051] 5D pop ebp
[00000052] C3 ret
using temporary string char anum2[] = "1234";
char anum[5];
int num;
12: (*(int*)&anum) = (*(int*)&anum2) & 0x0f0f0f0f;
[00000011] 8B45FB mov eax,dword ptr [ebp-5]
[00000014] 250F0F0F0F and eax,F0F0F0F
[00000019] 8945F6 mov dword ptr [ebp-A],eax