I hate line endings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117132 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Michael J. Spencer 2010-10-22 19:14:39 +00:00
parent 92205842ca
commit 2e6048f869

View File

@ -48,43 +48,43 @@ struct alignment_access_helper<value_type, unaligned>
} // end namespace detail
namespace endian {
template<typename value_type, alignment align>
static value_type read_le(const void *memory) {
value_type t =
reinterpret_cast<const detail::alignment_access_helper
<value_type, align> *>(memory)->val;
if (sys::isBigEndianHost())
return sys::SwapByteOrder(t);
return t;
}
template<typename value_type, alignment align>
static void write_le(void *memory, value_type value) {
if (sys::isBigEndianHost())
value = sys::SwapByteOrder(value);
reinterpret_cast<detail::alignment_access_helper<value_type, align> *>
(memory)->val = value;
}
template<typename value_type, alignment align>
static value_type read_be(const void *memory) {
value_type t =
reinterpret_cast<const detail::alignment_access_helper
<value_type, align> *>(memory)->val;
if (sys::isLittleEndianHost())
return sys::SwapByteOrder(t);
return t;
}
template<typename value_type, alignment align>
static void write_be(void *memory, value_type value) {
if (sys::isLittleEndianHost())
value = sys::SwapByteOrder(value);
reinterpret_cast<detail::alignment_access_helper<value_type, align> *>
(memory)->val = value;
namespace endian {
template<typename value_type, alignment align>
static value_type read_le(const void *memory) {
value_type t =
reinterpret_cast<const detail::alignment_access_helper
<value_type, align> *>(memory)->val;
if (sys::isBigEndianHost())
return sys::SwapByteOrder(t);
return t;
}
};
template<typename value_type, alignment align>
static void write_le(void *memory, value_type value) {
if (sys::isBigEndianHost())
value = sys::SwapByteOrder(value);
reinterpret_cast<detail::alignment_access_helper<value_type, align> *>
(memory)->val = value;
}
template<typename value_type, alignment align>
static value_type read_be(const void *memory) {
value_type t =
reinterpret_cast<const detail::alignment_access_helper
<value_type, align> *>(memory)->val;
if (sys::isLittleEndianHost())
return sys::SwapByteOrder(t);
return t;
}
template<typename value_type, alignment align>
static void write_be(void *memory, value_type value) {
if (sys::isLittleEndianHost())
value = sys::SwapByteOrder(value);
reinterpret_cast<detail::alignment_access_helper<value_type, align> *>
(memory)->val = value;
}
}
namespace detail {