ladybird/AK
Ben Wiederhake 0944f56181 AK: Fix human_readable_size corner cases
In particular: consistent rounding and extreme values.

Before, rounding was something like 'away from 0.999...', which led to
surprising corner cases in which the value was rounded up.

Now, rounding is always 'down'.
This even works for 0xffffffff, and also for 0xffffffffffffffffULL on 64-bit.
2020-08-23 11:24:55 +02:00
..
Tests AK: Fix human_readable_size corner cases 2020-08-23 11:24:55 +02:00
Assertions.h AK+LibC: Add TODO() as an alternative to ASSERT_NOT_REACHED() 2020-05-30 11:31:49 +02:00
Atomic.h AK: Decorate atomic compare exchange operations with [[nodiscard]] 2020-08-05 17:28:44 +02:00
Badge.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
Base64.cpp AK: Mark compilation-unit-only functions as static 2020-08-12 20:40:59 +02:00
Base64.h AK: Change the signature of AK::encode_base64() to use Span. 2020-07-27 19:58:09 +02:00
BinarySearch.h AK: Fix overflow and mixed-signedness issues in binary_search() (#2961) 2020-08-02 21:10:35 +02:00
Bitmap.h AK: Fix Bitmap not finding unset ranges at the end of the map 2020-05-06 22:28:23 +02:00
BufferStream.h LibDebug: Use InputMemoryStream instead of BufferStream. 2020-08-06 10:33:16 +02:00
ByteBuffer.cpp AK: Prevent confusing silent misuse of ByteBuffer 2020-08-22 17:18:14 +02:00
ByteBuffer.h AK: Prevent confusing silent misuse of ByteBuffer 2020-08-22 17:18:14 +02:00
Checked.h AK: Always inline some Checked methods 2020-05-31 21:38:50 +02:00
CircularDeque.h AK: Add enqueue_begin() for the CircularDeque class (#1320) 2020-03-02 09:50:43 +01:00
CircularQueue.h CircularQueue: Move construct a T object instead of copy constructing it 2020-02-26 15:22:45 +01:00
CMakeLists.txt Meta: Install source files at /usr/src/serenity 2020-08-15 15:06:35 +02:00
Concepts.h AK: Add SFINAE fallback for AK C++ concepts use, for Coverity compiler 2020-08-17 09:17:57 +02:00
Demangle.h Revert "AK: Don't demangle in serenity :(" 2020-05-20 16:24:26 +02:00
DistinctNumeric.h AK: Fix description of DistinctNumeric around operator bool 2020-08-22 17:18:14 +02:00
DoublyLinkedList.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
FixedArray.h AK: Add bytes() method to FixedArray. 2020-08-15 21:21:18 +02:00
FlyString.cpp Revert "Kernel: Move Singleton class to AK" 2020-08-22 16:34:49 +02:00
FlyString.h AK: Tweak String::is_one_of() and FlyString::is_one_of() 2020-07-28 18:55:47 +02:00
Forward.h AK: Add DuplexMemoryStream class. 2020-08-20 16:28:31 +02:00
Function.h Add clang-format file 2019-05-28 17:31:20 +02:00
GenericLexer.cpp LibWeb: Use GenericLexer in WrapperGenerator 2020-08-21 16:01:48 +02:00
GenericLexer.h LibWeb: Use GenericLexer in WrapperGenerator 2020-08-21 16:01:48 +02:00
HashFunctions.h AK: Add global FlatPtr typedef. It's u32 or u64, based on sizeof(void*) 2020-03-08 13:06:51 +01:00
HashMap.h AK: HashTable/HashMap return whether action was performed for set/remove 2020-07-09 21:58:07 +02:00
HashTable.h AK: HashTable add a constructor that allows preallocation of capacity + Use in CppLexer. (#3147) 2020-08-16 11:04:00 +02:00
IDAllocator.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
InlineLinkedList.h AK: Use AK relative include style for InlineLinkedList.h 2020-08-05 12:13:50 +02:00
IntrusiveList.h LibCore: Add a forward declaration header 2020-02-14 23:31:18 +01:00
IPv4Address.h AK: Fix obvious bad vector access in IPv4Address::from_string() 2020-08-14 15:10:58 +02:00
IterationDecision.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
JsonArray.h AK: Simplify JsonObject and JsonArray API a little bit 2020-03-06 08:51:22 +01:00
JsonArraySerializer.h Meta: Claim copyright for files created by me 2020-01-24 15:15:16 +01:00
JsonObject.h AK: Don't keep equal JsonObject keys in the order vector twice 2020-08-10 14:48:45 +02:00
JsonObjectSerializer.h AK: Make JsonValue and JsonObjectSerializer speak int/long/long long 2020-05-22 13:57:23 +02:00
JsonParser.cpp AK: Add a GenericLexer and extend the JsonParser with it (#2696) 2020-08-09 11:34:26 +02:00
JsonParser.h AK: Add a GenericLexer and extend the JsonParser with it (#2696) 2020-08-09 11:34:26 +02:00
JsonPath.cpp Inspector: Expand and show properties in a TreeView 2020-07-01 11:18:19 +02:00
JsonPath.h Inspector: Expand and show properties in a TreeView 2020-07-01 11:18:19 +02:00
JsonValue.cpp AK: Fix JsonValue copy constructor behavior for 64-bit values 2020-07-06 18:38:08 +02:00
JsonValue.h AK: JsonParser improvements 2020-06-13 12:43:22 +02:00
kmalloc.h Revert "AK: Let the compiler provide the default new and delete operators" 2020-08-04 21:16:07 +02:00
kstdio.h AK+Kernel: Support snprintf 2020-08-22 20:55:10 +02:00
LexicalPath.cpp LexicalPath: Simplify a loop 2020-07-15 20:16:38 +02:00
LexicalPath.h AK: Rename FileSystemPath -> LexicalPath 2020-05-26 14:35:10 +02:00
LogStream.cpp AK: Prefer snprintf over sprintf 2020-08-22 20:55:10 +02:00
LogStream.h AK: Serialize entire log statements 2020-07-03 19:32:34 +02:00
MACAddress.h Kernel+AK: Separate out MACAddress and move it into AK 2020-04-05 09:50:48 +02:00
MappedFile.cpp AK: Make MappedFile store why it is invalid 2020-08-01 08:39:26 +02:00
MappedFile.h AK: Make MappedFile store why it is invalid 2020-08-01 08:39:26 +02:00
MemMem.h AK+LibC+Kernel: Move the implementation of memmem to AK 2020-08-21 16:00:42 +02:00
Memory.h AK+LibC: Always use REP MOVSB/STOSB for memcpy()/memset() 2020-07-27 15:54:39 +02:00
NetworkOrdered.h AK: Use endianness flags to determine if conversion is necessary 2020-02-19 16:08:28 +01:00
NeverDestroyed.h AK: Fixed a typo in NeverDestroyed.h (#1228) 2020-02-16 09:32:18 +01:00
Noncopyable.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
NonnullOwnPtr.h AK: Decorate AK::NonnullOwnPtr::leak_ptr() with [[nodiscard]] 2020-08-05 16:12:00 +02:00
NonnullOwnPtrVector.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
NonnullPtrVector.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
NonnullRefPtr.h AK+Kernel: Help the compiler inline a bunch of trivial methods 2020-05-20 14:11:13 +02:00
NonnullRefPtrVector.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
NumberFormat.h AK: Fix human_readable_size corner cases 2020-08-23 11:24:55 +02:00
NumericLimits.h AK: Use "signed char" as the opposite of "unsigned char" 2020-07-18 17:57:40 +02:00
Optional.h AK: Add operator== to AK::Optional 2020-08-23 01:05:22 +02:00
OwnPtr.h AK: Decorate AK::OwnPtr::leak_ptr() with [[nodiscard]] 2020-08-05 16:12:00 +02:00
Platform.h AK: Remove experimental clang -Wconsumed stuff 2020-05-16 10:55:54 +02:00
PrintfImplementation.h AK: Fix print_double 2020-07-25 12:32:55 +02:00
Queue.h AK: Make Queue use size_t for its size 2020-02-25 14:55:04 +01:00
QuickSort.h AK: Dual pivot quicksort implementation (#1838) 2020-04-18 13:58:49 +02:00
Random.h Lagom: Adjust AK, LibCore and LibTLS to build on MacOS 2020-05-30 00:36:13 +02:00
RefCounted.h AK: Ensure RefCounted types are never copied or moved 2020-06-12 16:08:45 +02:00
RefPtr.h AK+Kernel: Help the compiler inline a bunch of trivial methods 2020-05-20 14:11:13 +02:00
Result.h AK: Decorate AK::Result<V, E> with [[nodiscard]] 2020-08-05 17:29:44 +02:00
ScopedValueRollback.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
ScopeGuard.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
SharedBuffer.cpp Lagom: Add LibGemini, LibGfx 2020-07-23 23:02:28 +02:00
SharedBuffer.h Lagom: Add LibGemini, LibGfx 2020-07-23 23:02:28 +02:00
SinglyLinkedList.h AK: Add SinglyLinkedListIterator::is_begin() 2020-04-27 11:24:21 +02:00
SinglyLinkedListWithCount.h AK: Add SinglyLinkedListWithCount<T>, a singulary linked list with count 2020-08-05 09:34:22 +02:00
Span.h AK: Span: Fix signature of copy_to() and copy_trimmed_to(). 2020-08-20 16:28:31 +02:00
StdLibExtras.h AK: Print RHS and LHS in EXPECT_EQ if we can 2020-08-23 11:24:55 +02:00
Stream.h AK: Add Stream::offset_of(ReadonlyBytes) 2020-08-21 16:00:42 +02:00
String.cpp AK: Prefer snprintf over sprintf 2020-08-22 20:55:10 +02:00
String.h AK: Add InputStream abstraction and InputMemoryStream implementation. 2020-08-06 10:33:16 +02:00
StringBuilder.cpp Unicode: Try s/codepoint/code_point/g again 2020-08-05 22:33:42 +02:00
StringBuilder.h Unicode: Try s/codepoint/code_point/g again 2020-08-05 22:33:42 +02:00
StringImpl.cpp AK: Add String constructor from ReadonlyBytes. 2020-08-06 10:33:16 +02:00
StringImpl.h AK: Add String constructor from ReadonlyBytes. 2020-08-06 10:33:16 +02:00
StringUtils.cpp AK: Add case insensitive version of starts_with 2020-07-21 01:08:32 +02:00
StringUtils.h AK: Add case insensitive version of starts_with 2020-07-21 01:08:32 +02:00
StringView.cpp AK: Add StringView::contains(StringView) 2020-08-01 08:39:26 +02:00
StringView.h AK: Add StringView(ReadonlyBytes) constructor. 2020-08-20 16:28:31 +02:00
TemporaryChange.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
TestSuite.h AK: Print RHS and LHS in EXPECT_EQ if we can 2020-08-23 11:24:55 +02:00
Time.h AK: Add more time convenience functions and comparison operators 2020-08-03 18:23:00 +02:00
Traits.h AK: Add HashMap, HashTable and Traits to Forward.h 2020-02-16 02:01:18 +01:00
TypeCasts.h AK: Add global is<T>() and downcast<T>() 2020-07-26 17:51:00 +02:00
Types.h AK: Rename KB, MB, GB to KiB, MiB, GiB 2020-08-16 16:33:28 +02:00
URL.cpp AK: Make string-to-number conversion helpers return Optional 2020-06-12 21:28:55 +02:00
URL.h AK: Add operator== and hash traits for URL 2020-06-01 21:50:07 +02:00
URLParser.cpp AK: Make string-to-number conversion helpers return Optional 2020-06-12 21:28:55 +02:00
URLParser.h AK: Add basic percent encoder/decoder (urlencode and urldecode) 2020-06-07 21:05:05 +02:00
Userspace.h AK: Prevent confusing silent misuse of Userspace<T> 2020-08-22 17:18:14 +02:00
Utf8View.cpp Unicode: Try s/codepoint/code_point/g again 2020-08-05 22:33:42 +02:00
Utf8View.h Unicode: Try s/codepoint/code_point/g again 2020-08-05 22:33:42 +02:00
Utf32View.h Unicode: Try s/codepoint/code_point/g again 2020-08-05 22:33:42 +02:00
Vector.h AK: Rename span() to bytes() when appropriate. 2020-08-15 21:21:18 +02:00
Weakable.h AK: Add Weakable::revoke_weak_ptrs() 2020-07-04 16:23:52 +02:00
WeakPtr.h AK: Assert if trying to create a WeakPtr to an object being destroyed 2020-01-25 10:34:32 +01:00