summaryrefslogtreecommitdiff
path: root/AK/Bitmap.h
AgeCommit message (Collapse)Author
2020-10-03Everywhere: Fix more typosLinus Groh
2020-09-09AK: Add Bitmap::find_one_anywhere and optimize Bitmap::find_firstTom
Leverage constexpr and __builtin_ffs for Bitmap::find_first. Also add a variant Bitmap::find_one_anywhere that can start scanning at a provided hint. Also, merge Bitmap::fill_range into the already existing Bitmap::set_range
2020-09-06AK: Add Bitmap::count_in_range and Bitmap::fill_rangeTom
2020-08-27Meta: Force semi-colon after MAKE_AK_NONXXXABLE()Ben Wiederhake
Before, we had about these occurrence counts: COPY: 13 without, 33 with MOVE: 12 without, 28 with Clearly, 'with' was the preferred way. However, this introduced double-semicolons all over the place, and caused some warnings to trigger. This patch *forces* the usage of a semi-colon when calling the macro, by removing the semi-colon within the macro. (And thus also gets rid of the double-semicolon.)
2020-05-06AK: Fix Bitmap not finding unset ranges at the end of the mapAndreas Kling
When we switched the Bitmap code to operating 32 bits at a time, we neglected to look in the trailing remainder bits after the last full 32-bit word. This patch fixes that and adds a couple of tests for Bitmap that I hacked up while tracking down this bug. I found this bug when noticing that the kernel would OOM while there were still some pages left in the physical page allocator.
2020-04-06Kernel: Support best fit allocation policy in kmalloc()nimelehin
Add find_best_fit() which implements best fit allocation algorithm. Kmalloc now uses a best fit allocation policy for large allocations.
2020-04-06Bitmap: Add Bitmap::find_next_range_of_unset_bits()nimelehin
AK::Bitmap is extended with find_next_range_of_unset_bits(). The function is implemented using count_trailing_zeroes_32(), which is optimized on many platforms, that gives a huge performance boost. Functions find_longest_range_of_unset_bits() and find_first_fit() are implemented with find_next_range_of_unset_bits(). According to benchmarks, they are 60-100% faster.
2020-04-06AK: Add Bitmap::find_first_fit()nimelehin
Add find_first_fit() which implements first fit algorithm.
2020-04-06AK: Add Bitmap::set_range()nimelehin
Add set_range() which sets a range of bits to requested value. Fix code style.
2020-03-08AK: Use default constructor of Optional if an unset bit is not foundLiav A
2020-03-08AK: Use __builtin_memset() and such to reduce header dependenciesAndreas Kling
We can use __builtin_memset() without including <string.h>. This is pretty neat, as it will allow us to reduce the header deps of AK templates a bit, if applied consistently. Note that this is an enabling change for an upcoming #include removal.
2020-03-06AK: Remove Optional::operator bool()Andreas Kling
This was causing some obvious-in-hindsight but hard to spot bugs where we'd implicitly convert the bool to an integer type and carry on with the number 1 instead of the actual value().
2020-03-02AK: Remove superfluous explicit in Bitmap (#1337)howar6hill
2020-02-25AK: Some more int => size_t in BitmapAndreas Kling
2020-02-24AK: Make Bitmap use size_t for its sizeAndreas Kling
Also rework its API's to return Optional<size_t> instead of int with -1 as the error value.
2020-01-26Ext2FS: allocate_blocks allocates contiguous blocks (#1095)Marios Prokopakis
This implementation uses the new helper method of Bitmap called find_longest_range_of_unset_bits. This method looks for the biggest range of contiguous bits unset in the bitmap and returns the start of the range back to the caller.
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2019-10-01AK: Make Bitmap constructors public to allow make<Bitmap>()Andreas Kling
I don't love this, but I also don't love the Bitmap class in general.
2019-08-01AK: Make Bitmap movable but not copyable.Andreas Kling
We were falling back to an incorrect compiler-generated copy ctor for this class, and let's not do that. Found by PVS-Studio.
2019-07-03AK: Rename the common integer typedefs to make it obvious what they are.Andreas Kling
These types can be picked up by including <AK/Types.h>: * u8, u16, u32, u64 (unsigned) * i8, i16, i32, i64 (signed)
2019-06-12AK: Add find_first_{set,unset} and grow methods to BitmapConrad Pankoff
2019-05-28Add clang-format fileRobin Burchell
Also run it across the whole tree to get everything using the One True Style. We don't yet run this in an automated fashion as it's a little slow, but there is a snippet to do so in makeall.sh.
2019-05-14Kernel: Encapsulate the Region's COW map a bit better.Andreas Kling
2019-02-25More moving towards using signed types.Andreas Kling
I'm still feeling this out, but I am starting to like the general idea.
2019-01-31Big, possibly complete sweep of naming changes.Andreas Kling
2018-12-04Import a simple text editor I started working on.Andreas Kling
2018-11-05Implement COW pages! :^)Andreas Kling
sys$fork() now clones all writable regions with per-page COW bits. The pages are then mapped read-only and we handle a PF by COWing the pages. This is quite delightful. Obviously there's lots of work to do still, and it needs better data structures, but the general concept works.
2018-10-10Import all this stuff into a single repo called Serenity.Andreas Kling