AndreiB

Incorrect results for integer shifts

Discussion created by AndreiB on Aug 14, 2008
Latest reply on Sep 10, 2008 by AndreiB
Following IL code is supposed to calculate ( 0xabfd3082 << 5 ) which is 0x7fa61040.

But it gives slightly different result -- 0x7fe61040. There's only one-bit difference but it makes huge difference for me.

Is this some bug in CAL or am I missing something?

Thanks in advance.



il_ps_2_0
dcl_input vObjIndex0

dcl_literal l0, 0xabfd3082, 0xabfd3082, 0xabfd3082, 0xabfd3082
dcl_literal l1, 0x00000005, 0x00000005, 0x00000005, 0x00000005

mov r0, vObjIndex0.xxxx

ishl r1, l0, l1

iadd r0, r0, r0
iadd r0, r0, r0

mov g[r0.x + 0], r1
mov g[r0.x + 1], r1
mov g[r0.x + 2], r1
mov g[r0.x + 3], r1

ret_dyn
end

Outcomes