]> granicus.if.org Git - llvm/commitdiff
Expose template parameters of endian specific types as class members
authorPavel Labath <pavel@labath.sk>
Wed, 6 Mar 2019 14:09:02 +0000 (14:09 +0000)
committerPavel Labath <pavel@labath.sk>
Wed, 6 Mar 2019 14:09:02 +0000 (14:09 +0000)
Summary:
This allows generic code to query these parameters, and is a common
practice in a lot of other template classes.

Reviewers: zturner, Bigcheese

Subscribers: kristina, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D58969

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355504 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/Endian.h

index a0632bbc4b5815f2c9c7f19ae07ac7063dc2d414..5c1e89ae793643bf06396a88f5a927a0813d690d 100644 (file)
@@ -203,10 +203,14 @@ inline void writeAtBitAlignment(void *memory, value_type value,
 
 namespace detail {
 
-template<typename value_type,
-         endianness endian,
-         std::size_t alignment>
+template<typename ValueType,
+         endianness Endian,
+         std::size_t Alignment>
 struct packed_endian_specific_integral {
+  using value_type = ValueType;
+  static constexpr endianness endian = Endian;
+  static constexpr std::size_t alignment = Alignment;
+
   packed_endian_specific_integral() = default;
 
   explicit packed_endian_specific_integral(value_type val) { *this = val; }