emumem_mview.cpp: Use count_leading_zeros to simplify awidth calculation

This commit is contained in:
AJR 2021-03-05 23:25:35 -05:00
parent 50a9bab214
commit 6732746ccd

View File

@ -776,12 +776,7 @@ std::pair<handler_entry *, handler_entry *> memory_view::make_handlers(address_s
m_space = &space;
offs_t span = addrstart ^ addrend;
u32 awidth = 0;
if (span) {
for(awidth = 1; awidth != 32; awidth++)
if ((1 << awidth) >= span)
break;
}
u32 awidth = 32 - count_leading_zeros(span);
h_make(awidth, m_config->data_width(), m_config->addr_shift(), m_config->endianness(), space, *this, m_handler_read, m_handler_write);
m_handler_read->ref();