Commit 209bfe3
committed
handy.h: Avoid UB in nBIT_MASK()
I discovered the hard way that this is undefined behavior when operating
on the widest unsigned integer type available on the platform.
I couldn't think of a way to write this without a branch that worked
both for that condition and a zero length mask1 parent 8ac8d05 commit 209bfe3
1 file changed
+9
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
342 | 342 | | |
343 | 343 | | |
344 | 344 | | |
345 | | - | |
346 | | - | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
347 | 354 | | |
348 | 355 | | |
349 | 356 | | |
| |||
0 commit comments