added fallback match::log2() code for platforms lacking log2
This commit is contained in:
parent
a7bc6a6eb2
commit
36db3c8623
@ -239,7 +239,7 @@ typedef enum qse_bool_t qse_bool_t;
|
|||||||
typedef __uint16_t qse_uint16_t;
|
typedef __uint16_t qse_uint16_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef QSE_HAVE_INT16_T
|
#if defined(QSE_HAVE_INT16_T)
|
||||||
# define QSE_SIZEOF_INT16_T 2
|
# define QSE_SIZEOF_INT16_T 2
|
||||||
# define QSE_SIZEOF_UINT16_T 2
|
# define QSE_SIZEOF_UINT16_T 2
|
||||||
# undef QSE_SIZEOF_INTMAX_T
|
# undef QSE_SIZEOF_INTMAX_T
|
||||||
@ -279,7 +279,7 @@ typedef enum qse_bool_t qse_bool_t;
|
|||||||
typedef __uint32_t qse_uint32_t;
|
typedef __uint32_t qse_uint32_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef QSE_HAVE_INT32_T
|
#if defined(QSE_HAVE_INT32_T)
|
||||||
# define QSE_SIZEOF_INT32_T 4
|
# define QSE_SIZEOF_INT32_T 4
|
||||||
# define QSE_SIZEOF_UINT32_T 4
|
# define QSE_SIZEOF_UINT32_T 4
|
||||||
# undef QSE_SIZEOF_INTMAX_T
|
# undef QSE_SIZEOF_INTMAX_T
|
||||||
@ -324,7 +324,7 @@ typedef enum qse_bool_t qse_bool_t;
|
|||||||
typedef __uint64_t qse_uint64_t;
|
typedef __uint64_t qse_uint64_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef QSE_HAVE_INT64_T
|
#if defined(QSE_HAVE_INT64_T)
|
||||||
# define QSE_SIZEOF_INT64_T 8
|
# define QSE_SIZEOF_INT64_T 8
|
||||||
# define QSE_SIZEOF_UINT64_T 8
|
# define QSE_SIZEOF_UINT64_T 8
|
||||||
# undef QSE_SIZEOF_INTMAX_T
|
# undef QSE_SIZEOF_INTMAX_T
|
||||||
@ -363,7 +363,7 @@ typedef enum qse_bool_t qse_bool_t;
|
|||||||
typedef __uint128_t qse_uint128_t;
|
typedef __uint128_t qse_uint128_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef QSE_HAVE_INT128_T
|
#if defined(QSE_HAVE_INT128_T)
|
||||||
# define QSE_SIZEOF_INT128_T 16
|
# define QSE_SIZEOF_INT128_T 16
|
||||||
# define QSE_SIZEOF_UINT128_T 16
|
# define QSE_SIZEOF_UINT128_T 16
|
||||||
# undef QSE_SIZEOF_INTMAX_T
|
# undef QSE_SIZEOF_INTMAX_T
|
||||||
|
@ -359,7 +359,7 @@ static qse_awk_flt_t math_atan2 (qse_awk_t* awk, qse_awk_flt_t x, qse_awk_flt_t
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static qse_awk_flt_t math_log (qse_awk_t* awk, qse_awk_flt_t x)
|
static QSE_INLINE qse_awk_flt_t math_log (qse_awk_t* awk, qse_awk_flt_t x)
|
||||||
{
|
{
|
||||||
#if defined(QSE_USE_AWK_FLTMAX) && defined(HAVE_LOGQ)
|
#if defined(QSE_USE_AWK_FLTMAX) && defined(HAVE_LOGQ)
|
||||||
return logq (x);
|
return logq (x);
|
||||||
@ -385,7 +385,7 @@ static qse_awk_flt_t math_log2 (qse_awk_t* awk, qse_awk_flt_t x)
|
|||||||
#elif defined(HAVE_LOG2F)
|
#elif defined(HAVE_LOG2F)
|
||||||
return log2f (x);
|
return log2f (x);
|
||||||
#else
|
#else
|
||||||
#error ### no log2 function available ###
|
return math_log(x) / math_log(2.0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user