summaryrefslogtreecommitdiff
path: root/AK/BitmapView.h
AgeCommit message (Collapse)Author
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2021-12-21AK+Everywhere: Replace __builtin bit functionsNick Johnson
In order to reduce our reliance on __builtin_{ffs, clz, ctz, popcount}, this commit removes all calls to these functions and replaces them with the equivalent functions in AK/BuiltinWrappers.h.
2021-12-18AK: Speed up BitmapView::find_next_range_of_unset_bitsNick Johnson
While watching Andreas' most recent video, I noticed that this function only worked with 32 bit values, but was a serious performance bottleneck for the kernel. As such, I reworked it to use `size_t`, so it now can switch to 64-bit sweeps on 64-bit platforms. This caused test-js to go from 12.5 seconds hot to 11.5 seconds hot on my machine when running on KVM x86_64.
2021-11-14AK: Resolve clang-tidy readability-bool-conversion warningsAndrew Kaster
... In files included by Kernel/Process.cpp and Kernel/Thread.cpp
2021-11-10AK: Properly declare inheritance of Bitmap from BitmapViewBen Wiederhake
All the read-only methods of Bitmap simply defer to BitmapView. Let's make this relationship official by using class inheritance. This might even shave off a few instructions, although any sufficiently optimizing compiler probably already optimized them away.
2021-11-10AK+Kernel: Make BitmapView read-onlyBen Wiederhake
2021-05-19Bitmap: De-duplicate bitmasksLenny Maiorani
Problem: - Bitmasks are duplicated. - Bitmasks are C-style arrays. Solution: - Move bitmasks to BitmapView.h. - Change C-style arrays to be AK::Array for added safety.
2021-05-18BitmapView: Disable mutations of the underlying BitmapLenny Maiorani
Problem: - `BitmapView` permits changing the underlying `Bitmap`. This violates the idea of a "view" since views are simply overlays which can themselves change but do not change the underlying data. Solution: - Migrate all non-`const` member functions to Bitmap.
2021-05-17Revert "BitmapView: Disable mutations of the underlying Bitmap"Andreas Kling
This reverts commit f25209113fcd15df5778938c4accf13c5139d278.
2021-05-17BitmapView: Disable mutations of the underlying BitmapLenny Maiorani
Problem: - `BitmapView` permits changing the underlying `Bitmap`. This violates the idea of a "view" since views are simply overlays which can themselves change but do not change the underlying data. Solution: - Migrate all non-`const` member functions to Bitmap.
2021-05-16AK: Don't read past the end in BitmapView::count_in_range()Andrew Kaster
The current code is factored such that reads to the entirety of the last byte should be dropped. This was relying on the fact that last would be one past the end in that case. Instead of actually reading that byte when it's completely out of bounds of the bitmask, just skip reads that would be invalid. Add more tests to make sure that the behavior is correct for byte aligned reads of byte aligned bitmaps.
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-09AK: Add BitmapView::set_range_and_verify_that_all_bits_flip()Andreas Kling
This function sets a range of bits to the same value while also verifying that all bits in the range get flipped in the process.
2021-03-04AK: Add BitmapView class (like StringView but for bitmaps)Andreas Kling
AK::Bitmap is an awkwardly modal class which can either own or wrap the underlying data. To get ourselves out of this unpleasant situation, this patch adds BitmapView to replace the wrapped mode. A BitmapView is simply a { data pointer, bit count } tuple internally and provides all the convenient functionality of a bitmap class.