es/minifier
: truncate literal in bitwise and
#10390
Labels
Milestone
8000
es/minifier
: truncate literal in bitwise and
#10390
Describe the feature
I recently I encountered
a & 0xfffffffc
in my codebase (blanks out the lower 2 bits to align to a 4 byte boundary in base64 decoding).This could be
a & -4
instead.This applies to all bitwise operations but I haven't encountered others with such high values so far.
Although there's some cases where staying positive is actually shorter (eg
a & 0x80000000
is shorter thana & -0x80000000
which would be the correct "in bounds" literal)Babel plugin or link to the feature description
https://play.swc.rs/?version=1.11.21&code=H4sIAAAAAAAAA0vOzyvOz0nVy8lP10hUUFMwqEiDgGRNACgym%2BMbAAAA&config=H4sIAAAAAAAAA42VS47bMAxA9z1F4HUX7aJFMQeYXc8gKBblaCqLhkh5Ygxy99K%2FxJ3QRjdBzMeP%2BJM%2BvpxO1RvV1cvpQ%2F7KR2czQb5%2Fi4SGxPYqkoqHDqjOoeNqgrevsw3b3ACPGkA%2FqkUYEQlE5m0kWGRtSMEPW%2Bc1tl0Goo1MpOKvtJCY%2FrVfWMb3EXAuW%2FkZMYJNB8RYMiExNJA1xzXGaDsC09useBlPanMg1EKMsDA402XsVJ5c4IBJYj5TB9aZGh0oKGSoOfSgmUksMUsk6Sn5TNjBuTTN1NBP1tDbWCwrMeE6tUROq3i9YCA2viSthDPcqcEMl%2BJ%2BtgzeZOCS07PdG4a005M%2FAFKBaImSbUHzO2l4mac9a39oGZKXkeVB4TLfWpYJGimqCcErlR0rA5mD1s0MrtQwVrbWjrPgnfJRcGDAe5kVxTW9B64vWtBxo9ErQPprvTZVMzD3Ldzh40Ic4FfJkvUBWzRay5d9SkN7xngQoAW%2BoDtQkFYw7uMst8S12%2BclOZDRAKeqFJrA8yUgC8Bo4nRZPs2GrId4NE3E8%2BOaWBRuq2bV2tRM%2B765Lxm7CD3EvTH%2BjxU5pHK2fpzqdbOfthd%2BaUNpZfHC928rWlN5vB3TT9WiK5uMpqGcH5Of1UNpfTruUapAv1fLuZa3v8TDE%2F3PBgAA
Additional context
No response
The text was updated successfully, but these errors were encountered: