1//===-- make_signed type_traits ---------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8#ifndef LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_MAKE_SIGNED_H
9#define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_MAKE_SIGNED_H
10
11#include "src/__support/CPP/type_traits/type_identity.h"
12#include "src/__support/macros/properties/types.h" // LIBC_TYPES_HAS_INT128
13
14namespace LIBC_NAMESPACE::cpp {
15
16// make_signed
17template <typename T> struct make_signed;
18template <> struct make_signed<char> : type_identity<char> {};
19template <> struct make_signed<signed char> : type_identity<char> {};
20template <> struct make_signed<short> : type_identity<short> {};
21template <> struct make_signed<int> : type_identity<int> {};
22template <> struct make_signed<long> : type_identity<long> {};
23template <> struct make_signed<long long> : type_identity<long long> {};
24template <> struct make_signed<unsigned char> : type_identity<char> {};
25template <> struct make_signed<unsigned short> : type_identity<short> {};
26template <> struct make_signed<unsigned int> : type_identity<int> {};
27template <> struct make_signed<unsigned long> : type_identity<long> {};
28template <>
29struct make_signed<unsigned long long> : type_identity<long long> {};
30#ifdef LIBC_TYPES_HAS_INT128
31template <> struct make_signed<__int128_t> : type_identity<__int128_t> {};
32template <> struct make_signed<__uint128_t> : type_identity<__int128_t> {};
33#endif
34template <typename T> using make_signed_t = typename make_signed<T>::type;
35
36} // namespace LIBC_NAMESPACE::cpp
37
38#endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_MAKE_SIGNED_H
39

source code of libc/src/__support/CPP/type_traits/make_signed.h