summaryrefslogtreecommitdiff
path: root/AK
AgeCommit message (Collapse)Author
2022-07-06AK: Use an enum instead of a bool for String::replace(all_occurences)DexesTTP
This commit has no behavior changes. In particular, this does not fix any of the wrong uses of the previous default parameter (which used to be 'false', meaning "only replace the first occurence in the string"). It simply replaces the default uses by String::replace(..., ReplaceMode::FirstOnly), leaving them incorrect.
2022-07-05AK: Add an align_down_to power of two helperIdan Horowitz
Matching the similar align_up_to helper
2022-07-04AK: Add header for generic shorthandsFrHun
These are functions that can be expressed with just normal operators, but would be very repetetive.
2022-07-04AK: Add `nodiscard` attribute to Find functionsLenny Maiorani
2022-07-04AK: Add `nodiscard` attribute to BitStream functionsLenny Maiorani
2022-07-04AK: Add `nodiscard` attribute to BitCast functionsLenny Maiorani
2022-07-04AK: Add `nodiscard` attribute to BinarySearch functionsLenny Maiorani
2022-07-04AK: Add `nodiscard` attribute to BinaryHeap functionsLenny Maiorani
2022-07-04AK: Add `nodiscard` attribute to Base64 functionsLenny Maiorani
2022-07-04AK: Add `nodiscard` attribute to AnyOf functionsLenny Maiorani
2022-07-04AK: Add `nodiscard` attribute to AllOf functionsLenny Maiorani
2022-06-30AK: Add AK::ceil(float) and AK::ceil_log2(integer)MacDue
Co-authored-by: Leon Albrecht <leon2002.la@gmail.com>
2022-06-27AK: Perform a resize in ByteBuffer::get_bytes_for_writing()Lucas CHOLLET
ByteBuffer::get_bytes_for_writing() was only ensuring capacity before this patch. The method needs to call resize to register the appended data, otherwise it will be overwritten with next data addition.
2022-06-26AK: Recognize __CLION_IDE__ as well as __CLION_IDE_Ali Mohammad Pur
This used to be `__CLION_IDE_` before, but it seems to have been fixed in the latest EAP.
2022-06-23AK: Add saturating addition and subtraction to Checkedkleines Filmröllchen
2022-06-23AK: Zero previous pointer *after* fixing the insertion list in HashTableHendiadyoin1
2022-06-22AK: Clear the previous and next pointers of deleted HashTable bucketsIdan Horowitz
Usually the values of the previous and next pointers of deleted buckets are never used, as they're not part of the main ordered bucket chain, but if an in-place rehashing is done, which results in the bucket being turned into a free bucket, the stale pointers will remain, at which point any item that is inserted into said free-bucket will have either a stale previous pointer if the HashTable was empty on insertion, or a stale next pointer, resulting in undefined behaviour. This commit also includes a new HashMap test that reproduces this issue
2022-06-18Revert "AK: Add comparison operators to NonnullOwnPtr"Linus Groh
This reverts commit 50c88e5e3a6918f99cfcfb802d111cb22a87645c. The intention was to add them to NonnullRefPtr, not NonnullOwnPtr. That is also what was advertised in the PR, but not actually done in the reverted commit.
2022-06-18AK: Add comparison operators to NonnullOwnPtrAllan Regush
2022-06-15AK+Kernel: Remove RefPtrTraits template param in userspace codeAndreas Kling
Only the kernel actually uses RefPtrTraits, so let's not burden userspace builds with the complexity.
2022-06-15Kernel+AK: Split Weakable.h into userspace and kernel variantsAndreas Kling
Only the kernel expects AK::Weakable to lock its refcount manipulation, so let's not force userspace to pay for that as well.
2022-06-14AK: Add sqrt(2) and sqrt(1/2) constantsHediadyoin1
2022-06-13LibWeb: Add ability to present LibGL framebuffer and add clearingLuke Wilde
2022-06-13AK/ByteBuffer+Everywhere: Handle errors in ByteBuffer::slice()Matthias Zimmerman
2022-06-10AK: Make URL ApplicationXWWWFormUrlencoded encoding closer to specKarol Kosek
It was mostly implemented based on a spec note, that described only allowed characters, but instead of allowing some special characters not to be escaped, we escaped every special character except those 'new in this encode set' disallowed characters from the spec definition.
2022-06-10AK: Append correct number of port characters when serializing a URLKarol Kosek
Instead of formatting a port string, it put bytes from stack, using the port number as a length (so for port 8000 it appended 8000 bytes).
2022-06-10AK: Add SinglyLinkedList::prepend()Tim Schumacher
2022-06-09AK: Add Error::operator==(Error const&)Lucas CHOLLET
2022-05-26AK: Add invert_case() and invert_case(StringView)huttongrabiel
In the given String, invert_case() swaps lowercase characters with uppercase ones and vice versa.
2022-05-21AK: Use static_cast to cast to base typeAli Mohammad Pur
This is an issue on systems that don't have the empty base class optimisation (such as windows), and we normally don't need to care - however static_cast is technically the right thing to use, so let's use that instead. Co-Authored-By: Daniel Bertalan <dani@danielbertalan.dev>
2022-05-12AK+DHCPClient: Fix false positive gcc 12 warningsDaniel Bertalan
The compiler would complain about `__builtin_memcpy` in ByteBuffer::copy writing out of bounds, as it isn't able to deduce the invariant that the inline buffer is only used when the requested size is smaller than the inline capacity. The other change is more bizarre. If the destructor's declaration exists, gcc complains about a `delete` operation causing an out-of-bounds array access. error: array subscript 'DHCPv4Client::__as_base [0]' is partly outside array bounds of 'unsigned char [8]' [-Werror=array-bounds] 14 | ~DHCPv4Client() = default; | ^ This looks like a compiler bug, and I'll report it if I find a suitable reduced reproducer.
2022-05-09AK: Add `clamp(f32x4, float, float)`Jelle Raaijmakers
We are allowed to directly compare `f32x4` with a `float`, so make use of it.
2022-05-08AK+LibGUI: Pass predicate to *_matching() methods by const referenceVitaly Dyachkov
2022-05-08AK: Use AK:: sin and cos on aarch64 buildEWouters
This fixes the lagom build on aarch64, as `__builtin_sincosf` doesn't take double arguments.
2022-05-07AK: Use builtin versions of `llrint{,l,f}`EWouters
This fixes the build on M1 Macs.
2022-05-07AK: Add an SSE2 specific implementation of sqrt(double)Hendiadyoin1
2022-05-07AK: Add a cpp-y, more fine grained version of fenv.h: FPControl.hHendiadyoin1
This allows direct inlining and hides away some assembly and bit-fiddling when manipulating the floating point environment. This only implements the x87/SSE versions, as of now.
2022-05-07AK: Add an helper for quick hardware based roundingHendiadyoin1
This uses the `fistp` and `cvts[sd]2si` respectively, to potentially round floating point values with just one instruction. This falls back to `llrint[fl]?` on aarch64 for now.
2022-04-27AK: Put invalid UTF8 debug spam behind a flagkleines Filmröllchen
This is very annoying if we're (intentionally) passing invalid UTF8 into Utf8View.
2022-04-23AK: Make sure we don't include Math.h or math.h from KERNELAndrew Kaster
2022-04-21LibCore: Introduce SharedSingleProducerCircularQueuekleines Filmröllchen
This new class with an admittedly long OOP-y name provides a circular queue in shared memory. The queue is a lock-free synchronous queue implemented with atomics, and its implementation is significantly simplified by only accounting for one producer (and multiple consumers). It is intended to be used as a producer-consumer communication datastructure across processes. The original motivation behind this class is efficient short-period transfer of audio data in userspace. This class includes formal proofs of several correctness properties of the main queue operations `enqueue` and `dequeue`. These proofs are not 100% complete in their existing form as the invariants they depend on are "handwaved". This seems fine to me right now, as any proof is better than no proof :^). Anyways, the proofs should build confidence that the implemented algorithms, which are only roughly based on existing work, operate correctly in even the worst-case concurrency scenarios.
2022-04-21AK: Allow alignment to cache line size with CACHE_ALIGNEDkleines Filmröllchen
This is particularly important to avoid false sharing, which thrashes performance when two process-shared atomics are on the same cache line.
2022-04-21AK: Expose RedBlackTree::find_smallest_not_below()Tim Schumacher
2022-04-21AK: Make `Vector::contains_slow` templatedForLoveOfCats
This allows for calling this function with any argument type for which the appropriate traits and operators have been implemented so it can be compared to the Vector's item type
2022-04-21AK: Add `URL::create_with_help_scheme` helper functionForLoveOfCats
2022-04-20AK: Add FuzzyMatch headerfaxe1008
This patch adds a header containing the fuzzy match algorithm previously used in Assistant. The algorithm was moved to AK since there are many places where a search may benefit from fuzzyness.
2022-04-20AK: Explicitly instantiate String::to_uint<unsigned long{, long}>()Ali Mohammad Pur
Instead of just to_uint<u64>().
2022-04-20AK: Add a OneOfIgnoringCV conceptAli Mohammad Pur
Some functions want to ignore cv-qualifiers, and it's much easier to constrain the type through a concept than a separate requires clause on the function.
2022-04-17AK: Add Kernel namespace to KStrings in AK::IPv6AddressThitat Auareesuksakul
Currently there is no AK::IPv6Address in the kernel. But when there is, KStrings won't resolve properly because they are in Kernel namespace.
2022-04-14AK: Differ between long and long long formatsTim Schumacher