build: fix on MSVC 2013

This commit is contained in:
Eric Wasylishen 2016-10-17 19:25:27 -07:00
parent a6468984bf
commit cefadfa1f4
3 changed files with 9 additions and 6 deletions

View File

@ -29,7 +29,7 @@
#include <common/threads.hh>
static FILE *logfile;
static _Bool log_ok;
static bool log_ok;
void
init_log(const char *filename)

View File

@ -16,7 +16,7 @@ void Error(const char *error, ...)
__attribute__((format(printf,1,2),noreturn));
/* Make the locks no-ops if we aren't running threads */
static _Bool threads_active = false;
static bool threads_active = false;
static int dispatch;
static int workcount;
@ -128,8 +128,8 @@ RunThreadsOn(int start, int workcnt, void *(func)(void *), void *arg)
workcount = workcnt;
oldpercent = -1;
threadid = malloc(sizeof(*threadid) * numthreads);
threadhandle = malloc(sizeof(*threadhandle) * numthreads);
threadid = static_cast<DWORD *>(malloc(sizeof(*threadid) * numthreads));
threadhandle = static_cast<HANDLE *>(malloc(sizeof(*threadhandle) * numthreads));
if (!threadid || !threadhandle)
Error("Failed to allocate memory for threads");

View File

@ -28,6 +28,7 @@
#if !defined(ffsl) && defined(__GNUC__)
#define ffsl __builtin_ffsl
#elif defined(WIN32)
#include <intrin.h>
inline int ffsl(long int val)
{
unsigned long indexout;
@ -48,9 +49,11 @@ typedef struct {
leafblock_t bits[]; /* Variable Sized */
} leafbits_t;
int __ERRORLONGSIZE(void); /* to generate an error at link time */
#define QBYTESHIFT(x) ((x) == 8 ? 6 : ((x) == 4 ? 5 : __ERRORLONGSIZE() ))
#define QBYTESHIFT(x) ((x) == 8 ? 6 : ((x) == 4 ? 5 : 0 ))
#define LEAFSHIFT QBYTESHIFT(sizeof(leafblock_t))
static_assert(LEAFSHIFT != 0, "unsupported sizeof(unsigned long)");
#define LEAFMASK ((sizeof(leafblock_t) << 3) - 1UL)
static inline int