xo-unit: move wdith2x helper template to own .hpp file

This commit is contained in:
Roland Conybeare 2024-05-03 18:43:35 -04:00
commit cfdf380c05
2 changed files with 40 additions and 22 deletions

View file

@ -5,7 +5,7 @@
#pragma once #pragma once
#include "natural_unit.hpp" #include "width2x.hpp"
namespace xo { namespace xo {
namespace qty { namespace qty {
@ -55,27 +55,6 @@ namespace xo {
} }
namespace detail { namespace detail {
template <typename Int>
struct width2x;
template <>
struct width2x<std::int16_t> {
using type = std::int32_t;
};
template <>
struct width2x<std::int32_t> {
using type = std::int64_t;
};
template <>
struct width2x<std::int64_t> {
using type = __int128_t;
};
template <typename Int>
using width2x_t = width2x<Int>::type;
template <typename Int, template <typename Int,
typename Int2x = width2x<Int>, typename Int2x = width2x<Int>,
typename OuterScale = ratio::ratio<Int2x>> typename OuterScale = ratio::ratio<Int2x>>

View file

@ -0,0 +1,39 @@
/** @file width2x.hpp
*
* Author: Roland Conybeare
**/
#pragma once
#include "natural_unit.hpp"
#include <cstdint>
namespace xo {
namespace qty {
namespace detail {
template <typename Int>
struct width2x;
template <>
struct width2x<std::int16_t> {
using type = std::int32_t;
};
template <>
struct width2x<std::int32_t> {
using type = std::int64_t;
};
template <>
struct width2x<std::int64_t> {
using type = __int128_t;
};
template <typename Int>
using width2x_t = width2x<Int>::type;
}
} /*namespace qty*/
} /*namespace xo*/
/** end width2x.hpp **/