Rejig to avoid cast that some compilers might warn on

This commit is contained in:
baldurk committed 2026-03-11 23:27:29 +00:00
1 parent dc82c117f5
commit 71704d2885
1 file changed
+15 -12
+15 -12
View File
@@ -2234,18 +2234,21 @@ void ThreadState::StepNext(bool useDebugState, const uint32_t steps,
for(uint8_t c = 0; c < var.columns; c++)
{
#undef _IMPL
#define _IMPL(I, S, U) \
const U bitcount = comp<U>(count, c); \
const U mask = bitcount == sizeof(U) * 8 ? ~0ULL : (U(1) << bitcount) - U(1); \
\
comp<U>(var, c) >>= comp<U>(offset, c); \
comp<U>(var, c) &= mask; \
\
if(opdata.op == Op::BitFieldSExtract) \
{ \
U topbit = (mask + U(1)) >> U(1); \
if(comp<U>(var, c) & topbit) \
comp<U>(var, c) |= (~0ULL ^ mask); \
#define _IMPL(I, S, U) \
const U bitcount = comp<U>(count, c); \
if(bitcount < sizeof(U) * 8) \
{ \
const U mask = (U(1) << bitcount) - U(1); \
\
comp<U>(var, c) >>= comp<U>(offset, c); \
comp<U>(var, c) &= mask; \
\
if(opdata.op == Op::BitFieldSExtract) \
{ \
U topbit = (mask + U(1)) >> U(1); \
if(comp<U>(var, c) & topbit) \
comp<U>(var, c) |= (~0ULL ^ mask); \
} \
}
IMPL_FOR_INT_TYPES(_IMPL);