library NumberCompressor {

    uint256 constant private MASK = 16777215;   // 2 ** 24 - 1

    function encode(uint256 _begin, uint256 _end, uint256 _ceiling) internal pure returns (uint256)
    {
        require(_begin <= _end && _end < _ceiling, "number is invalid");

        return _begin << 24 | _end;
    }

    function decode(uint256 _value) internal pure returns (uint256, uint256)
    {
        uint256 end = _value & MASK;
        uint256 begin = (_value >> 24) & MASK;
        return (begin, end);
    }

}
/**
 * @title NumberCompressor
 * @dev Number compressor to storage the begin and end numbers into a uint256
 */
function encode(uint256 _begin, uint256 _end, uint256 _ceiling) internal pure returns (uint256)
{
    require(_begin <= _end && _end < _ceiling, "number is invalid");

    return _begin << 24 | _end;
}

// 2 ** 24 - 1