fp/info: Incorrect point_position in FPValue
This commit is contained in:
parent
8a3b6364c2
commit
e60d6c0d20
3 changed files with 17 additions and 1 deletions
|
@ -68,7 +68,7 @@ constexpr FPT FPValue() {
|
||||||
return FPInfo<FPT>::Zero(sign);
|
return FPInfo<FPT>::Zero(sign);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr int point_position = static_cast<int>(FPInfo<FPT>::mantissa_width);
|
constexpr int point_position = static_cast<int>(FPInfo<FPT>::explicit_mantissa_width);
|
||||||
constexpr int highest_bit = Common::HighestSetBit(value);
|
constexpr int highest_bit = Common::HighestSetBit(value);
|
||||||
constexpr int offset = point_position - highest_bit;
|
constexpr int offset = point_position - highest_bit;
|
||||||
constexpr int normalized_exponent = exponent - offset + point_position;
|
constexpr int normalized_exponent = exponent - offset + point_position;
|
||||||
|
|
|
@ -29,6 +29,7 @@ add_executable(dynarmic_tests
|
||||||
A64/testenv.h
|
A64/testenv.h
|
||||||
cpu_info.cpp
|
cpu_info.cpp
|
||||||
fp/FPToFixed.cpp
|
fp/FPToFixed.cpp
|
||||||
|
fp/FPValue.cpp
|
||||||
fp/mantissa_util_tests.cpp
|
fp/mantissa_util_tests.cpp
|
||||||
fp/unpacked_tests.cpp
|
fp/unpacked_tests.cpp
|
||||||
main.cpp
|
main.cpp
|
||||||
|
|
15
tests/fp/FPValue.cpp
Normal file
15
tests/fp/FPValue.cpp
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
/* This file is part of the dynarmic project.
|
||||||
|
* Copyright (c) 2018 MerryMage
|
||||||
|
* This software may be used and distributed according to the terms of the GNU
|
||||||
|
* General Public License version 2 or any later version.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "common/fp/info.h"
|
||||||
|
|
||||||
|
using namespace Dynarmic::FP;
|
||||||
|
|
||||||
|
static_assert(FPValue<u32, false, 0, 1>() == 0x3f800000);
|
||||||
|
static_assert(FPValue<u32, false, -1, 3>() == 0x3fc00000);
|
||||||
|
static_assert(FPValue<u32, false, 0, 12739812>() == 0x4b4264e4);
|
||||||
|
static_assert(FPValue<u32, false, -8, 100>() == 0x3ec80000);
|
||||||
|
static_assert(FPValue<u32, true, 0, 1>() == 0xbf800000);
|
Loading…
Reference in a new issue