Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

EndianHelper

Git Source

Provides helper functions for converting values to little-endian format

Functions

toLittleEndian

Converts a 256-bit unsigned integer to little-endian format

function toLittleEndian(uint256 value) internal pure returns (bytes32);

Parameters

NameTypeDescription
valueuint256The unsigned integer to convert

Returns

NameTypeDescription
<none>bytes32The little-endian representation of the input value as bytes32

toLittleEndian

Converts a boolean value to its little-endian bytes32 representation

function toLittleEndian(bool value) internal pure returns (bytes32);

Parameters

NameTypeDescription
valueboolThe boolean to convert

Returns

NameTypeDescription
<none>bytes32The little-endian representation of the boolean as bytes32

reverseBytes64

Reverses a uint64 from little-endian to big-endian (needed in Solidity)

function reverseBytes64(uint64 input) internal pure returns (uint64);