I have following snap of code. If I build the same in VC6++ I get following assembly output.
124: val = Count(x);
00401068 mov ecx,dword ptr [ebp-4]
0040106B shl ecx,4
0040106E mov eax,dword ptr [ebp-4]
00401071 xor edx,edx
00401073 mov esi,3
00401078 div eax,esi
0040107A sub ecx,eax
0040107C shr ecx,5
0040107F mov word ptr [ebp-8],cx
whereas when I build it in Borland C 4.02 version all operations like shl, div and shr are replaced by some function calls.
mov dx,word ptr DGROUP:_something+2
mov ax,word ptr DGROUP:_something
call near ptr N_LXLSH@
push word ptr DGROUP:_something+2
push word ptr DGROUP:_something
call near ptr N_LUDIV@
call near ptr N_LXURSH@
mov word ptr DGROUP:_something+8,ax
Please let me know why is this happeneing?
So what compiler is better? Is there any compiler switch that will will replace function calls with directly with assembly instrction in Borland o/p?