ladybird/Userland/Libraries/LibJS
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
..
Bytecode LibJS: Remove the non-standard put helper and replace it's usages 2021-07-06 14:20:30 +01:00
Heap LibJS: Drop "Record" suffix from all the *Environment record classes 2021-07-01 12:28:57 +02:00
Runtime AK+Userland: Add generic AK::abs() function and use it 2021-07-08 10:11:00 +02:00
Tests LibJS: Implement RegExp.prototype [ @@search ] 2021-07-08 00:01:20 +01:00
AST.cpp LibJS: Make FunctionExpression more spec-compliant 2021-07-07 23:31:51 +01:00
AST.h LibJS: Make FunctionExpression more spec-compliant 2021-07-07 23:31:51 +01:00
CMakeLists.txt LibJS: Remove the NativeProperty mechanism from LibJS 2021-07-07 21:47:22 +01:00
Console.cpp LibJS: Rename CallFrame => ExecutionContext 2021-06-24 19:28:00 +02:00
Console.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Forward.h LibJS: Remove the NativeProperty mechanism from LibJS 2021-07-07 21:47:22 +01:00
Interpreter.cpp LibJS: Remove the non-standard put helper and replace it's usages 2021-07-06 14:20:30 +01:00
Interpreter.h LibJS: Drop "Record" suffix from all the *Environment record classes 2021-07-01 12:28:57 +02:00
Lexer.cpp LibJS: Make a slash after a curly close mean not-division 2021-07-02 14:59:03 +02:00
Lexer.h LibJS+LibCrypto: Allow '_' as a numeric literal separator :^) 2021-06-26 16:30:35 +02:00
MarkupGenerator.cpp LibJS: Remove the NativeProperty mechanism from LibJS 2021-07-07 21:47:22 +01:00
MarkupGenerator.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Parser.cpp LibJS: Don't hoist functions under certain circumstances 2021-07-06 22:55:16 +01:00
Parser.h LibJS: Don't hoist functions under certain circumstances 2021-07-06 22:55:16 +01:00
SourceRange.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
SyntaxHighlighter.cpp LibWeb+LibSyntax: Implement nested syntax highlighters 2021-06-07 14:45:49 +04:30
SyntaxHighlighter.h LibWeb+LibSyntax: Implement nested syntax highlighters 2021-06-07 14:45:49 +04:30
Token.cpp LibJS+LibCrypto: Allow '_' as a numeric literal separator :^) 2021-06-26 16:30:35 +02:00
Token.h Everywhere: Use s.unverwerth@serenityos.org :^) 2021-05-29 12:30:08 +01:00