That code performs a toggle between little endian and big endian for an unsigned 64 bit data type.
Look at the first sub-expression:
(number & 0x00000000000000ff) << 56
This masks out bits 0-7, and shifts them to the left by 56. So they now occupy bits 56-63.
And the next sub-expression:
(number & 0x000000000000ff00) << 40
This masks out bits 8-15, and shifts them to the left by 40. And so on, and so on.
If was writing the code I'd use bitwise or, |
, rather than arithmetic addition, +
, since that reads better in my view.