Commit 6dca2b32 authored by Tudor Bosman's avatar Tudor Bosman

(minor changes, part of unrelated diff)

Test Plan: no

Reviewed By: philipp@fb.com

FB internal diff: D512868
parent 53d4209f
...@@ -528,8 +528,6 @@ BitIterator<BaseIter> findFirstSet(BitIterator<BaseIter> begin, ...@@ -528,8 +528,6 @@ BitIterator<BaseIter> findFirstSet(BitIterator<BaseIter> begin,
} }
namespace detail {
template <class T, class Enable=void> struct Unaligned; template <class T, class Enable=void> struct Unaligned;
template <class T> template <class T>
...@@ -539,15 +537,13 @@ struct Unaligned< ...@@ -539,15 +537,13 @@ struct Unaligned<
T value; T value;
} __attribute__((packed)); } __attribute__((packed));
} // namespace detail
/** /**
* Read an unaligned value of type T and return it. * Read an unaligned value of type T and return it.
*/ */
template <class T> template <class T>
inline T loadUnaligned(const void* p) { inline T loadUnaligned(const void* p) {
static_assert(alignof(detail::Unaligned<T>) == 1, "Invalid alignment"); static_assert(alignof(Unaligned<T>) == 1, "Invalid alignment");
return static_cast<const detail::Unaligned<T>*>(p)->value; return static_cast<const Unaligned<T>*>(p)->value;
} }
/** /**
...@@ -555,8 +551,8 @@ inline T loadUnaligned(const void* p) { ...@@ -555,8 +551,8 @@ inline T loadUnaligned(const void* p) {
*/ */
template <class T> template <class T>
inline void storeUnaligned(void* p, T value) { inline void storeUnaligned(void* p, T value) {
static_assert(alignof(detail::Unaligned<T>) == 1, "Invalid alignment"); static_assert(alignof(Unaligned<T>) == 1, "Invalid alignment");
static_cast<detail::Unaligned<T>*>(p)->value = value; static_cast<Unaligned<T>*>(p)->value = value;
} }
} // namespace folly } // namespace folly
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment