summaryrefslogtreecommitdiff
path: root/boost/endian/detail/integral_by_size.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/endian/detail/integral_by_size.hpp')
-rw-r--r--boost/endian/detail/integral_by_size.hpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/boost/endian/detail/integral_by_size.hpp b/boost/endian/detail/integral_by_size.hpp
new file mode 100644
index 0000000000..b0fd8856d9
--- /dev/null
+++ b/boost/endian/detail/integral_by_size.hpp
@@ -0,0 +1,47 @@
+#ifndef BOOST_ENDIAN_DETAIL_INTEGRAL_BY_SIZE_HPP_INCLUDED
+#define BOOST_ENDIAN_DETAIL_INTEGRAL_BY_SIZE_HPP_INCLUDED
+
+// Copyright 2019 Peter Dimov
+//
+// Distributed under the Boost Software License, Version 1.0.
+// http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/cstdint.hpp>
+#include <cstddef>
+
+namespace boost
+{
+namespace endian
+{
+namespace detail
+{
+
+template<std::size_t N> struct integral_by_size
+{
+};
+
+template<> struct integral_by_size<1>
+{
+ typedef uint8_t type;
+};
+
+template<> struct integral_by_size<2>
+{
+ typedef uint16_t type;
+};
+
+template<> struct integral_by_size<4>
+{
+ typedef uint32_t type;
+};
+
+template<> struct integral_by_size<8>
+{
+ typedef uint64_t type;
+};
+
+} // namespace detail
+} // namespace endian
+} // namespace boost
+
+#endif // BOOST_ENDIAN_DETAIL_INTEGRAL_BY_SIZE_HPP_INCLUDED