source-sdk-2013 icon indicating copy to clipboard operation
source-sdk-2013 copied to clipboard

[HL2MP] Fix signed integer issue in BitForBitnum function

Open speedvoltage opened this issue 9 months ago • 0 comments

Issue: If we use signed integers, we end up holding negative numbers and this leads to certain number of issues, like incorrect handling of large values, as the sign bit may be interpreted incorrectly, causing wrong results.

Fix: Therefore, we switch BitForBitnum to return an unsigned int instead of int to stop negative values from being returned and allow shifting above 31 bits.

speedvoltage avatar Mar 14 '25 21:03 speedvoltage