3 ms·
Would it be better to do sparse_val = sparse[i] return sparse_val < n && dense[sparse_val] == i Regardless, we are treading in undefined territory, and th
by au8er 3y ago
Would it be better to do
sparse_val = sparse[i]
return sparse_val < n && dense[sparse_val] == i
Regardless, we are treading in undefined territory, and the behaviour is not something that can be reliably be dependent upon
- ynik 3y agoAt least in clang, your variant is not any better: uninitialized reads return the special value `undef`, which the compiler can constant-propagate to both uses of `sparse_val`. But then each `undef` can turn to a different value at each use, even if they both came from the same uninitialized read.