Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow EASTL to be used without floating point types #446

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions include/EASTL/algorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,11 @@ namespace eastl
return b < a ? b : a;
}

#if !defined(EA_COMPILER_NO_FLOATS)
inline EA_CONSTEXPR float min(float a, float b) { return b < a ? b : a; }
inline EA_CONSTEXPR double min(double a, double b) { return b < a ? b : a; }
inline EA_CONSTEXPR long double min(long double a, long double b) { return b < a ? b : a; }
#endif

#endif // EASTL_MINMAX_ENABLED

Expand All @@ -482,9 +484,11 @@ namespace eastl
return b < a ? b : a;
}

#if !defined(EA_COMPILER_NO_FLOATS)
inline EA_CONSTEXPR float min_alt(float a, float b) { return b < a ? b : a; }
inline EA_CONSTEXPR double min_alt(double a, double b) { return b < a ? b : a; }
inline EA_CONSTEXPR long double min_alt(long double a, long double b) { return b < a ? b : a; }
#endif


#if EASTL_MINMAX_ENABLED
Expand Down Expand Up @@ -568,9 +572,11 @@ namespace eastl
return a < b ? b : a;
}

#if !defined(EA_COMPILER_NO_FLOATS)
inline EA_CONSTEXPR float max(float a, float b) { return a < b ? b : a; }
inline EA_CONSTEXPR double max(double a, double b) { return a < b ? b : a; }
inline EA_CONSTEXPR long double max(long double a, long double b) { return a < b ? b : a; }
#endif

#endif // EASTL_MINMAX_ENABLED

Expand All @@ -594,9 +600,11 @@ namespace eastl
return a < b ? b : a;
}

#if !defined(EA_COMPILER_NO_FLOATS)
inline EA_CONSTEXPR float max_alt(float a, float b) { return a < b ? b : a; }
inline EA_CONSTEXPR double max_alt(double a, double b) { return a < b ? b : a; }
inline EA_CONSTEXPR long double max_alt(long double a, long double b) { return a < b ? b : a; }
#endif


#if EASTL_MINMAX_ENABLED
Expand Down
3 changes: 2 additions & 1 deletion include/EASTL/numeric_limits.h
Original file line number Diff line number Diff line change
Expand Up @@ -1333,6 +1333,7 @@ namespace eastl
#endif


#if !defined(EA_COMPILER_NO_FLOATS)
// numeric_limits<float>
template<>
struct numeric_limits<float>
Expand Down Expand Up @@ -1450,7 +1451,6 @@ namespace eastl
#endif
};


// numeric_limits<double>
template<>
struct numeric_limits<double>
Expand Down Expand Up @@ -1685,6 +1685,7 @@ namespace eastl

#endif
};
#endif

} // namespace eastl

Expand Down
5 changes: 5 additions & 0 deletions source/hashtable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// Copyright (c) Electronic Arts Inc. All rights reserved.
///////////////////////////////////////////////////////////////////////////////

#include <EABase/config/eacompiler.h>

#if !defined(EA_COMPILER_NO_FLOATS)

#include <EASTL/internal/hashtable.h>
#include <EASTL/utility.h>
Expand Down Expand Up @@ -175,3 +178,5 @@ namespace eastl
} // namespace eastl

EA_RESTORE_VC_WARNING();

#endif
3 changes: 3 additions & 0 deletions source/numeric_limits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,8 @@
EA_CONSTEXPR_OR_CONST bool numeric_limits<__int128_t>::is_iec559;
#endif


#if !defined(EA_COMPILER_NO_FLOATS)
// float
EA_CONSTEXPR_OR_CONST bool numeric_limits<float>::is_specialized;
EA_CONSTEXPR_OR_CONST int numeric_limits<float>::digits;
Expand Down Expand Up @@ -564,6 +566,7 @@
EA_CONSTEXPR_OR_CONST float_denorm_style numeric_limits<long double>::has_denorm;
EA_CONSTEXPR_OR_CONST bool numeric_limits<long double>::has_denorm_loss;
EA_CONSTEXPR_OR_CONST bool numeric_limits<long double>::is_iec559;
#endif

} // namespace eastl

Expand Down