Commit Graph

32 Commits

Author SHA1 Message Date
Bananymous f72fdeeb59 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 1af3ca19ab 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 720bc418a6 All: Clear lines with only whitspace in them 2023-09-10 00:31:42 +03:00
Bananymous 6aff459e1c BAN: add StringView::contains(char) 2023-06-05 22:51:02 +03:00
Bananymous 2fabe1949c BAN: Move RefPtr to its own file and create New.h
New.h contains definitions for placement new operators and
BAN::allocator and BAN::dealloctor
2023-04-10 21:07:25 +03:00
Bananymous c1dbafc101 BAN: StringView::split(char, bool) is now thread safe
I had to duplicate some code, but this is better since I would like
to not use BAN::Function for something like this
2023-03-30 16:35:38 +03:00
Bananymous f8a2c60c8d Kernel/BAN: move unix time conversion to BAN and add stat to Shell 2023-03-27 00:49:58 +03:00
Bananymous c012822d49 BAN: Rename StringView suffix from _sv to sv 2023-03-16 12:15:16 +02:00
Bananymous 1c146ba1a5 BAN: remove aligned alloc from ban 2023-03-02 22:12:42 +02:00
Bananymous 52aa98ba25 Kernel+LibC: Add some errno codes
Kernel now returns ENOMEM and other errnos, so we dont have to write
error messages
2023-03-02 21:10:44 +02:00
Bananymous 4afc4660a4 BAN: Basic containers have shrink_to_fit() method
I also chaged the default memory allocation increase from 1.5 to 2
2023-02-22 02:07:05 +02:00
Bananymous 9b8de5025a All: rename every function from UpperCamelCase to snake_case
This was a mess since I didn't know which to use but now I decided
to go with snake_case :)
2023-02-01 21:05:44 +02:00
Bananymous cf63552b2a BAN: Cleanup includes 2023-01-17 11:38:16 +02:00
Bananymous 5122d27f89 BAN: Add Front() and Back() to StringView 2023-01-16 18:56:51 +02:00
Bananymous 065e23d307 BAN: fix include 2023-01-13 15:04:06 +02:00
Bananymous 82a25f9035 BAN: implement placement new 2023-01-13 14:45:27 +02:00
Bananymous 53d1d12c12 BAN: String add operator=(StringView) 2023-01-13 00:57:47 +02:00
Bananymous c33c6c5785 BAN: memcpy only if we already have a buffer 2023-01-13 00:17:19 +02:00
Bananymous 61bd9da8e0 BAN: Add [[nodiscard]] to BAN functions returning ErrorOr 2023-01-12 23:57:07 +02:00
Bananymous 78da037dda BAN: String, Queue and Vector dont use floating point arithmetic 2023-01-12 17:00:29 +02:00
Bananymous d02e3b19c7 BAN: Move operator new/delete to BAN/Memory.cpp
We also now implement alignment new
2023-01-10 21:59:40 +02:00
Bananymous 6f9552d673 BAN: Add math to its own namespace 2023-01-10 19:11:27 +02:00
Bananymous 1a65ea977d BAN: Better ASSERT() 2023-01-10 17:43:18 +02:00
Bananymous b60af90538 BAN: Add min, max and clamp 2022-12-30 19:52:16 +02:00
Bananymous 6732cabf20 BAN: StringView::Split now accepts a function
Original overload with char is not threadsafe anymore, but I don't
want to duplicate code :)
2022-12-20 11:50:32 +02:00
Bananymous 4c559f50a4 BAN: StringView::Split() now precomputes number of elements
We dont have to resize vector on PushBack()'s if we reserve required size
2022-12-20 11:37:28 +02:00
Bananymous d5a068f90c BAN: String and StringView don't have to compute strlen for equality 2022-12-20 11:36:01 +02:00
Bananymous c21766760b Add strlen comparing back to StringView since it is not nullterminated 2022-12-13 22:45:51 +02:00
Bananymous ced05ff5f2 BAN: use only memcmp when comparing string(view) with const char* 2022-12-13 21:32:51 +02:00
Bananymous 5345b6b8c3 BAN: overloaded operator== for more types 2022-12-13 20:55:09 +02:00
Bananymous cb6dee9d91 BAN: Implement more basic functionality
String has more features
StringView was implemented
Basic move semantics are now working
Added file for forward declarations
2022-12-13 20:41:32 +02:00
Bananymous 941238830e BAN: Now actually build libban :D 2022-12-13 16:13:38 +02:00