summaryrefslogtreecommitdiff
path: root/AK/Bitmap.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-02-23 20:42:32 +0100
committerAndreas Kling <kling@serenityos.org>2021-02-23 20:56:54 +0100
commit5d180d1f996ead27f9c5cb3db7f91e293de34d9d (patch)
treee881854dac5d749518562970d6194a0ef65736ec /AK/Bitmap.h
parentb33a6a443e700cd80325d312f21c985b0687bb97 (diff)
downloadserenity-5d180d1f996ead27f9c5cb3db7f91e293de34d9d.zip
Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
Diffstat (limited to 'AK/Bitmap.h')
-rw-r--r--AK/Bitmap.h30
1 files changed, 15 insertions, 15 deletions
diff --git a/AK/Bitmap.h b/AK/Bitmap.h
index a9129e3cd1..9c7a468829 100644
--- a/AK/Bitmap.h
+++ b/AK/Bitmap.h
@@ -85,12 +85,12 @@ public:
size_t size_in_bytes() const { return ceil_div(m_size, static_cast<size_t>(8)); }
bool get(size_t index) const
{
- ASSERT(index < m_size);
+ VERIFY(index < m_size);
return 0 != (m_data[index / 8] & (1u << (index % 8)));
}
void set(size_t index, bool value) const
{
- ASSERT(index < m_size);
+ VERIFY(index < m_size);
if (value)
m_data[index / 8] |= static_cast<u8>((1u << (index % 8)));
else
@@ -104,8 +104,8 @@ public:
size_t count_in_range(size_t start, size_t len, bool value) const
{
- ASSERT(start < m_size);
- ASSERT(start + len <= m_size);
+ VERIFY(start < m_size);
+ VERIFY(start + len <= m_size);
if (len == 0)
return 0;
@@ -153,8 +153,8 @@ public:
void grow(size_t size, bool default_value)
{
- ASSERT(m_owned);
- ASSERT(size > m_size);
+ VERIFY(m_owned);
+ VERIFY(size > m_size);
auto previous_size_bytes = size_in_bytes();
auto previous_size = m_size;
@@ -176,8 +176,8 @@ public:
template<bool VALUE>
void set_range(size_t start, size_t len)
{
- ASSERT(start < m_size);
- ASSERT(start + len <= m_size);
+ VERIFY(start < m_size);
+ VERIFY(start + len <= m_size);
if (len == 0)
return;
@@ -228,7 +228,7 @@ public:
template<bool VALUE>
Optional<size_t> find_one_anywhere(size_t hint = 0) const
{
- ASSERT(hint < m_size);
+ VERIFY(hint < m_size);
const u8* end = &m_data[m_size / 8];
for (;;) {
@@ -249,7 +249,7 @@ public:
byte = m_data[i];
if constexpr (!VALUE)
byte = ~byte;
- ASSERT(byte != 0);
+ VERIFY(byte != 0);
return i * 8 + __builtin_ffs(byte) - 1;
}
}
@@ -264,7 +264,7 @@ public:
u8 byte = VALUE ? 0x00 : 0xff;
size_t i = (const u8*)ptr32 - &m_data[0];
size_t byte_count = m_size / 8;
- ASSERT(i <= byte_count);
+ VERIFY(i <= byte_count);
while (i < byte_count && m_data[i] == byte)
i++;
if (i == byte_count) {
@@ -279,7 +279,7 @@ public:
byte = m_data[i];
if constexpr (!VALUE)
byte = ~byte;
- ASSERT(byte != 0);
+ VERIFY(byte != 0);
return i * 8 + __builtin_ffs(byte) - 1;
}
@@ -288,7 +288,7 @@ public:
val32 = *ptr32;
if constexpr (!VALUE)
val32 = ~val32;
- ASSERT(val32 != 0);
+ VERIFY(val32 != 0);
return ((const u8*)ptr32 - &m_data[0]) * 8 + __builtin_ffsl(val32) - 1;
}
}
@@ -317,7 +317,7 @@ public:
byte = m_data[i];
if constexpr (!VALUE)
byte = ~byte;
- ASSERT(byte != 0);
+ VERIFY(byte != 0);
return i * 8 + __builtin_ffs(byte) - 1;
}
@@ -509,7 +509,7 @@ public:
: m_size(size)
, m_owned(true)
{
- ASSERT(m_size != 0);
+ VERIFY(m_size != 0);
m_data = reinterpret_cast<u8*>(kmalloc(size_in_bytes()));
fill(default_value);
}