| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // | ||
| 2 | // Copyright 2021 Minoru Sekine | ||
| 3 | // | ||
| 4 | // This file is part of libsatop. | ||
| 5 | // | ||
| 6 | // libsatop is free software: you can redistribute it and/or modify | ||
| 7 | // it under the terms of the GNU Lesser General Public License as published by | ||
| 8 | // the Free Software Foundation, either version 3 of the License, or | ||
| 9 | // (at your option) any later version. | ||
| 10 | // | ||
| 11 | // libsatop is distributed in the hope that it will be useful, | ||
| 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | // GNU Lesser General Public License for more details. | ||
| 15 | // | ||
| 16 | // You should have received a copy of the GNU Lesser General Public License | ||
| 17 | // along with libsatop. If not, see <http://www.gnu.org/licenses/>. | ||
| 18 | |||
| 19 | #ifndef INCLUDE_SATOP_SIGN_UTIL_PRIV_H_ | ||
| 20 | #define INCLUDE_SATOP_SIGN_UTIL_PRIV_H_ | ||
| 21 | |||
| 22 | #ifndef SATOP_INTERNAL | ||
| 23 | #error Do not include this file directly, libsatop.h instead. | ||
| 24 | #endif | ||
| 25 | |||
| 26 | #include <type_traits> | ||
| 27 | |||
| 28 | namespace saturated { | ||
| 29 | |||
| 30 | namespace impl { | ||
| 31 | |||
| 32 | template <typename T> | ||
| 33 | 168 | constexpr bool csignbit(T value) { | |
| 34 | 168 | return (std::is_signed<T>::value && (value < 0)); | |
| 35 | } | ||
| 36 | |||
| 37 | } // namespace impl | ||
| 38 | |||
| 39 | } // namespace saturated | ||
| 40 | |||
| 41 | #endif // INCLUDE_SATOP_SIGN_UTIL_PRIV_H_ | ||
| 42 |