Skip to content

Commit

Permalink
fix: std::abs freestanding compilation issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
mpusz committed Nov 26, 2024
1 parent 781aa84 commit 52b003e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/include/mp-units/framework/representation_concepts.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,11 @@ struct magnitude_t {
else if constexpr (requires { abs(vec); })
return abs(vec);
else if constexpr (std::is_arithmetic_v<T> && (!is_same_v<T, bool>))
#if MP_UNITS_HOSTED || __cpp_lib_freestanding_cstdlib >= 202306L
return std::abs(vec);
#else
return vec >= 0 ? vec : -vec;
#endif
}
}
};
Expand Down

0 comments on commit 52b003e

Please sign in to comment.