Fix UB issue

This commit is contained in:
Akash Levy 2026-06-02 01:18:29 -07:00
parent 950cdf925c
commit 24b75b65db
1 changed files with 2 additions and 1 deletions

View File

@ -79,8 +79,9 @@ struct OptCompactPrefixWorker
sig = sigmap(sig);
if (!sig.is_fully_const())
return false;
uint64_t uvalue = (uint64_t)value;
for (int i = 0; i < GetSize(sig); i++) {
bool want = ((uint64_t)value >> i) & 1;
bool want = (i < 64) ? ((uvalue >> i) & 1) : (value < 0);
if (sig[i] != (want ? State::S1 : State::S0))
return false;
}