[libdivide] Make all inline function constexpr Change-Id: I7a987e0859444515a6e5d31c4115f28035456811
diff --git a/libdivide.h b/libdivide.h index 4d0720a..23f8119 100644 --- a/libdivide.h +++ b/libdivide.h
@@ -98,14 +98,14 @@ // We need both the attribute and keyword to avoid "might not be inlineable" warnings. #ifdef __has_attribute #if __has_attribute(always_inline) -#define LIBDIVIDE_INLINE __attribute__((always_inline)) inline +#define LIBDIVIDE_INLINE constexpr __attribute__((always_inline)) inline #endif #endif #ifndef LIBDIVIDE_INLINE #ifdef _MSC_VER -#define LIBDIVIDE_INLINE __forceinline +#define LIBDIVIDE_INLINE constexpr __forceinline #else -#define LIBDIVIDE_INLINE inline +#define LIBDIVIDE_INLINE constexpr inline #endif #endif @@ -139,7 +139,7 @@ // Use https://en.cppreference.com/w/cpp/feature_test#cpp_constexpr #if defined(__cpp_constexpr) && (__cpp_constexpr >= 201304L) -#define LIBDIVIDE_CONSTEXPR constexpr LIBDIVIDE_INLINE +#define LIBDIVIDE_CONSTEXPR LIBDIVIDE_INLINE // Supposedly, MSVC might not implement feature test macros right: // https://stackoverflow.com/questions/49316752/feature-test-macros-not-working-properly-in-visual-c @@ -147,7 +147,7 @@ // 2017 15.0 (for extended constexpr support: // https://learn.microsoft.com/en-us/cpp/overview/visual-cpp-language-conformance?view=msvc-170) #elif (defined(_MSC_VER) && _MSC_VER >= 1910) && (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) -#define LIBDIVIDE_CONSTEXPR constexpr LIBDIVIDE_INLINE +#define LIBDIVIDE_CONSTEXPR LIBDIVIDE_INLINE #else #define LIBDIVIDE_CONSTEXPR LIBDIVIDE_INLINE