mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +00:00
UserspaceEmulator: Always set C1 when rounding
This commit is contained in:
parent
7214b08f81
commit
fa02b46295
Notes:
sideshowbarker
2024-07-18 01:26:05 +09:00
Author: https://github.com/Hendiadyoin1
Commit: fa02b46295
Pull-request: https://github.com/SerenityOS/serenity/pull/8946
Reviewed-by: https://github.com/Dexesttp
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/kleinesfilmroellchen ✅
1 changed files with 6 additions and 13 deletions
|
@ -197,13 +197,12 @@ template<Arithmetic T>
|
|||
ALWAYS_INLINE T SoftFPU::fpu_round_checked(long double value)
|
||||
{
|
||||
T result = fpu_round<T>(value);
|
||||
if (auto rnd = value - result) {
|
||||
if (rnd > 0)
|
||||
set_c1(1);
|
||||
else
|
||||
set_c1(0);
|
||||
if (result != value)
|
||||
fpu_set_exception(FPU_Exception::Precision);
|
||||
}
|
||||
if (result > value)
|
||||
set_c1(1);
|
||||
else
|
||||
set_c1(0);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -791,13 +790,7 @@ void SoftFPU::FCHS(const X86::Instruction&)
|
|||
|
||||
void SoftFPU::FRNDINT(const X86::Instruction&)
|
||||
{
|
||||
auto res = fpu_round<long double>(fpu_get(0));
|
||||
if (auto rnd = (res - fpu_get(0))) {
|
||||
if (rnd > 0)
|
||||
set_c1(1);
|
||||
else
|
||||
set_c1(0);
|
||||
}
|
||||
auto res = fpu_round_checked<long double>(fpu_get(0));
|
||||
fpu_set(0, res);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue