2024-01-22 14:38:25 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
2024-01-23 09:24:02 +00:00
|
|
|
pragma solidity 0.8.23;
|
2024-01-22 14:38:25 +00:00
|
|
|
|
|
|
|
contract Endian {
|
|
|
|
/// reverses byte order to allow conversion between little endian and big
|
|
|
|
/// endian integers
|
|
|
|
function _byteSwap(bytes32 input) internal pure returns (bytes32 output) {
|
|
|
|
output = output | bytes1(input);
|
|
|
|
for (uint i = 1; i < 32; i++) {
|
|
|
|
output = output >> 8;
|
|
|
|
output = output | bytes1(input << (i * 8));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|