cai_lw's competitive programming library
 
Loading...
Searching...
No Matches
type.hpp
1#pragma once
2
3#include <cstdint>
4
5namespace cplib::impl {
6
7template <typename T>
8struct make_double_width {};
9template <>
10struct make_double_width<uint8_t> {
11 using type = uint16_t;
12};
13template <>
14struct make_double_width<uint16_t> {
15 using type = uint32_t;
16};
17template <>
18struct make_double_width<uint32_t> {
19 using type = uint64_t;
20};
21template <>
22struct make_double_width<uint64_t> {
23 using type = unsigned __int128;
24};
25template <>
26struct make_double_width<unsigned long long> {
27 using type = unsigned __int128;
28};
29template <>
30struct make_double_width<int8_t> {
31 using type = int16_t;
32};
33template <>
34struct make_double_width<int16_t> {
35 using type = int32_t;
36};
37template <>
38struct make_double_width<int32_t> {
39 using type = int64_t;
40};
41template <>
42struct make_double_width<int64_t> {
43 using type = __int128;
44};
45template <>
46struct make_double_width<long long> {
47 using type = __int128;
48};
49
50template <typename T>
51using make_double_width_t = typename make_double_width<T>::type;
52
53} // namespace cplib::impl