1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
/* Generated by Nim Compiler v2.2.0 */
#define NIM_INTBITS 64
#include "nimbase.h"
#include <string.h>
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
typedef int tyArray__NO6udWOtIkldhscb9cksBow[2];
#include <sys/param.h>
#include <sys/sysctl.h>
static N_INLINE(NI, countProcessorsImpl__pureZconcurrencyZcpuinfo_u15)(void);
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1);
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
extern NIM_BOOL nimInErrorMode__system_u4272;
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) {
void* T1_;
T1_ = (void*)0;
T1_ = memset(a_p0, v_p1, ((size_t) (size_p2)));
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (&nimInErrorMode__system_u4272);
return result;
}
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
}
static N_INLINE(NI, countProcessorsImpl__pureZconcurrencyZcpuinfo_u15)(void) {
NI result;
NI* dest;
size_t len;
tyArray__NO6udWOtIkldhscb9cksBow mib;
{ result = (NI)0;
dest = (&result);
len = ((size_t)8);
nimZeroMem((void*)mib, sizeof(tyArray__NO6udWOtIkldhscb9cksBow));
mib[0] = CTL_HW;
mib[1] = HW_NCPU;
{
int T3_;
T3_ = (int)0;
T3_ = sysctl(mib, ((unsigned int)2), ((void*) (dest)), (&len), NIM_NIL, ((size_t)0));
if (!(T3_ == ((NI32)0))) goto LA4_;
goto BeforeRet_;
}
LA4_: ;
{
if (!(result < ((NI)0))) goto LA8_;
result = ((NI)0);
}
LA8_: ;
}BeforeRet_: ;
return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, ncpicountProcessors)(void) {
NI result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
result = (NI)0;
result = countProcessorsImpl__pureZconcurrencyZcpuinfo_u15();
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
return result;
}
|