From e971c4ded5d36aa3d771f90d182af5e552276b78 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Mon, 25 Mar 2019 22:23:52 -0700 Subject: [PATCH] interp: Correct vfim for -inf and similar. Was dropping the sign bit before for inf and nan. --- Core/MIPS/MIPSVFPUUtils.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Core/MIPS/MIPSVFPUUtils.cpp b/Core/MIPS/MIPSVFPUUtils.cpp index 88acda0744..eba4f88752 100644 --- a/Core/MIPS/MIPSVFPUUtils.cpp +++ b/Core/MIPS/MIPSVFPUUtils.cpp @@ -538,19 +538,17 @@ float Float16ToFloat32(unsigned short l) int exponent = (float16 >> VFPU_SH_FLOAT16_EXP) & VFPU_MASK_FLOAT16_EXP; unsigned int fraction = float16 & VFPU_MASK_FLOAT16_FRAC; - float signf = (sign == 1) ? -1.0f : 1.0f; - float f; if (exponent == VFPU_FLOAT16_EXP_MAX) { - if (fraction == 0) - f = std::numeric_limits::infinity(); //(*info->fprintf_func) (info->stream, "%cInf", signchar); - else - f = std::numeric_limits::quiet_NaN(); //(*info->fprintf_func) (info->stream, "%cNaN", signchar); + float2int.i = sign << 31; + float2int.i |= 255 << 23; + float2int.i |= fraction; + f = float2int.f; } else if (exponent == 0 && fraction == 0) { - f = 0.0f * signf; + f = sign == 1 ? -0.0f : 0.0f; } else {