Skip to content

Commit ba8d726

Browse files
authored
api(fmath.h): make degrees and radians constexpr (#5151)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
1 parent 7835091 commit ba8d726

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/include/OpenImageIO/fmath.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,11 +615,15 @@ inline simd::vfloat16 floorfrac (const simd::vfloat16& x, simd::vint16 *xint) {
615615

616616
/// Convert degrees to radians.
617617
template <typename T>
618-
OIIO_FORCEINLINE OIIO_HOSTDEVICE T radians (T deg) { return deg * T(M_PI / 180.0); }
618+
OIIO_FORCEINLINE OIIO_HOSTDEVICE constexpr T radians (T deg) {
619+
return deg * T(M_PI / 180.0);
620+
}
619621

620622
/// Convert radians to degrees
621623
template <typename T>
622-
OIIO_FORCEINLINE OIIO_HOSTDEVICE T degrees (T rad) { return rad * T(180.0 / M_PI); }
624+
OIIO_FORCEINLINE OIIO_HOSTDEVICE constexpr T degrees (T rad) {
625+
return rad * T(180.0 / M_PI);
626+
}
623627

624628

625629
/// Faster floating point negation, in cases where you aren't too picky

0 commit comments

Comments
 (0)