mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
c6fafd3e90
Previously, in LibGFX's `Point` class, calculated distances were passed to the integer `abs` function, even if the stored type was a float. This caused the value to unexpectedly be truncated. Luckily, this API was not used with floating point types, but that can change in the future, so why not fix it now :^) Since we are in C++, we can use function overloading to make things easy, and to automatically use the right version. This is even better than the LibC/LibM functions, as using a bit of hackery, they are able to be constant-evaluated. They use compiler intrinsics, so they do not depend on external code and the compiler can emit the most optimized code by default. Since we aren't using the C++ standard library's trick of importing everything into the `AK` namespace, this `abs` function cannot be exported to the global namespace, as the names would clash. |
||
---|---|---|
.. | ||
CatDog | ||
Cube | ||
Eyes | ||
Fire | ||
LibGfxDemo | ||
LibGfxScaleDemo | ||
Mandelbrot | ||
Mouse | ||
Screensaver | ||
Starfield | ||
WidgetGallery | ||
CMakeLists.txt |