02-18-2006, 08:49 PM
Both conditions in your while statement get evaluated because you are performing the bitwise AND on the results of the two condtions. See the edit to my first reply.
For a statement such as:
while i>=0 and a(i)>value
fbc.exe produces this assembly language code:
mov eax, dword ptr [_Ii]
test eax, eax
setge al
shr eax, 1
sbb eax, eax
mov ebx, dword ptr [_Ii]
mov ecx, dword ptr [_Ai+ebx*4]
cmp ecx, dword ptr [_VALUEi]
setg cl
shr ecx, 1
sbb ecx, ecx
and eax, ecx
Notice that both calculation are performed every time.
For a statement such as:
while i>=0 and a(i)>value
fbc.exe produces this assembly language code:
mov eax, dword ptr [_Ii]
test eax, eax
setge al
shr eax, 1
sbb eax, eax
mov ebx, dword ptr [_Ii]
mov ecx, dword ptr [_Ai+ebx*4]
cmp ecx, dword ptr [_VALUEi]
setg cl
shr ecx, 1
sbb ecx, ecx
and eax, ecx
Notice that both calculation are performed every time.