summaryrefslogtreecommitdiff
path: root/AK
AgeCommit message (Collapse)Author
2022-03-21AK: Add a case insensitive of is_one_of to String[View]Hendiadyoin1
2022-03-19AK: Fix typo in warnln_if()Sam Atkins
2022-03-18AK+Tests: Fix StringUtils::contains() being confused by repeating textSam Atkins
Previously, case-insensitively searching the haystack "Go Go Back" for the needle "Go Back" would return false: 1. Match the first three characters. "Go ". 2. Notice that 'G' and 'B' don't match. 3. Skip ahead 3 characters, plus 1 for the outer for-loop. 4. Now, the haystack is effectively "o Back", so the match fails. Reducing the skip by 1 fixes this issue. I'm not 100% convinced this fixes all cases, but I haven't been able to find any cases where it doesn't work now. :^)
2022-03-18Everywhere: Deduplicate day/month name constantsLenny Maiorani
Day and month name constants are defined in numerous places. This pulls them together into a single place and eliminates the duplication. It also ensures they are `constexpr`.
2022-03-18AK: Mark the StringView user-defined literal as constevalTimothy Flynn
Even though the StringView(char*, size_t) constructor only runs its overflow check when evaluated in a runtime context, the code generated here could prevent the compiler from optimizing invocations from the StringView user-defined literal (verified on Compiler Explorer). This changes the user-defined literal declaration to be consteval to ensure it is evaluated at compile time.
2022-03-18AK: Add const variant of Vector::in_reverse()Andreas Kling
2022-03-17Everywhere: Switch from EnableIf to requiresLenny Maiorani
C++20 provides the `requires` clause which simplifies the ability to limit overload resolution. Prefer it over `EnableIf` With all uses of `EnableIf` being removed, also remove the implementation so future devs are not tempted.
2022-03-18AK: Add constant time equality and zero check to UFixedBigIntMichiel Visser
2022-03-18AK: UFixedBigInt add efficient multiplication with full resultMichiel Visser
2022-03-16AK: Fix implicit and narrowing conversions in Base64Lenny Maiorani
2022-03-16AK: Make static constexpr variables to avoid stack copy in Base64Lenny Maiorani
Alphabet and lookup table are created and copied to the stack on each call. Create them and store them in static memory.
2022-03-15AK+Kernel: Avoid double memory clearing of HashTable bucketsDaniel Bertalan
Since the allocated memory is going to be zeroed immediately anyway, let's avoid redundantly scrubbing it with MALLOC_SCRUB_BYTE just before that. The latest versions of gcc and Clang can automatically do this malloc + memset -> calloc optimization, but I've seen a couple of places where it failed to be done. This commit also adds a naive kcalloc function to the kernel that doesn't (yet) eliminate the redundancy like the userland does.
2022-03-15AK+Everywhere: Add sincos and use it in some placesHendiadyoin1
Calculating sin and cos at once is quite a bit cheaper than calculating them individually. x87 has even a dedicated instruction for it: `fsincos`.
2022-03-14AK: Allow creating a Vector from any Span of the same underlying typeTimothy Flynn
This allows, for example, to create a Vector from a subset of another Vector.
2022-03-13AK: Add naive implementations of AK::timing_safe_compareBrian Gianforcaro
For security critical code we need to have some way of performing constant time buffer comparisons.
2022-03-12AK: Properly parse unimplemented format length specifiersTim Schumacher
This keeps us from stopping early and not rendering the argument at all.
2022-03-10AK: Remove unused String[256] from JsonParserSam Atkins
This shrinks the JsonParser class from 2072 bytes to 24. :^)
2022-03-09AK: Print a better error message when missing a SourceGenerator keySam Atkins
Previously, if you forgot to set a key on a SourceGenerator, you would get this less-than-helpful error message: > Generate_CSS_MediaFeatureID_cpp: /home/sam/serenity/Meta/Lagom/../../AK/Optional.h:174: T AK::Optional<T>::release_value() [with T = AK::String]: Assertion `m_has_value' failed. Now, it instead looks like this: > No key named `name:titlecase` set on SourceGenerator Generate_CSS_MediaFeatureID_cpp: /home/sam/serenity/Meta/Lagom/../../AK/SourceGenerator.h:44: AK::String AK::SourceGenerator::get(AK::StringView) const: Assertion `false' failed.
2022-03-09AK: Add reverse iterator as memberFederico Guerinoni
2022-03-09AK: Implement wrapper for reverse range for loopFederico Guerinoni
Now it is possible to use range for loop in reverse mode for a container. ``` for (auto item : in_reverse(vector)) ```
2022-03-09AK: Implement ReverseIterator for NonnullPtrVectorFederico Guerinoni
2022-03-09AK: Implement reverse iterator for Vector classFederico Guerinoni
2022-03-09AK: Add generic reverse iterator for containersFederico Guerinoni
2022-03-08AK: Add IPv6Address classTom
This is the IPv6 counter part to the IPv4Address class and implements parsing strings into a in6_addr and formatting one as a string. It supports the address compression scheme as well as IPv4 mapped addresses.
2022-03-08AK: Add float support for JsonValue and JsonObjectSerializerVrins
2022-03-08AK: Add to_double() to JsonValueVrins
2022-03-07AK: Automatically shrink HashTable when removing entriesAndreas Kling
If the utilization of a HashTable (size vs capacity) goes below 20%, we'll now shrink the table down to capacity = (size * 2). This fixes an issue where tables would grow infinitely when inserting and removing keys repeatedly. Basically, we would accumulate deleted buckets with nothing reclaiming them, and eventually deciding that we needed to grow the table (because we grow if used+deleted > limit!) I found this because HashTable iteration was taking a suspicious amount of time in Core::EventLoop::get_next_timer_expiration(). Turns out the timer table kept growing in capacity over time. That made iteration slower and slower since HashTable iterators visit every bucket.
2022-03-07AK: Remove return value from HashTable::remove() and HashMap::remove()Andreas Kling
This was only used by remove_all_matching(), where it's no longer used.
2022-03-07AK: Simplify HashTable::remove_all_matching()Andreas Kling
Just walk the table from start to finish, deleting buckets as we go. This removes the need for remove() to return an iterator, which is preventing me from implementing hash table auto-shrinking.
2022-03-04LibWeb: Hide some debug logging behind CANVAS_RENDERING_CONTEXT_2D_DEBUGLinus Groh
This can be quite noisy and isn't generally useful information.
2022-03-02AK: Print NaN and infinite numbers in PrintfImplementationPeter Ross
2022-02-28AK: Add Time::from_ticks()Lucas CHOLLET
This helper allows Time to be constructed from a tick count and a ticks per second value.
2022-02-28AK: Correctly process precision modifiers in printfTimur Sultanov
2022-02-28AK: Add FixedPoint base 2 logarithmkleines Filmröllchen
The log base 2 is implemented using the binary logarithm algorithm by Clay Turner (see the link in the comment)
2022-02-28AK: Add bit shift to FixedPointkleines Filmröllchen
2022-02-28AK: Fix FixedPoint to integral comparisonskleines Filmröllchen
Add tests to ensure that the fixed point numbers compare correctly to integrals
2022-02-27Everywhere: Make JSON serialization fallibleIdan Horowitz
This allows us to eliminate a major source of infallible allocation in the Kernel, as well as lay down the groundwork for OOM fallibility in userland.
2022-02-27AK: Add a try variant of StringBuilder::append_escaped_for_jsonIdan Horowitz
This will allow us to make a fallible version of the JSON serializers.
2022-02-27AK: Skip over initial empty chunks in DisjointChunkskleines Filmröllchen
This will be caught by new test cases: when the initial chunk is empty, a dereference before calling operator++ on the iterator will crash as the initial chunk's size is never checked.
2022-02-27AK: Make DisjointChunks support FixedArraykleines Filmröllchen
This extracts the shatter_chunk logic, because it needs to be different for FixedArray.
2022-02-27AK: Make DisjointChunk::append move the new chunkkleines Filmröllchen
Previously, although we were taking a moved chunk, we still copied it into our chunk list. This makes DisjointChunk compatible with containers that don't have a copy constructor but a move constructor.
2022-02-27AK: Export DisjointSpans into the global namespacekleines Filmröllchen
I think we just forgot when we added it.
2022-02-27AK: Add at() indexing methods to FixedArraykleines Filmröllchen
2022-02-27AK: Allow creating a FixedArray from an initializer listkleines Filmröllchen
2022-02-27AK: Add FixedArray::is_empty()kleines Filmröllchen
This also exists on Vector, and although it's less needed here, it's perfectly reasonable to have.
2022-02-26AK: Add constructor to create Span from ArrayArne Elster
It's a convenience constructor. But it also seems more consistent to allow a Span being made from both raw and managed arrays.
2022-02-26AK: Array can tell its inner typeArne Elster
Array should be able to tell the type of the elements it contains.
2022-02-25AK: Ignore whitespace while decoding base64Andreas Kling
This matches how other implementations behave. 1% progression on ACID3. :^)
2022-02-25AK: Add String::split_view(Function<bool(char)>)Andreas Kling
This allows you to split around a custom separator, and enables expressive code like this: string.split_view(is_ascii_space);
2022-02-23AK: Add forward declaration for Utf8CodePointIteratorLinus Groh