llvm.org GIT mirror llvm / 2563e20
Support: Document Endian.h functions git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204671 91177308-0d34-0410-b5e6-96231b3b80d8 Justin Bogner 6 years ago
1 changed file(s) with 3 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
3333 } // end namespace detail
3434
3535 namespace endian {
36 /// Swap the bytes of value to match the given endianness.
3637 template
3738 inline value_type byte_swap(value_type value) {
3839 if (endian != native && sys::IsBigEndianHost != (endian == big))
4041 return value;
4142 }
4243
44 /// Read a value of a particular endianness from memory.
4345 template
4446 endianness endian,
4547 std::size_t alignment>
5355 return byte_swap(ret);
5456 }
5557
58 /// Write a value to memory with a particular endianness.
5659 template
5760 endianness endian,
5861 std::size_t alignment>