1 /* Generated by Nim Compiler v1.6.2 */
2 #define NIM_INTBITS 64
3
4 #include "nimbase.h"
5 #include <string.h>
6 #undef LANGUAGE_C
7 #undef MIPSEB
8 #undef MIPSEL
9 #undef PPC
10 #undef R3000
11 #undef R4000
12 #undef i386
13 #undef linux
14 #undef mips
15 #undef near
16 #undef far
17 #undef powerpc
18 #undef unix
19 #define nimfr_(x, y)
20 #define nimln_(x, y)
21 typedef int tyArray__VR9bNthWayFgb5M9avIR8bkA[4];
22 #include <sys/types.h>
23 #include <sys/sysctl.h>
24 static N_INLINE(void, nimZeroMem)(void* p, NI size);
25 static N_INLINE(void, nimSetMem__systemZmemory_7)(void* a, int v, NI size);
N_INLINE(void,nimSetMem__systemZmemory_7)26 static N_INLINE(void, nimSetMem__systemZmemory_7)(void* a, int v, NI size) {
27 void* T1_;
28 T1_ = (void*)0;
29 T1_ = memset(a, v, ((size_t) (size)));
30 }
N_INLINE(void,nimZeroMem)31 static N_INLINE(void, nimZeroMem)(void* p, NI size) {
32 nimSetMem__systemZmemory_7(p, ((int) 0), size);
33 }
N_NIMCALL(NI,ncpicountProcessors)34 N_LIB_PRIVATE N_NIMCALL(NI, ncpicountProcessors)(void) {
35 NI result;
36 tyArray__VR9bNthWayFgb5M9avIR8bkA mib;
37 NI numCPU;
38 size_t len;
39 int T1_;
40 result = (NI)0;
41 nimZeroMem((void*)mib, sizeof(tyArray__VR9bNthWayFgb5M9avIR8bkA));
42 numCPU = (NI)0;
43 mib[(((NI) 0))- 0] = ((int) 6);
44 mib[(((NI) 1))- 0] = ((int) 25);
45 len = ((size_t) 8);
46 T1_ = (int)0;
47 T1_ = sysctl(mib, ((int) 2), ((void*) ((&numCPU))), (&len), NIM_NIL, ((size_t) 0));
48 (void)(T1_);
49 {
50 int T6_;
51 if (!(numCPU < ((NI) 1))) goto LA4_;
52 mib[(((NI) 1))- 0] = ((int) 3);
53 T6_ = (int)0;
54 T6_ = sysctl(mib, ((int) 2), ((void*) ((&numCPU))), (&len), NIM_NIL, ((size_t) 0));
55 (void)(T6_);
56 }
57 LA4_: ;
58 result = numCPU;
59 {
60 if (!(result <= ((NI) 0))) goto LA9_;
61 result = ((NI) 0);
62 }
63 LA9_: ;
64 return result;
65 }
66