ladybird/Userland/Demos/Eyes
Daniel Bertalan c6fafd3e90 AK+Userland: Add generic AK::abs() function and use it
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.
2021-07-08 10:11:00 +02:00
..
CMakeLists.txt Everywhere: Add component declarations 2021-06-17 11:03:51 +02:00
EyesWidget.cpp AK+Userland: Add generic AK::abs() function and use it 2021-07-08 10:11:00 +02:00
EyesWidget.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
main.cpp Userland: Tighten a *lot* of pledges! :^) 2021-05-13 23:28:40 +02:00