run-time assertion in ms c: make sure that CPP macro and local variable `LOOPS == loops`

pull/14/head
despair86 6 years ago
parent 7af9ed0f70
commit 9b73b013ce

@ -2,6 +2,9 @@
#include "mod3.h"
#include "swap.h"
#include "r3.h"
#ifdef _MSC_VER
#include <assert.h>
#endif
/* caller must ensure that x-y does not overflow */
static int smaller_mask(int x,int y)
@ -41,6 +44,8 @@ int r3_recip(small *r,const small *s)
small f[p + 1];
small g[p + 1];
#ifdef _MSC_VER
/* TODO(despair): make this a compile-time assertion */
assert(LOOPS == loops);
small u[LOOPS + 1];
small v[LOOPS + 1];
#else

@ -1,6 +1,9 @@
#include "params.h"
#include "swap.h"
#include "rq.h"
#ifdef _MSC_VER
#include <assert.h>
#endif
/* caller must ensure that x-y does not overflow */
static int smaller_mask(int x,int y)
@ -40,6 +43,8 @@ int rq_recip3(modq *r,const small *s)
modq f[p + 1];
modq g[p + 1];
#ifdef _MSC_VER
/* TODO(despair): make this a compile-time assertion */
assert(LOOPS == loops);
modq u[LOOPS + 1];
modq v[LOOPS + 1];
#else

@ -528,6 +528,7 @@ SetThreadName(DWORD dwThreadID, LPCSTR szThreadName)
/* current win10 flights now have a new named-thread API, let's try to use
* that first! */
/* first, dlsym(2) the new call from system library */
hThread = NULL;
_SetThreadDescription = (p_SetThreadDescription)GetProcAddress(
GetModuleHandle("kernel32"), "SetThreadDescription");
if(_SetThreadDescription)
@ -558,5 +559,7 @@ SetThreadName(DWORD dwThreadID, LPCSTR szThreadName)
{
}
}
if(hThread)
CloseHandle(hThread);
}
#endif
Loading…
Cancel
Save