mirror of
https://github.com/status-im/csources-nimble.git
synced 2026-08-29 17:31:05 +00:00
191 lines
6.9 KiB
C
191 lines
6.9 KiB
C
/* Generated by Nim Compiler v1.7.1 */
|
|||
|
|
#define NIM_INTBITS 64
|
||
|
|
|
||
|
|
#include "nimbase.h"
|
||
|
|
#include <windows.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
|
||
|
|
# define nimfr_(proc, file) \
|
||
|
|
TFrame FR_; \
|
||
|
|
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
|
||
|
|
|
||
|
|
# define nimfrs_(proc, file, slots, length) \
|
||
|
|
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
|
||
|
|
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
|
||
|
|
|
||
|
|
# define nimln_(n, file) \
|
||
|
|
FR_.line = n; FR_.filename = file;
|
||
|
|
typedef struct tyObject_Rand__liBKmwv1H6v7oYBhDFHa6A tyObject_Rand__liBKmwv1H6v7oYBhDFHa6A;
|
||
|
|
struct tyObject_Rand__liBKmwv1H6v7oYBhDFHa6A {
|
||
|
|
NU64 a0;
|
||
|
|
NU64 a1;
|
||
|
|
};
|
||
|
|
static N_INLINE(void, initLock__coreZlocks_47)(CRITICAL_SECTION* lock);
|
||
|
|
N_LIB_PRIVATE N_NIMCALL(NI, rand__pureZrandom_92)(tyObject_Rand__liBKmwv1H6v7oYBhDFHa6A* r, NI max);
|
||
|
|
N_LIB_PRIVATE N_NIMCALL(NU64, rand__pureZrandom_96)(tyObject_Rand__liBKmwv1H6v7oYBhDFHa6A* r, NU64 max);
|
||
|
|
N_LIB_PRIVATE N_NIMCALL(NU64, next__pureZrandom_44)(tyObject_Rand__liBKmwv1H6v7oYBhDFHa6A* r);
|
||
|
|
N_LIB_PRIVATE N_NIMCALL(NU64, rotl__pureZrandom_32)(NU64 x, NU64 k);
|
||
|
|
static N_INLINE(void, nimFrame)(TFrame* s);
|
||
|
|
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_3455)(void);
|
||
|
|
static N_INLINE(void, popFrame)(void);
|
||
|
|
N_LIB_PRIVATE N_NOINLINE(void, raiseRangeErrorI)(NI64 i, NI64 a, NI64 b);
|
||
|
|
N_LIB_PRIVATE NIM_CONST tyObject_Rand__liBKmwv1H6v7oYBhDFHa6A DefaultRandSeed__pureZrandom_13 = {7616934476015405061ULL, 15122295919272093642ULL}
|
||
|
|
;
|
||
|
|
N_LIB_PRIVATE tyObject_Rand__liBKmwv1H6v7oYBhDFHa6A state__pureZrandom_14;
|
||
|
|
N_LIB_PRIVATE CRITICAL_SECTION baseSeedLock__pureZrandom_245;
|
||
|
|
N_LIB_PRIVATE tyObject_Rand__liBKmwv1H6v7oYBhDFHa6A baseState__pureZrandom_246;
|
||
|
|
extern NIM_THREADVAR TFrame* framePtr__system_3022;
|
||
|
|
extern NIM_THREADVAR TFrame* framePtr__system_3022;
|
||
|
|
extern NIM_THREADVAR TFrame* framePtr__system_3022;
|
||
|
|
extern NIM_THREADVAR TFrame* framePtr__system_3022;
|
||
|
|
extern NIM_THREADVAR TFrame* framePtr__system_3022;
|
||
|
|
extern NIM_THREADVAR TFrame* framePtr__system_3022;
|
||
|
|
static N_INLINE(void, initLock__coreZlocks_47)(CRITICAL_SECTION* lock) {
|
||
|
|
InitializeCriticalSection(lock);
|
||
|
|
}
|
||
|
|
static N_INLINE(void, nimFrame)(TFrame* s) {
|
||
|
|
{
|
||
|
|
if (!(framePtr__system_3022 == ((TFrame*) NIM_NIL))) goto LA3_;
|
||
|
|
(*s).calldepth = ((NI16) 0);
|
||
|
|
}
|
||
|
|
goto LA1_;
|
||
|
|
LA3_: ;
|
||
|
|
{
|
||
|
|
(*s).calldepth = (NI16)((*framePtr__system_3022).calldepth + ((NI16) 1));
|
||
|
|
}
|
||
|
|
LA1_: ;
|
||
|
|
(*s).prev = framePtr__system_3022;
|
||
|
|
framePtr__system_3022 = s;
|
||
|
|
{
|
||
|
|
if (!((*s).calldepth == ((NI16) 2000))) goto LA8_;
|
||
|
|
callDepthLimitReached__system_3455();
|
||
|
|
}
|
||
|
|
LA8_: ;
|
||
|
|
}
|
||
|
|
static N_INLINE(void, popFrame)(void) {
|
||
|
|
framePtr__system_3022 = (*framePtr__system_3022).prev;
|
||
|
|
}
|
||
|
|
N_LIB_PRIVATE N_NIMCALL(NU64, rotl__pureZrandom_32)(NU64 x, NU64 k) {
|
||
|
|
NU64 result;
|
||
|
|
nimfr_("rotl", "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
result = (NU64)0;
|
||
|
|
nimln_(132, "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
result = (NU64)((NU64)((NU64)(x) << (NU64)(k)) | (NU64)((NU64)(x) >> (NU64)((NU64)((NU64)(64ULL) - (NU64)(k)))));
|
||
|
|
popFrame();
|
||
|
|
return result;
|
||
|
|
}
|
||
|
|
N_LIB_PRIVATE N_NIMCALL(NU64, next__pureZrandom_44)(tyObject_Rand__liBKmwv1H6v7oYBhDFHa6A* r) {
|
||
|
|
NU64 result;
|
||
|
|
NU64 s0;
|
||
|
|
NU64 s1;
|
||
|
|
NU64 T1_;
|
||
|
|
nimfr_("next", "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
result = (NU64)0;
|
||
|
|
nimln_(150, "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
s0 = (*r).a0;
|
||
|
|
nimln_(151, "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
s1 = (*r).a1;
|
||
|
|
nimln_(152, "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
result = (NU64)((NU64)(s0) + (NU64)(s1));
|
||
|
|
nimln_(153, "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
s1 = (NU64)(s1 ^ s0);
|
||
|
|
nimln_(154, "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
T1_ = (NU64)0;
|
||
|
|
T1_ = rotl__pureZrandom_32(s0, 55ULL);
|
||
|
|
(*r).a0 = (NU64)((NU64)(T1_ ^ s1) ^ (NU64)((NU64)(s1) << (NU64)(((NI) 14))));
|
||
|
|
nimln_(155, "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
(*r).a1 = rotl__pureZrandom_32(s1, 36ULL);
|
||
|
|
popFrame();
|
||
|
|
return result;
|
||
|
|
}
|
||
|
|
N_LIB_PRIVATE N_NIMCALL(NU64, rand__pureZrandom_96)(tyObject_Rand__liBKmwv1H6v7oYBhDFHa6A* r, NU64 max) {
|
||
|
|
NU64 result;
|
||
|
|
nimfr_("rand", "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
{ result = (NU64)0;
|
||
|
|
nimln_(227, "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
{
|
||
|
|
if (!(max == 0ULL)) goto LA3_;
|
||
|
|
goto BeforeRet_;
|
||
|
|
}
|
||
|
|
goto LA1_;
|
||
|
|
LA3_: ;
|
||
|
|
{
|
||
|
|
NU64 max_2;
|
||
|
|
nimln_(229, "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
max_2 = max;
|
||
|
|
nimln_(231, "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
{
|
||
|
|
if (!(max_2 == 18446744073709551615ULL)) goto LA8_;
|
||
|
|
result = next__pureZrandom_44(r);
|
||
|
|
goto BeforeRet_;
|
||
|
|
}
|
||
|
|
LA8_: ;
|
||
|
|
{
|
||
|
|
nimln_(232, "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
while (1) {
|
||
|
|
NU64 x;
|
||
|
|
nimln_(233, "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
x = next__pureZrandom_44(r);
|
||
|
|
nimln_(235, "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
{
|
||
|
|
if (!((NU64)(x) <= (NU64)((NU64)((NU64)(18446744073709551615ULL) - (NU64)((NU64)((NU64)(18446744073709551615ULL) % (NU64)(max_2))))))) goto LA14_;
|
||
|
|
nimln_(236, "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
result = (NU64)((NU64)(x) % (NU64)((NU64)((NU64)(max_2) + (NU64)(1ULL))));
|
||
|
|
goto BeforeRet_;
|
||
|
|
}
|
||
|
|
LA14_: ;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
LA1_: ;
|
||
|
|
}BeforeRet_: ;
|
||
|
|
popFrame();
|
||
|
|
return result;
|
||
|
|
}
|
||
|
|
N_LIB_PRIVATE N_NIMCALL(NI, rand__pureZrandom_92)(tyObject_Rand__liBKmwv1H6v7oYBhDFHa6A* r, NI max) {
|
||
|
|
NI result;
|
||
|
|
NU64 T1_;
|
||
|
|
nimfr_("rand", "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
result = (NI)0;
|
||
|
|
nimln_(239, "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
nimln_(252, "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
T1_ = (NU64)0;
|
||
|
|
T1_ = rand__pureZrandom_96(r, ((NU64) (max)));
|
||
|
|
result = ((NI) (T1_));
|
||
|
|
popFrame();
|
||
|
|
return result;
|
||
|
|
}
|
||
|
|
N_LIB_PRIVATE N_NIMCALL(NI, rand__pureZrandom_115)(NI max) {
|
||
|
|
NI result;
|
||
|
|
nimfr_("rand", "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
result = (NI)0;
|
||
|
|
nimln_(256, "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
nimln_(274, "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
if ((max) < ((NI) 0) || (max) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI(max, ((NI) 0), ((NI) IL64(9223372036854775807))); }
|
||
|
|
result = rand__pureZrandom_92((&state__pureZrandom_14), ((NI) (max)));
|
||
|
|
popFrame();
|
||
|
|
return result;
|
||
|
|
}
|
||
|
|
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsNimatslibatspureatsrandomdotnim_Init000)(void) {
|
||
|
|
{
|
||
|
|
nimfr_("random", "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
nimln_(116, "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
state__pureZrandom_14 = DefaultRandSeed__pureZrandom_13;
|
||
|
|
nimln_(655, "/home/yyoncho/Sources/nim/Nim/lib/pure/random.nim");
|
||
|
|
initLock__coreZlocks_47((&baseSeedLock__pureZrandom_245));
|
||
|
|
popFrame();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|