diff options
author | Hieu Hoang <fishandfrolick@gmail.com> | 2012-07-10 13:05:14 +0400 |
---|---|---|
committer | Hieu Hoang <fishandfrolick@gmail.com> | 2012-07-10 13:05:14 +0400 |
commit | f335047981d6dd43c36a7d58e8e911cc959be4e9 (patch) | |
tree | fd386c3fc9398a574116080c16287d1537699f52 /lm | |
parent | f40f6393f3689e27b46beb5d106ffc3617857b4a (diff) |
windows-compatible. Thanks to Mike Lagwig
Diffstat (limited to 'lm')
-rw-r--r-- | lm/read_arpa.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lm/read_arpa.cc b/lm/read_arpa.cc index 50d933c83..70727e4cb 100644 --- a/lm/read_arpa.cc +++ b/lm/read_arpa.cc @@ -11,6 +11,10 @@ #include <string.h> #include <stdint.h> +#ifdef WIN32 +#include <float.h> +#endif + namespace lm { // 1 for '\t', '\n', and ' '. This is stricter than isspace. @@ -95,8 +99,13 @@ void ReadBackoff(util::FilePiece &in, float &backoff) { backoff = in.ReadFloat(); if (backoff == ngram::kExtensionBackoff) backoff = ngram::kNoExtensionBackoff; { +#ifdef WIN32 + int float_class = _fpclass(backoff); + UTIL_THROW_IF(float_class == _FPCLASS_SNAN || float_class == _FPCLASS_QNAN || float_class == _FPCLASS_NINF || float_class == _FPCLASS_PINF, FormatLoadException, "Bad backoff " << backoff); +#else int float_class = fpclassify(backoff); UTIL_THROW_IF(float_class == FP_NAN || float_class == FP_INFINITE, FormatLoadException, "Bad backoff " << backoff); +#endif } UTIL_THROW_IF(in.get() != '\n', FormatLoadException, "Expected newline after backoff"); break; |