fix Win32 build regressions

Date: Wed, 15 Aug 2012 15:59:25 -0700 (PDT)
From: Gernot Kvas <gernot.kvas@gmail.com>
Reply-To: avian@googlegroups.com
To: avian@googlegroups.com
Subject: Win32 build regression

Hi,

As I've forked on the July 19th and haven't updated since, I decided to
merge master into my WinCE branch. I found out that the following commits
have introduced build regressions on Windows:

1.)https://github.com/ReadyTalk/avian/commit/5a7c78e71ac7b4045c23d215162fb1284
8f1a5f3

=> strncasecmp is undefined for Windows

2.)https://github.com/ReadyTalk/avian/commit/b98abe3f94dbf552595554787ef2115c3
009856c

=> fpclassify and related constants are undefined for Windows

3.)https://github.com/ReadyTalk/avian/commit/20a290b992112f9b376d3a8d0180c1cca
8dd21e2

=> signbit is undefined for Windows

I attached a patch that makes everything build through (within Visual
Studio, the makefile still fails)
This commit is contained in:
Gernot Kvas 2012-08-15 17:27:27 -06:00 committed by Joel Dice
parent 127d56d0fe
commit ff9757e811

View File

@ -25,6 +25,8 @@
#ifdef _MSC_VER
#include "float.h"
// don't complain about using 'this' in member initializers:
# pragma warning(disable:4355)
@ -37,6 +39,34 @@ typedef unsigned int uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#define strncasecmp _strnicmp
#define FP_NAN 0
#define FP_INFINITE 1
#define FP_UNDEF 2
inline int fpclassify(double d) {
switch(_fpclass(d)) {
case _FPCLASS_SNAN:
case _FPCLASS_QNAN:
return FP_NAN;
case _FPCLASS_PINF:
case _FPCLASS_NINF:
return FP_INFINITE;
}
return FP_UNDEF;
}
#define INT32_MIN ((int32_t) _I32_MIN)
#define INT32_MAX _I32_MAX
#define INT64_MIN ((int64_t) _I64_MIN)
#define INT64_MAX _I64_MAX
inline int signbit(double d) {
return _copysign(1.0, d) < 0;
}
# define not !
# define or ||
# define and &&