Commit Graph

223 Commits

Author SHA1 Message Date
Bananymous d2bc399770 BAN: Make StringView::split const and fix bug with empties 2024-01-03 00:14:29 +02:00
Bananymous 07d5d3f936 BAN: Simple iterator now contains valid flag
This allows iteration over empty containers
2023-12-29 14:49:57 +02:00
Bananymous 861bf27e96 BAN: Implement abs() 2023-12-26 00:54:06 +02:00
Bananymous b833239a82 BAN: Make hashmap work with non-copy constructable values 2023-12-24 13:38:47 +02:00
Bananymous 6fec142760 BAN: Add requires clauses for vector 2023-12-24 13:38:20 +02:00
Bananymous 84b2438b3d BAN: Add requires for copy constructor for linked list 2023-12-24 13:37:49 +02:00
Bananymous 0e714d5eb4 BAN: Implement String::operator==(const String&) 2023-12-24 13:36:46 +02:00
Bananymous 9b8e6e6629 BAN: Implement is_*constructable 2023-12-24 13:36:12 +02:00
Bananymous 2e77718f07 BAN: Implement find() for StringView 2023-12-23 18:43:52 +02:00
Bananymous f371fabe35 BAN: HashSet is now internally Vector<LinkedList<T>>
It used to be Vector<Vector<T>> but this feels more proper
2023-12-23 16:37:21 +02:00
Bananymous 79a15132da BAN: Cleanup HashSet
I now use BAN::Iterator as the base iterator. Also unstable version
was added.
2023-12-23 16:32:06 +02:00
Bananymous bacc0db778 BAN: Fix unstable hash map rebucket 2023-12-23 16:31:42 +02:00
Bananymous 3963afe343 BAN: Add unstable version of hash map
This version differs only when doing rebucket. If rebucket fails,
the whole hash map is invalidated. This allows rebucketing to use
moving instead of copying.
2023-12-19 22:23:28 +02:00
Bananymous 951873098e BAN: Rewrite heap sort
Heap sort is now more close to gnulibc++ version. This is just more
simplified version.
2023-12-08 22:45:55 +02:00
Bananymous 2b927b9729 BAN: Restructure sort functions and namespaces 2023-12-08 18:58:47 +02:00
Bananymous be657b9b18 BAN: Add default sort. This is wrapper around sort_intro 2023-12-08 00:10:09 +02:00
Bananymous 94e6b9fa65 BAN: Implement intro sort 2023-12-07 23:56:11 +02:00
Bananymous d8ea0eeba3 BAN: Add less than operator for iterator 2023-12-07 23:55:41 +02:00
Bananymous 6873244169 BAN: Move placement new to New.h
I have no idea why they were defined in Move.h
2023-12-07 23:52:57 +02:00
Bananymous 805b4096e9 BAN: Remove empty else. Builds with -Wall -Wextra 2023-12-07 23:50:35 +02:00
Bananymous 0f74e123b8 BAN: Implement ilog2 for unsigned integers 2023-12-07 23:50:04 +02:00
Bananymous 7f212106db BAN: Implement heap sort 2023-12-07 23:18:49 +02:00
Bananymous 46c3da71b6 BAN: Cleanup sorting code 2023-12-07 23:18:49 +02:00
Bananymous e5cab047d6 BAN: Implement more methods for iterators 2023-12-07 23:18:49 +02:00
Bananymous bf3e9eabd5 BAN: Implement distance() for iterators 2023-12-07 23:18:49 +02:00
Bananymous 19604015de BAN: Implement quick sort 2023-12-07 19:28:31 +02:00
Bananymous 08bc0a2815 BAN: Implement next() and prev() for iterators and use them in sorts 2023-12-07 19:28:05 +02:00
Bananymous 6caa9b6f95 BAN: implement quick sort and test for it 2023-12-07 11:55:28 +02:00
Bananymous 59ad639fa8 BAN: Fix simple iterator operator--() 2023-12-07 11:55:28 +02:00
Bananymous 43458cc74f BAN: implement exchange sort and test for it 2023-12-07 11:55:28 +02:00
Bananymous e935a33a4d BAN: add value_type to iterators 2023-12-07 10:15:18 +02:00
Bananymous a872efdef2 BAN: implement basic swap
This will be improved, currently just works on general type T and
moves values between arguments.
2023-12-07 09:26:17 +02:00
Bananymous 19ed0cb9bf BAN: Add basic GUID data structure 2023-11-21 15:11:50 +02:00
Bananymous 240d57f4b4 BAN: Update bytespan -> span API 2023-11-04 18:12:46 +02:00
Bananymous f6c312a6b3 BuildSystem: using sysroot doesn't need root privileges anymore!
Sysroot is now created with fakeroot. This allows root access to be
only needed for disk image creation, since it uses loopback devices.
2023-11-04 17:50:43 +02:00
Bananymous ca34ece8ef BAN: Update ASSERT api
its now much harder to mix < with <= and > with >=
2023-11-02 00:01:12 +02:00
Bananymous 3c311efb81 BAN: Implement better ASSERT macros
Implement macros for all basic binary ops. These macros print failed
values when the fail.
2023-10-30 16:22:02 +02:00
Bananymous d5e0900cbb BAN: String now uses union for its sso storage
This allows String to shrink by 8 bytes since Variant's 8 index is
no longer stored in here.

