diff --git a/amxmodx/JIT/amxexecn-darwin.o b/amxmodx/JIT/amxexecn-darwin.o index 644052bf..b215a7fb 100644 Binary files a/amxmodx/JIT/amxexecn-darwin.o and b/amxmodx/JIT/amxexecn-darwin.o differ diff --git a/amxmodx/JIT/amxexecn.o b/amxmodx/JIT/amxexecn.o index 037a0045..a4970395 100755 Binary files a/amxmodx/JIT/amxexecn.o and b/amxmodx/JIT/amxexecn.o differ diff --git a/amxmodx/JIT/amxexecn.obj b/amxmodx/JIT/amxexecn.obj index 10fff87c..ba9b1d77 100755 Binary files a/amxmodx/JIT/amxexecn.obj and b/amxmodx/JIT/amxexecn.obj differ diff --git a/amxmodx/JIT/amxjitsn-darwin.o b/amxmodx/JIT/amxjitsn-darwin.o index 523dd9a3..1a6d578d 100644 Binary files a/amxmodx/JIT/amxjitsn-darwin.o and b/amxmodx/JIT/amxjitsn-darwin.o differ diff --git a/amxmodx/JIT/amxjitsn.o b/amxmodx/JIT/amxjitsn.o index 6d1b2e59..2a4375ed 100755 Binary files a/amxmodx/JIT/amxjitsn.o and b/amxmodx/JIT/amxjitsn.o differ diff --git a/amxmodx/JIT/amxjitsn.obj b/amxmodx/JIT/amxjitsn.obj index b36c85aa..c96c9a8e 100755 Binary files a/amxmodx/JIT/amxjitsn.obj and b/amxmodx/JIT/amxjitsn.obj differ diff --git a/amxmodx/amxexecn.asm b/amxmodx/amxexecn.asm index 0230a344..bc81824c 100755 --- a/amxmodx/amxexecn.asm +++ b/amxmodx/amxexecn.asm @@ -1480,7 +1480,7 @@ OP_FLOAT_ROUND: push 0 mov ebp,esp fstcw [ebp] - mov eax,[ebp] + mov eax,[ebp] push eax ;clear the top bits xor ah,ah @@ -1492,22 +1492,20 @@ OP_FLOAT_ROUND: ;set the bits or ah,dl ;set bits 15,14 of FCW to rounding method or ah,3 ;set precision to 64bit - mov [ebp], eax - fldcw [ebp] + ;calculate sub esp,4 fld dword [edi+ecx+4] test edx,edx - jz .correct - jmp .skip_correct - .correct: - fadd st0 + jnz .skip_correct + ;nearest mode + ;correct so as to AVOID bankers rounding + or ah, 4 ;set rounding mode to floor fadd dword [g_round_nearest] - fistp dword [esp] - pop eax - sar eax,1 - jmp .done + .skip_correct: + mov [ebp], eax + fldcw [ebp] frndint fistp dword [esp] pop eax diff --git a/amxmodx/amxjitsn.asm b/amxmodx/amxjitsn.asm index 38b0dd45..20f12015 100755 --- a/amxmodx/amxjitsn.asm +++ b/amxmodx/amxjitsn.asm @@ -1979,22 +1979,20 @@ OP_FLOAT_ROUND: ;set the bits or ah,dl ;set bits 15,14 of FCW to rounding method or ah,3 ;set precision to 64bit - mov [ebp], eax - fldcw [ebp] + ;calculate sub esp,4 fld dword [esi+4] test edx,edx - jz .correct - jmp .skip_correct - .correct: - fadd st0 + jnz .skip_correct + ;nearest mode + ;correct so as to AVOID bankers rounding + or ah, 4 ;set rounding mode to floor fadd dword [g_round_nearest] - fistp dword [esp] - pop eax - sar eax,1 - jmp .done + .skip_correct: + mov [ebp], eax + fldcw [ebp] frndint fistp dword [esp] pop eax