mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-11-18 09:46:19 -06:00
Common: Add DivideRoundingUp function
Many callers of AlignUp are dividing immediately after aligning. Let's add a helper function for this so callers don't have to specify the alignment size twice.
This commit is contained in:
@@ -58,7 +58,7 @@ void LazyMemoryRegionBitSet::SetBits(size_t bits_start, size_t bits_end)
|
||||
if (bits_start % 32 != 0)
|
||||
m_pointer[bits_start / 32] |= extra_first_word;
|
||||
|
||||
const size_t start_index = Common::AlignUp(bits_start, 32) / 32;
|
||||
const size_t start_index = Common::DivideRoundingUp(bits_start, 32);
|
||||
const size_t end_index = bits_end / 32;
|
||||
std::memset(m_pointer + start_index, 0xFF, (end_index - start_index) * 4);
|
||||
|
||||
@@ -85,7 +85,7 @@ void LazyMemoryRegionBitSet::ClearBits(size_t bits_start, size_t bits_end)
|
||||
if (bits_start % 32 != 0)
|
||||
m_pointer[bits_start / 32] &= extra_first_word;
|
||||
|
||||
const size_t start_index = Common::AlignUp(bits_start, 32) / 32;
|
||||
const size_t start_index = Common::DivideRoundingUp(bits_start, 32);
|
||||
const size_t end_index = bits_end / 32;
|
||||
std::memset(m_pointer + start_index, 0x00, (end_index - start_index) * sizeof(u32));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user