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.
This commit is contained in:
Chun-wei Fan 2015-11-03 18:49:34 +08:00
parent 998e8dda93
commit a49e7b7e40
1 changed files with 17 additions and 0 deletions

View File

@ -474,5 +474,22 @@ struct format_options_t : option_group_t
hb_bool_t show_extents; 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 #endif