Commit 8fa86d0
authored
refactor: remove redundant "& 0xFF" masks from ord() and BitArray (#203)
* Remove redundant "& 0xFF" masks from ord() calls
These masks were carried over from C-style code, where "& 0xFF" is used to
prevent sign-extension when promoting signed chars (-128..127) to ints. In that
context, masking ensures the value is treated as an unsigned byte (0..255).
In PHP, however, ord() already returns an integer in the range 0–255, making
the extra "& 0xFF" operation unnecessary.
* Remove redundant "& 0xFF" mask in BitArray::generateEcBytes()
The mask was carried over from C-style code, where "& 0xFF" is used to prevent
sign-extension when promoting signed chars (-128..127) to ints.
In PHP, however, BitArray::toBytes() already produces values in the range 0–255,
making the extra mask operation unnecessary.1 parent bd2370d commit 8fa86d0
1 file changed
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
225 | | - | |
| 225 | + | |
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
| |||
457 | 457 | | |
458 | 458 | | |
459 | 459 | | |
460 | | - | |
| 460 | + | |
461 | 461 | | |
462 | 462 | | |
463 | 463 | | |
| |||
649 | 649 | | |
650 | 650 | | |
651 | 651 | | |
652 | | - | |
653 | | - | |
| 652 | + | |
| 653 | + | |
654 | 654 | | |
655 | 655 | | |
656 | 656 | | |
| |||
0 commit comments