Kernel/userspace: rework floating point math

SSE is now unconditionally enabled any where and most of math.h is now
actually implemented. using __builtin_<func> lead to many hangs where
the builtin function would just call itself.
This commit is contained in:
2024-11-03 20:25:35 +02:00
parent ed19bb11fe
commit f4be37700f
18 changed files with 827 additions and 210 deletions

View File

@@ -6,7 +6,6 @@
#include <LibImage/PNG.h>
#include <fcntl.h>
#include <math.h>
#include <sys/mman.h>
namespace LibImage
@@ -132,13 +131,8 @@ namespace LibImage
{
const double src_x = x * ratio_x;
const double src_y = y * ratio_y;
#if __enable_sse
const double weight_x = src_x - floor(src_x);
const double weight_y = src_y - floor(src_y);
#else
const double weight_x = src_x - (uint64_t)src_x;
const double weight_y = src_y - (uint64_t)src_y;
#endif
const double weight_x = src_x - BAN::Math::floor(src_x);
const double weight_y = src_y - BAN::Math::floor(src_y);
const Color avg_t = Color::average(
get_clamped_color(src_x + 0.0, src_y),
@@ -177,13 +171,8 @@ namespace LibImage
{
const double src_x = x * ratio_x;
const double src_y = y * ratio_y;
#if __enable_sse
const double weight_x = src_x - floor(src_x);
const double weight_y = src_y - floor(src_y);
#else
const double weight_x = src_x - (uint64_t)src_x;
const double weight_y = src_y - (uint64_t)src_y;
#endif
const double weight_x = src_x - BAN::Math::floor(src_x);
const double weight_y = src_y - BAN::Math::floor(src_y);
FloatingColor values[4];
for (int64_t m = -1; m <= 2; m++)