Skip to content

Commit

Permalink
[omg] Use template specialization for SignalingNan()
Browse files Browse the repository at this point in the history
  • Loading branch information
PiaNumworks authored and GabrielNumworks committed Apr 3, 2023
1 parent 5ab066d commit 64b8572
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions omg/src/signaling_nan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace OMG {

template <typename T>
T SignalingNan() {
return sizeof(T) == sizeof(float) ? static_cast<T>(k_sNanFloat.f)
: static_cast<T>(k_sNanDouble.d);
template <>
float SignalingNan<float>() {
return k_sNanFloat.f;
}
template <>
double SignalingNan<double>() {
return k_sNanDouble.d;
}

template float SignalingNan<float>();
template double SignalingNan<double>();

} // namespace OMG

0 comments on commit 64b8572

Please sign in to comment.