1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:58:11 +00:00
serenity/Userland/Libraries
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
..
LibArchive LibArchive: Move method implementations away from header 2021-05-17 18:14:05 +01:00
LibAudio LibAudio: Add ClientConnection::async_enqueue() 2021-07-05 19:33:55 +02:00
LibC LibC+LibPthread: Use FUTEX_PRIVATE_FLAG in more places 2021-07-07 17:08:40 +02:00
LibCards LibCards: Support non-alternating colour patience games 2021-06-24 10:32:53 +02:00
LibChess LibChess: Compact the Defenitions of various chess related types 2021-06-22 23:09:42 +02:00
LibCompress LibCompress: Discard GZip NAME & COMMENT optional strings 2021-05-18 08:09:21 +02:00
LibCore LibCore: Remove overly informal language in ArgsParser error message 2021-07-08 01:17:06 +02:00
LibCoreDump LibCoreDump: Change Backtrace debug info cache to member variable 2021-06-30 15:15:15 +02:00
LibCpp LibCpp: Add Parser::tokens_in_range(start, end) 2021-07-04 17:50:33 +02:00
LibCrypt Everywhere: Add a blank line after copyright header where missing 2021-05-15 00:27:09 +01:00
LibCrypto LibCrypto: Add missing implementation of SBI::multiplied_by(USBI) 2021-07-08 01:25:49 +01:00
LibDebug Everywhere: Remove unused local variables and lambda captures 2021-07-08 10:11:00 +02:00
LibDesktop LibDesktop: Add spawn() to AppFiles 2021-06-28 16:29:02 +02:00
LibDiff AK+Everywhere: Consolidate String::index_of() and String::find() 2021-05-24 11:59:18 +02:00
LibDl Toolchain+Userland: Enable TLS for x86_64 2021-07-04 01:07:28 +02:00
LibELF LibELF: Fix syscall regions for .text segments with a non-zero offset 2021-07-07 22:26:53 +02:00
LibGemini AK: Implement String::find_any_of() and StringView::find_any_of() 2021-07-02 21:54:21 +02:00
LibGfx AK+Userland: Add generic AK::abs() function and use it 2021-07-08 10:11:00 +02:00
LibGL LibGL: Implement very basic version of glGetFloatv 2021-06-09 10:49:38 +02:00
LibGUI LibGUI: Don't repaint disabled scrollbars when mousing over them 2021-07-07 23:57:21 +02:00
LibHTTP LibHTTP: Finish the request up on TLS connection finish 2021-06-30 01:23:25 +04:30
LibImageDecoderClient Userland: Remove dummy IPC methods 2021-06-24 00:38:58 +02:00
LibIMAP LibIMAP: Support for remaining IMAP commands 2021-06-11 23:58:28 +04:30
LibIPC AK+LibIPC: Make all enums codable 2021-07-04 13:48:20 +04:30
LibJS AK+Userland: Add generic AK::abs() function and use it 2021-07-08 10:11:00 +02:00
LibKeyboard LibKeyboard: Remove an unnecessary #include when building with KERNEL 2021-06-30 11:30:28 +02:00
LibLine AK: Implement String::find_any_of() and StringView::find_any_of() 2021-07-02 21:54:21 +02:00
LibM LibM: Use assembly for all atan versions 2021-07-06 00:16:45 +02:00
LibMarkdown LibMarkdown: Wrap non-inline code blocks in <pre> 2021-06-09 18:06:54 +01:00
LibPCIDB Everywhere: "file name" => "filename" 2021-04-29 22:16:18 +02:00
LibPDF LibPDF: Convert to east-const to comply with the recent style changes 2021-06-12 22:45:01 +04:30
LibProtocol LibProtocol: Use URL class in RequestClient::start_request argument 2021-06-06 16:00:11 +02:00
LibPthread LibC+LibPthread: Use FUTEX_PRIVATE_FLAG in more places 2021-07-07 17:08:40 +02:00
LibRegex LibRegex: Allow dollar signs in ECMA262 named capture groups 2021-07-06 22:33:17 +01:00
LibSanitizer LibSantizer: Read $UBSAN_OPTIONS to set deadliness on first print 2021-06-29 07:17:34 +04:30
LibSQL LibSQL: Make lexer and parser more standard SQL compliant 2021-06-24 00:36:53 +02:00
LibSymbolication LibSymbolication: Fix incorrect argument type for symbolicate() 2021-06-24 09:27:13 +02:00
LibSyntax LibWeb+LibSyntax: Implement nested syntax highlighters 2021-06-07 14:45:49 +04:30
LibSystem Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
LibTest LibTest: Clear core dump flag for CrashTest child processes 2021-07-06 17:22:45 +02:00
LibTextCodec LibTextCodec: Add Turkish (aka ISO-8859-9, Windows-1254) encoding 2021-06-23 16:32:47 +01:00
LibThreading LibThreading: Use a condvar to signal the BackgroundAction thread 2021-07-07 18:02:43 +02:00
LibTLS LibCrypto: Replace from_base{2,8,10,16}() & to_base10 with from_base(N) 2021-06-29 16:55:54 +01:00
LibTTF LibTTF: Memory map TTF fonts instead of reading them into heap memory 2021-07-04 21:34:26 +02:00
LibUSBDB LibUSBDB: Fix vendor id decoding 2021-06-18 19:41:25 +04:30
LibVideo LibVideo: Migrate to east-const style & apply other minor fixes 2021-06-30 11:03:51 +02:00
LibVT AK+Everywhere: Add and use static APIs for LexicalPath 2021-06-30 11:13:54 +02:00
LibWasm LibWasm: Don't create useless temporary strings for trap reasons 2021-07-06 17:55:00 +04:30
LibWeb AK+Userland: Add generic AK::abs() function and use it 2021-07-08 10:11:00 +02:00
LibWebSocket AK+Everywhere: Disallow constructing Functions from incompatible types 2021-06-06 00:27:30 +04:30
LibX86 Debugger: Compile on x86_64 2021-06-30 19:05:51 +02:00
CMakeLists.txt Userland/Libraries: Add LibUSBDB library 2021-06-18 17:04:57 +04:30