13#ifndef ML_UTILS_SYSTEM_H
14#define ML_UTILS_SYSTEM_H
30#if !defined(MEVIS_TARGET)
31# error "The compiler definition MEVIS_TARGET is not set! It must specify the name of the compiled executable (without _d etc.)"
41#ifndef ML_UTILS_NAMESPACE
42#define ML_UTILS_NAMESPACE ml
48#ifndef ML_UTILS_START_NAMESPACE
49#define ML_UTILS_START_NAMESPACE namespace ML_UTILS_NAMESPACE {
53#ifndef ML_UTILS_END_NAMESPACE
54#define ML_UTILS_END_NAMESPACE }
60ML_UTILS_START_NAMESPACE
71template<
typename T>
T mlMin(
T a,
T b){
return a < b ? a : b; }
75template<
typename T>
T mlMax(
T a,
T b){
return a > b ? a : b; }
78 #pragma GCC diagnostic push
80 #pragma GCC diagnostic ignored "-Wsign-conversion"
84template<
typename T>
T mlAbs(
T a){
if constexpr (std::is_signed<T>::value)
return a < 0 ? -a : a;
else return a; }
88 #pragma GCC diagnostic pop
105#include <ThirdPartyWarningsDisable.h>
107#include <ThirdPartyWarningsRestore.h>
109inline long double pow( __int64 i,
int value) {
return pow(
static_cast<long double>(i),
static_cast<long double>(value)); }
110inline long double pow(
unsigned __int64 i,
int value) {
return pow(
static_cast<long double>(i),
static_cast<long double>(value)); }
111inline long double pow( __int64 i,
float value) {
return pow(
static_cast<long double>(i),
static_cast<long double>(value)); }
112inline long double pow(
unsigned __int64 i,
float value) {
return pow(
static_cast<long double>(i),
static_cast<long double>(value)); }
113inline long double pow( __int64 i,
double value) {
return pow(
static_cast<long double>(i),
static_cast<long double>(value)); }
114inline long double pow(
unsigned __int64 i,
double value) {
return pow(
static_cast<long double>(i),
static_cast<long double>(value)); }
115inline long double pow( __int64 i,
long double value) {
return pow(
static_cast<long double>(i),
static_cast<long double>(value)); }
116inline long double pow(
unsigned __int64 i,
long double value) {
return pow(
static_cast<long double>(i),
static_cast<long double>(value)); }
118inline unsigned __int64
abs (
unsigned __int64 i) {
return i; }
119inline long double fabs( __int64 i) {
return static_cast<long double>(i < 0 ? -i : i); }
120inline long double fabs(
unsigned __int64 i) {
return static_cast<long double>(i); }
122inline double pow (
float f,
double d ) {
return pow(
static_cast<double>(f), d); }
123inline double pow (
double d,
float f ) {
return pow(d,
static_cast<double>(f)); }
124inline double pow (
double d,
unsigned int i ) {
return pow(d,
static_cast<double>(i)); }
125inline long double pow (
double d, __int64 i ) {
return pow(
static_cast<long double>(d),
static_cast<long double>(i)); }
126inline long double pow (
double d,
unsigned __int64 i ) {
return pow(
static_cast<long double>(d),
static_cast<long double>(i)); }
127inline long double pow (
double d,
long double ld) {
return pow(
static_cast<long double>(d), ld); }
128inline long double pow (
long double ld,
double d ) {
return pow(ld,
static_cast<long double>(d)); }
130template <
typename T>
inline double atan (
T value) {
return atan (
static_cast<double>(value)); }
131template <
typename T>
inline double ceil (
T value) {
return ceil (
static_cast<double>(value)); }
132template <
typename T>
inline double exp (
T value) {
return exp (
static_cast<double>(value)); }
133template <
typename T>
inline double fabs (
T value) {
return fabs (
static_cast<double>(value)); }
134template <
typename T>
inline double floor(
T value) {
return floor(
static_cast<double>(value)); }
135template <
typename T>
inline double log (
T value) {
return log (
static_cast<double>(value)); }
136template <
typename T>
inline double sqrt (
T value) {
return sqrt (
static_cast<double>(value)); }
137template <
typename T>
inline double pow (
int i,
T value) {
return pow (
static_cast<double>(i), value); }
138template <
typename T>
inline double pow (
unsigned int i,
T value) {
return pow (
static_cast<double>(i), value); }
139template <
typename T>
inline long double pow ( __int64 i,
T value) {
return pow (
static_cast<long double>(i),
static_cast<long double>(value)); }
140template <
typename T>
inline long double pow (
unsigned __int64 i,
T value) {
return pow (
static_cast<long double>(i),
static_cast<long double>(value)); }
153#define ML_TYPENAME typename
unsigned __int64 abs(unsigned __int64 i)
long double fabs(__int64 i)
long double pow(__int64 i, int value)
T mlAbs(T a)
Defines ML specific abs template since only type-dependent library functions exists.
T mlMax(T a, T b)
Defines ML specific max template since max template is platform-dependent.
T mlMin(T a, T b)
Defines ML specific min template since min template is platform-dependent.