Commit Graph
367 Commits
Author SHA1 Message Date
Bananymous efb25e5666 BAN/LibC: Move ldexp, scalbn to libc
They are now implemented with float decompostion to modify the exponent
bits directly
2026-07-20 04:07:23 +03:00
Bananymous 2c340c5532 BAN: Implement more numerically stable hypot 2026-07-20 04:07:23 +03:00
Bananymous bcf1c6d110 BAN: Add print formatter for Span 2026-07-07 04:53:41 +03:00
Bananymous 7b4b5a3440 BAN: Cleanup intro_sort and quick_sort
Only recurse to the smaller partition. This prevents worst case O(n)
recursion
2026-07-07 04:43:06 +03:00
Bananymous c295af9bd5 BAN: Fix HashMaps with custom hashes and comparators 2026-05-20 23:10:25 +03:00
Bananymous 212ab010a5 BAN: Expose radix sort with user provided buffer
This can be nice if user has memory for a the temporary buffer and
doesnt want the sorting to allocate or be able to fail.

Also counts are now stack allocated, there isn't really any reason to
allocate them on the heap as 256x 64 bit values only adds up to 2 KiB
2026-05-13 05:05:11 +03:00
Bananymous d181f9e553 BAN: Optimize quick sort
We now use the middle element as the pivot and do three way partitioning
to improve sorting with equivalent elements
2026-05-13 04:31:31 +03:00
Bananymous 77ca525552 BAN: Fix HashSet 2026-05-04 20:26:02 +03:00
Bananymous 0e00b72df6 BAN: Cleanup HashMap
Add a concept for HashMapFindable instead of manually specifying the
requries expression everywhere.

Allow HashMapFindable also for `remove`, `contains`, `operator[]`, `at`

Make Entry have a const Key. This allows iterator's operator* and
operator-> return values have const keys.
2026-04-25 22:10:01 +03:00
Bananymous a63818ec33 BAN: Cleanup HashSet
Add a concept for HashSetFindable instead of manually specifying the
requries expression everywhere.

Allow HashSetFindable also for `remove` and `contains`.

Remove non-const return values from iterator; you should never modify
the hashed value in place.

Don't require key to be move assignable, move construction is enough.
2026-04-25 22:10:01 +03:00
Bananymous b5647ff258 BAN: Rewrite RefPtr,UniqPtr const semantics
const RefPtr<T> now allows accessing T as non-const. Also add default
hash function for RefPtr and UniqPtr based on the pointer value
2026-04-25 22:10:01 +03:00
Bananymous 40f3546aca BAN: Rewrite HashMap as a wrapper around HashSet
There is really no need to have two implementation of the same thing.
Only difference now is that HashMap's value type has to be movable but
this wasn't an issue
2026-04-21 00:18:18 +03:00
Bananymous fe613e4274 BAN: Rewrite HashSet
Instead of representing the map as vector or linked lists which required
an allocation for every insertion and deallocation for removal, we now
store a single big contiguous block of memory and use hash chains to
handle collisions. This intuitively feels much better although I did not
run any benchmarks.
2026-04-21 00:14:24 +03:00
Bananymous 3264dcee44 BAN: Add Math::round_up_to_power_of_two 2026-04-21 00:14:24 +03:00
Bananymous 279ac6b2b6 BAN: Implement some macro utilities
This contains stuff to count arguments, stringify, concatinate, for_each
2026-04-11 03:30:52 +03:00
Bananymous 85f61aded5 BAN: Use builtins for math overflow 2026-04-02 14:49:12 +03:00
Bananymous e9c81477d7 BAN/LibC: Implement remainder
This is basically just fmod but with fprem1 instead of fprem
2026-03-25 01:06:45 +02:00
Bananymous 09292bb87e BAN: Cleanup math code and add SSE sqrt
We should prefer SSE instructions when they are easily available. For
other functions x87 is just simpler. It's hard to write faster and close
to as accurate approximations with SSE.

