Skip to content

Commit

Permalink
Update allocated to active in naming
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 committed Feb 26, 2024
1 parent 3a00a35 commit 2400a76
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/lib/support/Pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Loop StaticAllocatorBitmap::ForEachActiveObjectInner(void * context, Lambda lamb
return Loop::Finish;
}

size_t StaticAllocatorBitmap::FirstAllocatedIndex()
size_t StaticAllocatorBitmap::FirstActiveIndex()
{
size_t idx = 0;
for (size_t word = 0; word * kBitChunkSize < Capacity(); ++word)
Expand Down
10 changes: 5 additions & 5 deletions src/lib/support/Pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ class StaticAllocatorBitmap : public internal::StaticAllocatorBase
void * At(size_t index) { return static_cast<uint8_t *>(mElements) + mElementSize * index; }
size_t IndexOf(void * element);

/// Returns the first index that is allocated.
/// Returns the first index that is active (i.e. allocated data).
///
/// If nothing is allocated, this will return mCapacity
size_t FirstAllocatedIndex();
/// If nothing is active, this will return mCapacity
size_t FirstActiveIndex();

/// Returns the next active index after `start`.
///
/// If nothing else allocated, returns mCapacity
/// If nothing else active/allocated, returns mCapacity
size_t NextActiveIndexAfter(size_t start);

using Lambda = Loop (*)(void * context, void * object);
Expand Down Expand Up @@ -265,7 +265,7 @@ class BitMapObjectPool : public internal::StaticAllocatorBitmap
BitMapObjectPool() : StaticAllocatorBitmap(mData.mMemory, mUsage, N, sizeof(T)) {}
~BitMapObjectPool() { VerifyOrDie(Allocated() == 0); }

BitmapActiveObjectIterator<T> begin() { return BitmapActiveObjectIterator<T>(this, FirstAllocatedIndex()); }
BitmapActiveObjectIterator<T> begin() { return BitmapActiveObjectIterator<T>(this, FirstActiveIndex()); }
BitmapActiveObjectIterator<T> end() { return BitmapActiveObjectIterator<T>(this, N); }

template <typename... Args>
Expand Down

0 comments on commit 2400a76

Please sign in to comment.