Function Definition:
bit.swapBytes <integer> <integer byte1> <integer byte2>
Returns an integer with byte1 and byte2 of value int swapped. Byte 1 is the lowest order byte.
I was looking over the documentation for bit shifting in Max Script and came across this function, but to help understand it better I was wondering if it can be written in bit operators like in Python, so I can better understand what this function is doing. Also, does byte 1 have to be the lowest order byte?
It does exactly how it is written in documentation:
bit.swapBytes <integer> <integer byte1> <integer byte2>
Returns an integer with bytes byte1 and byte2 of value int swapped. Byte 1 is the lowest order byte.
Let's take a look into example:
Note, 0xaa
(byte 3) was swapped with 0xbb
(byte 2). Here is how you can check it in depth with Calculator: