From a49e7b7e40127beba25f39ef3c10d7a77e2bb0f0 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Tue, 3 Nov 2015 18:49:34 +0800 Subject: [PATCH] MSVC builds: Add fallback implementation for pre-2013 MSVC Pre-2013 MSVC does not have scalbn() and scalbnf(), which are used in the utility programs. Add fallback implementations for these, which can be used when necessary. --- util/options.hh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/util/options.hh b/util/options.hh index 1ef4131ee..919e4f8b2 100644 --- a/util/options.hh +++ b/util/options.hh @@ -474,5 +474,22 @@ struct format_options_t : option_group_t hb_bool_t show_extents; }; +/* fallback implementation for scalbn()/scalbnf() for pre-2013 MSVC */ +#if defined (_MSC_VER) && (_MSC_VER < 1800) + +#ifndef FLT_RADIX +#define FLT_RADIX 2 +#endif + +__inline long double scalbn (long double x, int exp) +{ + return x * (pow ((long double) FLT_RADIX, exp)); +} + +__inline float scalbnf (float x, int exp) +{ + return x * (pow ((float) FLT_RADIX, exp)); +} +#endif #endif