[llvm] r355504 - Expose template parameters of endian specific types as class members

Pavel Labath via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 6 06:09:02 PST 2019


Author: labath
Date: Wed Mar  6 06:09:02 2019
New Revision: 355504

URL: http://llvm.org/viewvc/llvm-project?rev=355504&view=rev
Log:
Expose template parameters of endian specific types as class members

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

Modified:
    llvm/trunk/include/llvm/Support/Endian.h

Modified: llvm/trunk/include/llvm/Support/Endian.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Endian.h?rev=355504&r1=355503&r2=355504&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Endian.h (original)
+++ llvm/trunk/include/llvm/Support/Endian.h Wed Mar  6 06:09:02 2019
@@ -203,10 +203,14 @@ inline void writeAtBitAlignment(void *me
 
 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; }




More information about the llvm-commits mailing list