block/include/nil/crypto3/detail/reverser.hpp File Reference
#include <climits>
#include <type_traits>
#include <boost/integer.hpp>
#include <boost/static_assert.hpp>
#include <boost/endian/conversion.hpp>
#include <nil/crypto3/detail/unbounded_shift.hpp>
#include <nil/crypto3/detail/stream_endian.hpp>
#include <nil/crypto3/detail/predef.hpp>
+ Include dependency graph for block/include/nil/crypto3/detail/reverser.hpp:

Go to the source code of this file.

Classes

struct  nil::crypto3::detail::bit_in_unit_byte_reverser< UnitBits, k >
 bit_in_unit_byte_reverser transforms the sequence of bits in each byte of the input unit into reversed sequence of bits in each byte of the output unit. The function reverse is recursively invoked and the parameter k is used to track the number of already processed input bytes. The recursion ends, when all input bytes have been processed, i.e. when k == UnitBits. More...
 
struct  nil::crypto3::detail::bit_in_unit_byte_reverser< UnitBits, UnitBits >
 
struct  nil::crypto3::detail::bit_in_unit_reverser< InputBits, UnitBits, k >
 bit_in_unit_reverser transforms the sequence of bits in each unit of the input value into reversed sequence of bytes in each unit of the output value. The function reverse is recursively invoked and the parameter k is used to track the number of already processed input units. The recursion ends, when all input units have been processed, i.e. when k == InputBits. More...
 
struct  nil::crypto3::detail::bit_in_unit_reverser< InputBits, UnitBits, InputBits >
 
struct  nil::crypto3::detail::bit_reverser< InputEndianness, OutputEndianness, UnitBits, false >
 This bit_reverser deals with the case of the endiannesses with different order of bits and invokes bit_in_unit_reverser which reverses bits in each unit of the input value. More...
 
struct  nil::crypto3::detail::bit_reverser< InputEndianness, OutputEndianness, UnitBits, true >
 This bit_reverser is a dummy and deals with the case of the endiannesses with the same order of bits. More...
 
struct  nil::crypto3::detail::byte_in_unit_reverser< InputBits, UnitBits, k >
 byte_in_unit_reverser transforms the sequence of bytes in each unit of the input value into reversed sequence of bytes in each unit of the output value. The function reverse is recursively invoked and the parameter k is used to track the number of already processed input units. The recursion ends, when all input units have been processed, i.e. when k == InputBits. More...
 
struct  nil::crypto3::detail::byte_in_unit_reverser< InputBits, UnitBits, InputBits >
 
struct  nil::crypto3::detail::is_big_bit< Endianness, UnitBits >
 The group of traits below is used to determine the order of bits defined by the endianness. More...
 
struct  nil::crypto3::detail::is_big_unit< Endianness, UnitBits >
 The group of traits below is used to determine the order of units defined by the endianness. More...
 
struct  nil::crypto3::detail::is_little_bit< Endianness, UnitBits >
 Trait to determine whether the order of bits defined by Endianness endianness is little. More...
 
struct  nil::crypto3::detail::is_little_unit< Endianness, UnitBits >
 Trait to determine whether the order of units defined by Endianness endianness is little. More...
 
struct  nil::crypto3::detail::is_same_bit< Endianness1, Endianness2, UnitBits >
 Trait to determine whether the orders of bits defined by Endianness1 endianness and Endianness2 endianness are the same. More...
 
struct  nil::crypto3::detail::is_same_unit< Endianness1, Endianness2, UnitBits >
 Trait to determine whether the orders of units defined by Endianness1 endianness and Endianness2 endianness are the same. More...
 
struct  nil::crypto3::detail::unit_reverser< InputEndianness, OutputEndianness, UnitBits, typename std::enable_if< is_same_unit< InputEndianness, OutputEndianness, UnitBits >::value >::type >
 This unit_reverser is a dummy and deals with the case of the endiannesses with the same order of units. More...
 
struct  nil::crypto3::detail::unit_reverser< InputEndianness, OutputEndianness, UnitBits, typename std::enable_if<!is_same_unit< InputEndianness, OutputEndianness, UnitBits >::value &&(UnitBits > CHAR_BIT)>::type >
 This unit_reverser deals with the case of UnitBits > CHAR_BIT. To reverse the order of units, first, it reverses the byte order in an input value, and then, it invokes byte_in_unit_reverser to reverse the byte order in each unit of the input value. More...
 
struct  nil::crypto3::detail::unit_reverser< InputEndianness, OutputEndianness, UnitBits, typename std::enable_if<!is_same_unit< InputEndianness, OutputEndianness, UnitBits >::value &&UnitBits==CHAR_BIT >::type >
 This unit_reverser deals with the case of UnitBits == CHAR_BIT. This case is special since it is sufficient to reverse the order of bytes in an input value. More...
 

Namespaces

 nil
 
 nil::crypto3
 
 nil::crypto3::detail
 

Typedefs

typedef boost::uint_t< CHAR_BIT >::exact nil::crypto3::detail::byte_type
 

Functions

template<typename UnitType , int UnitBits = sizeof(UnitType) * CHAR_BIT, typename std::enable_if<(UnitBits > CHAR_BIT), int >::type = 0>
void nil::crypto3::detail::reverse_bits (UnitType &unit)
 The functions listed below deal with bit reversal in a unit. More...
 
void nil::crypto3::detail::reverse_byte (byte_type &b)
 This function reverses bit order in the byte b depending on the machine word size. The underlying algorithms used in this function are described in http://graphics.stanford.edu/~seander/bithacks.html#ReverseByteWith32Bits and in http://graphics.stanford.edu/~seander/bithacks.html#ReverseByteWith64BitsDiv . More...