This does not use xmmintrin.h as clangd does not like that file and
starts throwing errors in every file that includes this :)
2026-03-22 22:07:48 +02:00
Bananymous 07712758a7 BAN: Add default constructor to ipv4address 2026-03-17 20:24:48 +02:00
Bananymous a5cdf0640f BAN: Add value_type to String{,View} 2026-02-23 16:06:48 +02:00
Bananymous 1fc2e43881 BAN: Add support for string format padding 2026-02-23 16:06:48 +02:00
Bananymous 0964c9f928 BAN: Remove unnecessary assert from span 2026-02-23 16:06:48 +02:00
Bananymous 8b1e820869 BAN: Add reallocator support to Vector 2026-02-21 04:03:11 +02:00
Bananymous 9edc6966db BAN: Add reallocator definition
for the moment this does not exist in kernel, kmalloc rewrite soon™️
2026-02-21 04:03:11 +02:00
Bananymous 12207dcb77 BAN: Add is_trivially_copyable trait 2026-02-21 04:03:11 +02:00
Bananymous 8794122c2d BAN: Variant allow copy/move from empty 2026-02-07 18:54:31 +02:00
Bananymous 90deb9fb43 BAN: Make debug output thread safe
Now file lock is only acquired once per message, not once per character
2026-01-09 20:30:35 +02:00
Bananymous fea5d1d82b BAN: Fix wrong include in heap 2026-01-07 22:12:20 +02:00
Bananymous e2ccc3026f BAN: Remove unnecessary c++ header inclusion 2025-12-16 16:44:42 +02:00
Bananymous 37aef630d2 BAN: Fix Array and Vector span constness 2025-10-28 05:50:19 +02:00
Bananymous 9f0addbd8b BAN: Implement simple priority queue
This is just a wrapper around BAN::Vector and heap functions
2025-10-26 00:32:00 +03:00
Bananymous 7f8ea6b8e0 BAN: Move heap functions to Heap.h
This also adds push_heap and pop_heap, similar to what C++ standard
library provides
2025-10-26 00:31:06 +03:00
Bananymous 9d3ea6fed7 BAN: Use new it_value_type_t in sorting functions 2025-10-26 00:30:51 +03:00
Bananymous 703b3eda56 BAN: Add it_value_type_t
This is a template that resolves into T for pointers to T and T::value_type otherwise. It allows using the underlaying type of an iterator or pointer for range based algorithms
2025-10-26 00:22:35 +03:00
Bananymous 3be17c6117 BAN: Add clear and access by index to CircularQueue 2025-07-10 17:24:40 +03:00
Bananymous b97c123764 BAN: Make WeakPtr::lock const
There is no reason why it would not be :)

Also this prevented upstream from compiling
2025-06-11 16:53:43 +03:00
Bananymous 6f74f3c386 BAN: Allow constexpr construction of StringView 2025-06-07 18:29:32 +03:00
Bananymous e9f8471a28 BAN: Return UTF::invalid from byte_length instead of 0 2025-06-02 11:39:18 +03:00
Bananymous 8ff9c030bf Kernel: Add better termios support
I'm not sure if this is correct but at least it's better than before :)
2025-06-01 13:48:03 +03:00
Bananymous 4d840a8d9a BAN: Make Array more constexpr 2025-04-23 18:40:20 +03:00
Bananymous 98e05fd179 BAN: Implement atomic functions for normal integers 2025-04-20 03:11:41 +03:00
Bananymous 1a153b835c BAN: Nullterminate encoded UTF8 data 2025-04-01 22:39:56 +03:00
Bananymous 73c292c4e9 BAN: Fix negative floating point value printing 2025-04-01 22:39:21 +03:00
Bananymous cbe3f2a4ac BuildSystem: Cleanup and fix cmake files
I now set library SONAME so i don't have to build them in build root.

Creating font now makes sure the install directory exists. This allows
building using make files.

LibC now links agains ligcc
2025-01-28 17:11:21 +02:00
Bananymous 8b312a47e6 BAN: Allow MUST and TRY to contain commas 2024-12-16 17:22:40 +02:00
Bananymous 90820f24a4 BAN: Make HashMap::{insert,emplace}{,_or_assign} return an iterator
This reduces the number of lookups done into the hash map :)
2024-12-09 03:37:13 +02:00
Bananymous 6f118c1be1 BAN: Make HashMap key move constructible
This allows using non-copyable types as keys
2024-11-26 00:57:11 +02:00
Bananymous 7316eb87b8 BAN: Add requires expression for BAN::Formatter
This allows seeing syntax errors before compilation :)
2024-11-26 00:55:58 +02:00
Bananymous 5376236ab6 BAN: Make ErrorOr non-copyable
This makes avoiding accidentals copies easier :)
2024-11-26 00:55:12 +02:00
Bananymous 0af80d48ee BAN: Mark ByteSpan::slice as [[nodiscard]] 2024-11-26 00:54:35 +02:00