From 7df764a9d3bb71b8982719708e3842a09e4dca46 Mon Sep 17 00:00:00 2001 From: AJR Date: Thu, 21 Sep 2023 18:52:05 -0400 Subject: distate.cpp: Use count_leading_zeros_64 to calculate format width --- src/emu/distate.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/emu/distate.cpp b/src/emu/distate.cpp index 7a7e09283cc..76ede23dfe2 100644 --- a/src/emu/distate.cpp +++ b/src/emu/distate.cpp @@ -127,9 +127,7 @@ void device_state_entry::format_from_mask() // make up a format based on the mask if (m_datamask == 0) throw emu_fatalerror("%s state entry requires a nonzero mask\n", m_symbol); - int width = 0; - for (u64 tempmask = m_datamask; tempmask != 0; tempmask >>= 4) - width++; + int width = (63 - count_leading_zeros_64(m_datamask)) / 4 + 1; m_format = string_format("%%0%dX", width); } -- cgit v1.2.3