summaryrefslogtreecommitdiff
path: root/AK
AgeCommit message (Collapse)Author
2021-07-27AK: Add copy_to span method for AK::MACAddressBrian Gianforcaro
2021-07-25AK: Create MACAddress from stringbrapru
Previously there was no way to create a MACAddress by passing a direct address as a string. This will allow programs like the arp utility to create a MACAddress instance by user-passed addresses.
2021-07-24AK: Reimplement all_of in terms of find_ifLenny Maiorani
Problem: - Now that a generic free-function form of `find_if` is implemented the code in `all_of` is redundant. Solution: - Follow the "don't repeat yourself" mantra and make the code DRY by implementing `all_of` in terms of `find_if`. - One tricky part is that since captures are not permitted in `constexpr` lambdas, the lambda created to negate the predicate needs to be created by a function which does not capture and takes the predicate at run-time instead. This allows `all_of` to continue to work in a `constexpr` context.
2021-07-23AK+LibRegex: Partially implement case insensitive UTF-16 comparisonTimothy Flynn
This will work for ASCII code points. Unicode case folding will be needed for non-ASCII.
2021-07-23AK: Add UTF-16 helper methods required for use within LibRegexTimothy Flynn
To be used as a RegexStringView variant, Utf16View must provide a couple more helper methods. It must also not default its assignment operators, because that implicitly deletes move/copy constructors.
2021-07-22CrashDaemon: Remove BACKTRACE_DEBUG debugging codeAndreas Kling
This thing seems to work fine, no need to hang on to old debug code.
2021-07-22AK: Add char SIMD typesHendiadyoin1
These are used in intrinsics, which do not recognize any signed version of the char type
2021-07-22AK: Rewrite {AnyOf,AllOf,Find}.h to use the IteratorPairWith conceptAli Mohammad Pur
This makes it so these algorithms are usable with arbitrary iterators, as opposed to just instances of AK::SimpleIterator. This commit also makes the requirement of ::index() in find_index() explicit, as previously it was accepting any iterator.
2021-07-22AK: Convert AnyOf/AllOf to east-const styleAli Mohammad Pur
2021-07-22AK: Implement {any,all}_of(IterableContainer&&, Predicate)Ali Mohammad Pur
This is a generally nicer-to-use version of the existing {any,all}_of() that doesn't require the user to explicitly provide two iterators. As a bonus, it also allows arbitrary iterators (as opposed to the hard requirement of providing SimpleIterators in the iterator version).
2021-07-22AK: Add a concept for iterable containersAli Mohammad Pur
This concept describes a type with a begin()/end() pair that can function as an iterator, given the following criteria: - The return type of begin() is comparable with the return type of end(), and the comparison (with operator!=) yields a bool - The object returned from begin() can be pre-incremented - The iterator has an operator*() implementation
2021-07-22AK: Add a deduction guide to VectorAli Mohammad Pur
Note that this does not generate a vector with inline capacity.
2021-07-22AK: Add a CommonType<Ts...> type traitAli Mohammad Pur
Also adds a simple-ish test for CommonType.
2021-07-22AK: Make TypeBoundsChecker<UnsignedIntegralT, FloatingPointT> workLinus Groh
By replacing MakeUnsigned<Source> in this specific specialization with a simple negativity check this now works for floating point source types. Previously it would attempt a comparison of the destination type and void.
2021-07-22AK: Add Utf16View for decoding UTF-16 stringsTimothy Flynn
Also includes a way to transcode from and to UTF-8 strings.
2021-07-22AK: Disable clang-format for AK/Time.hGunnar Beutner
clang-format >=12 format this file incorrectly/differently.
2021-07-22AK: Add a getter to JsonValue to get machine-native addressesGunnar Beutner
2021-07-21AK: Sprinkle [[nodiscard]] on AK::ArrayAndreas Kling
2021-07-21AK: Convert Array to east-const styleAndreas Kling
2021-07-21AK: Remove unused private HashTable::lookup_for_reading()Andreas Kling
2021-07-21AK: Sprinkle [[nodiscard]] on HashMap and HashTableAndreas Kling
2021-07-21AK: Sprinkle [[nodiscard]] on AK::BitmapAndreas Kling
2021-07-21AK: Remove unused HashMap::remove_one_randomly()Andreas Kling
2021-07-19Everywhere: Use AK/Math.h if applicableHendiadyoin1
AK's version should see better inlining behaviors, than the LibM one. We avoid mixed usage for now though. Also clean up some stale math includes and improper floatingpoint usage.
2021-07-19AK: Introduce Math.hHendiadyoin1
This is to implement constexpr template based implementations for mathematical functions This also changes math.cpp to use these implementations. Also adds a fastpath for floating point trucation for values smaller than the signed 64 bit limit.
2021-07-19AK: Use new Formatter for each element in Formatter<Vector<T>>Andrew Kaster
The state of the formatter for the previous element should be thrown away for each iteration. This showed up when trying to format a Vector<String>, since Formatter<StringView> was unhappy about some state that gets set when it's called. Add a test for Formatter<Vector>.
2021-07-19AK: Use StringView literals in Format to avoid strlenAndrew Kaster
We don't want to be constructing StringViews at runtime if we don't have to in Formatter code.
2021-07-18AK: Add the at()/operator[]() getter to Utf32ViewAli Mohammad Pur
This is trivial, and makes it easier to get the code point compared to the previous `.code_points()[index]` (which was not actually checked for in-bounds length).
2021-07-18AK: Add a is_null() method to Utf{8,32}ViewAli Mohammad Pur
Both of these can be null as well as empty, and there's a difference.
2021-07-18AK: Don't return a null Utf32View when a zero-length one is requestedAli Mohammad Pur
There is still an offset to consider, a zero-length view is very different from a nonexistent string :P Co-authored-by: Timothy Flynn <trflynn89@pm.me>
2021-07-18Kernel: Introduce basic pre-kernel environmentGunnar Beutner
This implements a simple bootloader that is capable of loading ELF64 kernel images. It does this by using QEMU/GRUB to load the kernel image from disk and pass it to our bootloader as a Multiboot module. The bootloader then parses the ELF image and sets it up appropriately. The kernel's entry point is a C++ function with architecture-native code. Co-authored-by: Liav A <liavalb@gmail.com>
2021-07-18AK: Add helper type for serializing structures into bufferSahan Fernando
2021-07-18AK: Allow setting both width and precision when formatting a stringTimothy Flynn
2021-07-17AK: Track byte length, rather than code point length, in Utf8View::trimTimothy Flynn
Utf8View::trim uses Utf8View::substring_view to return its result, which requires the input to be a byte offset/length rather than code point length.
2021-07-17AK: Restrict timespec comparison operator overloads in AK::TimeBrian Gianforcaro
The previous implementation was too generic, and would cause conflicting operator overload errors when included in certain code paths. Fix this by restricting the template parameters to types which have the same member names as `struct timespec`.
2021-07-17AK: Mark RedBlackTree functions as [[nodiscard]]Brian Gianforcaro
2021-07-17AK: Mark AK::IntrusiveRedBlackTree as finalBrian Gianforcaro
2021-07-17AK: Mark AK::IntrusiveList Non copyable and movableBrian Gianforcaro
2021-07-17AK: Mark RedBlackTree as finalBrian Gianforcaro
2021-07-17AK: Mark RedBlackTree find APIs as [[nodiscard]]Brian Gianforcaro
2021-07-16Kernel+AK: Generate compile-time error for non-sized `delete`Daniel Bertalan
This is a much more ergonomic option than getting a `VERIFY_NOT_REACHED()` failure at run-time. I encountered this issue with Clang, where sized deallocation is not the default due to ABI breakage concerns. Note that we can't simply just not declare these functions, because the C++ standard states: > If this function with size parameter is defined, the program shall > also define the version without the size parameter.
2021-07-16AK+Kernel: Implement and use EnumBits has_any_flag()Timothy
This duplicates the old functionality of has_flag and will return true when any flags present in the mask are also in the value.
2021-07-16AK: Change EnumBits has_flag() to check all flags in mask are presentTimothy
Co-authored-by: Brian Gianforcaro <b.gianfo@gmail.com>
2021-07-15AK: Add workaround for clang-format 12 problems with conceptsDaniel Bertalan
2021-07-15AK: Allow getting the key from a RedBlackTree iteratorAndreas Kling
2021-07-15AK: Make RedBlackTree non-copyable and non-movableAndreas Kling
2021-07-15AK: Make JsonParser correctly parse unsigned values larger than u32Ali Mohammad Pur
Prior to this, it'd try to stuff them into an i64, which could fail and give us nothing. Even though this is an extension we've made to JSON, the parser should be able to correctly round-trip from whatever our serialiser has generated.
2021-07-15AK: Expose RedBlackTree allocation failures via try_insertIdan Horowitz
This should help with using the RedBlackTree in a more OOM-safe way in the kernel.
2021-07-14AK: Add free function to wrap around __atomic_is_lock_free built-inTimothy Flynn
Note: this exact implementation is needed for __atomic_is_lock_free to link with both GCC (for the SerenityOS build) and Clang (for the Fuzzer build). The size argument must be a compile-time constant, otherwise it fails to link with both compilers. Alternatively, the following definition links with GCC but fails with Clang: template<size_t S> static inline bool atomic_is_lock_free(volatile void* ptr = nullptr) { return __atomic_is_lock_free(S, ptr); }
2021-07-14AK: Avoid pagefaults when repeatedly enqueing/dequeing items in a QueueGunnar Beutner
When repeatedly enqueing and dequeing a single item in a Queue we end up faulting in all the pages for the underlying Vector. This is a performance issue - especially where the element type is large.