From a2046fe37fc4cd288fcd32417b0e3b7d2ff4f925 Mon Sep 17 00:00:00 2001 From: TomW Date: Mon, 19 Oct 2015 20:34:58 +0100 Subject: [PATCH] Fixed stupid typos in FPU rounding - Unreal software mode works again. --- src/codegen_ops_x86-64.h | 6 +++--- src/codegen_ops_x86.h | 12 ++++++------ src/x87_ops.h | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/codegen_ops_x86-64.h b/src/codegen_ops_x86-64.h index fb025aa..4561088 100644 --- a/src/codegen_ops_x86-64.h +++ b/src/codegen_ops_x86-64.h @@ -3744,10 +3744,10 @@ static int64_t x87_fround(double b) case 0: /*Nearest*/ a = (int64_t)floor(b); c = (int64_t)floor(b + 1.0); - if ((b - a) < (b - c)) + if ((b - a) < (c - b)) return a; - else if ((b - a) > (b - c)) - return b; + else if ((b - a) > (c - b)) + return c; else return (a & 1) ? c : a; case 1: /*Down*/ diff --git a/src/codegen_ops_x86.h b/src/codegen_ops_x86.h index 79a50f3..110cb14 100644 --- a/src/codegen_ops_x86.h +++ b/src/codegen_ops_x86.h @@ -2261,10 +2261,10 @@ static int32_t x87_fround32(double b) case 0: /*Nearest*/ a = (int64_t)floor(b); c = (int64_t)floor(b + 1.0); - if ((b - a) < (b - c)) + if ((b - a) < (c - b)) return a; - else if ((b - a) > (b - c)) - return b; + else if ((b - a) > (c - b)) + return c; else return (a & 1) ? c : a; case 1: /*Down*/ @@ -2284,10 +2284,10 @@ static int64_t x87_fround64(double b) case 0: /*Nearest*/ a = (int64_t)floor(b); c = (int64_t)floor(b + 1.0); - if ((b - a) < (b - c)) + if ((b - a) < (c - b)) return a; - else if ((b - a) > (b - c)) - return b; + else if ((b - a) > (c - b)) + return c; else return (a & 1) ? c : a; case 1: /*Down*/ diff --git a/src/x87_ops.h b/src/x87_ops.h index 1cd4e8c..ef68423 100644 --- a/src/x87_ops.h +++ b/src/x87_ops.h @@ -73,10 +73,10 @@ static inline int64_t x87_fround(double b) case 0: /*Nearest*/ a = (int64_t)floor(b); c = (int64_t)floor(b + 1.0); - if ((b - a) < (b - c)) + if ((b - a) < (c - b)) return a; - else if ((b - a) > (b - c)) - return b; + else if ((b - a) > (c - b)) + return c; else return (a & 1) ? c : a; case 1: /*Down*/