mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
36 lines
761 B
C++
36 lines
761 B
C++
/*
|
|
* @Author: DI JUNKUN
|
|
* @Date: 2025-01-14
|
|
* Copyright (c) 2025 by DI JUNKUN, All Rights Reserved.
|
|
*/
|
|
|
|
#ifndef _LIMITS_BASE_H_
|
|
#define _LIMITS_BASE_H_
|
|
|
|
#include <limits>
|
|
|
|
template <typename T>
|
|
bool IsInfinite(const T& value) {
|
|
return value == std::numeric_limits<T>::min() ||
|
|
value == std::numeric_limits<T>::max();
|
|
}
|
|
|
|
template <typename T>
|
|
bool IsFinite(const T& value) {
|
|
return !IsInfinite(value);
|
|
}
|
|
|
|
template <typename T>
|
|
bool IsPlusFinite(const T& value) {
|
|
return value == std::numeric_limits<T>::max();
|
|
}
|
|
|
|
template <typename T>
|
|
bool IsMinusFinite(const T& value) {
|
|
return value == std::numeric_limits<T>::min();
|
|
}
|
|
|
|
#define INT64_T_MAX std::numeric_limits<int64_t>::max()
|
|
#define INT64_T_MIN std::numeric_limits<int64_t>::min()
|
|
|
|
#endif |