luau-lang / luau

A fast, small, safe, gradually typed embeddable scripting language derived from Lua
https://luau.org
MIT License
3.98k stars 373 forks source link

~~Byteswap but not bitswap~~ #1234

Closed ccuser44 closed 5 months ago

ccuser44 commented 5 months ago

Recently Luau added the bit32.byteswap function. One would expect bit32.byteswap to This would be very useful for changing the endianness of data which could easily be done with bitswap + bitwise shift as I expected

Byteswap could easily be implemented with bitwise extract + bitwise shift and bitwise or. Bitswap cannot. So if not for changing endianness why do we even have byteswap but not bitswap? Byteswap just seems like bloat