This required me to make Strings max size one bit less, but that
should still be fine. There should never be strings with size of
over half of the computer's address space.
2023-10-30 11:13:16 +02:00
Bananymous 229082a1b2 BAN: Rewrite String with small string optimizations
String now holds a 15 byte sso buffer. I'm not sure what the size
should actually be but 15 will work for now. Maybe the sso buffer
should be contained in an union with one bit flag in size instead of
variant that uses extra 8 bytes for type index.

This patch buffs sizeof(String) from 24 bytes to 32 bytes on 64 bit.
I assume this is much better version than the old which had to make
allocation even for empty strings :D.
2023-10-29 03:11:13 +03:00
Bananymous 0db17e9d39 BAN: Add variant to ForwardList
I should be using the forward list more
2023-10-29 02:28:55 +03:00
Bananymous d98f84f9d3 BAN: Update ByteSpan API
Add ByteSpan::as_span<T> and const versions of as() and as_span()
require T to be const.
2023-10-28 22:10:47 +03:00
Bananymous 3566ddab00 BAN: ByteSpan can be sliced without specified size
This will give span with all remaining size after offset
2023-10-25 21:41:11 +03:00
Bananymous fc8a000e46 BAN: Fix bug of size of splice after slice()
I have no idea what was I doing before :D
2023-10-24 17:23:45 +03:00
Bananymous 71cad2fc38 BAN: Implement ByteSpan
This is a span over exisiting containers/data types. I'm not too
happy with the constructors and assignment operators, but they will
work for now
2023-10-20 04:59:29 +03:00
Bananymous 61c7a68f4a BAN: add helper to cast Span<T> to Span<const T> 2023-10-20 04:59:08 +03:00
Bananymous 744ff40ba0 BAN: Optional can now be constructed from another Optional
Also fix bug in release_value() where we did not call the
destructor.
2023-10-11 20:10:06 +03:00
Bananymous 0b93fce923 BAN: Remove endianness functions from Math
There is now a Endianness.h for these. The functions were super slow.
2023-09-29 19:38:07 +03:00
Bananymous a8d74f604e BAN: Update Endiannes API
Add functions to swap endiannes or convert host to big/little endian

This code should be very compiler friendly and should be optimized to
single bswap instruction on x86.
2023-09-28 01:22:14 +03:00
Bananymous ef68e12125 BAN: Implement basic WeakPtr
This can be constructed from classes that inherit from Weakable
2023-09-25 19:43:10 +03:00
Bananymous 2a469241b2 BAN: Fix LinkedList::pop_back() 2023-09-22 17:20:35 +03:00