Closed mratsim closed 2 months ago
!nim c
import std/bitops
type SecretWord* = distinct uint64
const WordBitWidth* = sizeof(SecretWord) * 8
func wordsRequired*(bits: int): int {.inline.} =
const divShiftor = fastLog2(WordBitWidth)
result = (bits + WordBitWidth - 1) shr divShiftor
type
BigInt*[bits: static int] = object
limbs*: array[bits.wordsRequired, SecretWord]
type Limbs*[N: static int] = array[N, SecretWord]
type
LimbsView* = ptr UncheckedArray[SecretWord]
LimbsViewConst* = distinct LimbsView
LimbsViewMut* = distinct LimbsView
LimbsViewAny* = LimbsViewConst or LimbsViewMut
template view*(a: Limbs): LimbsViewConst =
LimbsViewConst(cast[LimbsView](a.unsafeAddr))
template view*(a: var Limbs): LimbsViewMut =
LimbsViewMut(cast[LimbsView](a.addr))
template view*(a: openArray[SecretWord]): LimbsViewConst =
LimbsViewConst(cast[LimbsView](a[0].unsafeAddr))
template view*(a: var openArray[SecretWord]): LimbsViewMut =
LimbsViewMut(cast[LimbsView](a[0].addr))
func reduce*(r: LimbsViewMut,
a: LimbsViewAny, aBits: int,
M: LimbsViewConst, mBits: int) =
discard
func reduce*[aLen, mLen](r: var Limbs[mLen],
a: Limbs[aLen], aBits: static int,
M: Limbs[mLen], mBits: static int
) {.inline.} =
reduce(r.view(), a.view(), aBits, M.view(), mBits)
func reduce*[aBits, mBits](r: var BigInt[mBits], a: BigInt[aBits], M: BigInt[mBits]) =
reduce(r.limbs, a.limbs, aBits, M.limbs, mBits)
var a, M, r: BigInt[64]
r.reduce(a, M)
0 (0 bytes)
```cpp
```
2024-06-24T16:56:53
2024-06-24T16:56:54
93.27 Kb (95,512 bytes)
```cpp
#define NIM_INTBITS 64
#include "nimbase.h"
#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) \
FR_.line = n;
#define nimlf_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ;
typedef NU64 tyArray__pJyLF64dqQG9cdH8O4TEEew[1];
struct tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ {
tyArray__pJyLF64dqQG9cdH8O4TEEew limbs;
};
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u88)(tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ* r_p0, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ a_p1, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ M_p2);
static N_INLINE(void, reduce__temp_u133)(NU64* r_p0, tyArray__pJyLF64dqQG9cdH8O4TEEew a_p1, tyArray__pJyLF64dqQG9cdH8O4TEEew M_p3);
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u172)(NU64* r_p0, NU64* a_p1, NI aBits_p2, NU64* M_p3, NI mBits_p4);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4620)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot6atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ a__temp_u79;
N_LIB_PRIVATE tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ M__temp_u80;
N_LIB_PRIVATE tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ r__temp_u81;
extern NIM_THREADVAR TFrame* framePtr__system_u4059;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4402;
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
{
if (!(framePtr__system_u4059 == ((TFrame*) NIM_NIL))) goto LA3_;
(*s_p0).calldepth = ((NI16)0);
}
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u4059).calldepth + ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u4059;
framePtr__system_u4059 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
callDepthLimitReached__system_u4620();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u4059 = (*framePtr__system_u4059).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u172)(NU64* r_p0, NU64* a_p1, NI aBits_p2, NU64* M_p3, NI mBits_p4) {
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
popFrame();
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (&nimInErrorMode__system_u4402);
return result;
}
static N_INLINE(void, reduce__temp_u133)(NU64* r_p0, tyArray__pJyLF64dqQG9cdH8O4TEEew a_p1, tyArray__pJyLF64dqQG9cdH8O4TEEew M_p3) {
NIM_BOOL* nimErr_;
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
reduce__temp_u172(((NU64*) (r_p0)), ((NU64*) (a_p1)), ((NI)64), ((NU64*) (M_p3)), ((NI)64));
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u88)(tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ* r_p0, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ a_p1, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ M_p2) {
NIM_BOOL* nimErr_;
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
reduce__temp_u133((*r_p0).limbs, a_p1.limbs, M_p2.limbs);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
popFrame();
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
#if 0
void (*volatile inner)(void);
inner = PreMainInner;
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot6atslibatssystemdotnim_Init000();
(*inner)();
#else
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot6atslibatssystemdotnim_Init000();
PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
(*inner)();
#else
PreMain();
NimMainInner();
#endif
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
NIM_BOOL* nimErr_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
reduce__temp_u88((&r__temp_u81), a__temp_u79, M__temp_u80);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
}
```
2024-06-24T16:56:55
2024-06-24T16:56:55
90.94 Kb (93,120 bytes)
```cpp
#define NIM_INTBITS 64
#include "nimbase.h"
#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) \
FR_.line = n;
#define nimlf_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ;
typedef NU64 tyArray__pJyLF64dqQG9cdH8O4TEEew[1];
struct tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ {
tyArray__pJyLF64dqQG9cdH8O4TEEew limbs;
};
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u95)(tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ* r_p0, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ a_p1, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ M_p2);
static N_INLINE(void, reduce__temp_u156)(NU64* r_p0, tyArray__pJyLF64dqQG9cdH8O4TEEew a_p1, tyArray__pJyLF64dqQG9cdH8O4TEEew M_p3);
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u195)(NU64* r_p0, NU64* a_p1, NI aBits_p2, NU64* M_p3, NI mBits_p4);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4621)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ a__temp_u84;
N_LIB_PRIVATE tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ M__temp_u85;
N_LIB_PRIVATE tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ r__temp_u86;
extern NIM_THREADVAR TFrame* framePtr__system_u4020;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4403;
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
{
if (!(framePtr__system_u4020 == ((TFrame*) NIM_NIL))) goto LA3_;
(*s_p0).calldepth = ((NI16)0);
}
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u4020).calldepth + ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u4020;
framePtr__system_u4020 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
callDepthLimitReached__system_u4621();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u4020 = (*framePtr__system_u4020).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u195)(NU64* r_p0, NU64* a_p1, NI aBits_p2, NU64* M_p3, NI mBits_p4) {
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
popFrame();
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (&nimInErrorMode__system_u4403);
return result;
}
static N_INLINE(void, reduce__temp_u156)(NU64* r_p0, tyArray__pJyLF64dqQG9cdH8O4TEEew a_p1, tyArray__pJyLF64dqQG9cdH8O4TEEew M_p3) {
NIM_BOOL* nimErr_;
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
reduce__temp_u195(((NU64*) (r_p0)), ((NU64*) (a_p1)), ((NI)64), ((NU64*) (M_p3)), ((NI)64));
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u95)(tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ* r_p0, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ a_p1, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ M_p2) {
NIM_BOOL* nimErr_;
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
reduce__temp_u156((*r_p0).limbs, a_p1.limbs, M_p2.limbs);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
popFrame();
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
#if 0
void (*volatile inner)(void);
inner = PreMainInner;
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_Init000();
(*inner)();
#else
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_Init000();
PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
(*inner)();
#else
PreMain();
NimMainInner();
#endif
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
NIM_BOOL* nimErr_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
reduce__temp_u95((&r__temp_u86), a__temp_u84, M__temp_u85);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
}
```
2024-06-24T16:56:59
2024-06-24T16:56:59
90.94 Kb (93,120 bytes)
```cpp
#define NIM_INTBITS 64
#include "nimbase.h"
#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) \
FR_.line = n;
#define nimlf_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ;
typedef NU64 tyArray__pJyLF64dqQG9cdH8O4TEEew[1];
struct tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ {
tyArray__pJyLF64dqQG9cdH8O4TEEew limbs;
};
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u95)(tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ* r_p0, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ a_p1, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ M_p2);
static N_INLINE(void, reduce__temp_u156)(NU64* r_p0, tyArray__pJyLF64dqQG9cdH8O4TEEew a_p1, tyArray__pJyLF64dqQG9cdH8O4TEEew M_p3);
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u195)(NU64* r_p0, NU64* a_p1, NI aBits_p2, NU64* M_p3, NI mBits_p4);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4607)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ a__temp_u84;
N_LIB_PRIVATE tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ M__temp_u85;
N_LIB_PRIVATE tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ r__temp_u86;
extern NIM_THREADVAR TFrame* framePtr__system_u4006;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4389;
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
{
if (!(framePtr__system_u4006 == ((TFrame*) NIM_NIL))) goto LA3_;
(*s_p0).calldepth = ((NI16)0);
}
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u4006).calldepth + ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u4006;
framePtr__system_u4006 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
callDepthLimitReached__system_u4607();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u4006 = (*framePtr__system_u4006).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u195)(NU64* r_p0, NU64* a_p1, NI aBits_p2, NU64* M_p3, NI mBits_p4) {
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
popFrame();
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (NIM_BOOL*)0;
result = (&nimInErrorMode__system_u4389);
return result;
}
static N_INLINE(void, reduce__temp_u156)(NU64* r_p0, tyArray__pJyLF64dqQG9cdH8O4TEEew a_p1, tyArray__pJyLF64dqQG9cdH8O4TEEew M_p3) {
NIM_BOOL* nimErr_;
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
reduce__temp_u195(((NU64*) (r_p0)), ((NU64*) (a_p1)), ((NI)64), ((NU64*) (M_p3)), ((NI)64));
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u95)(tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ* r_p0, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ a_p1, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ M_p2) {
NIM_BOOL* nimErr_;
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
reduce__temp_u156((*r_p0).limbs, a_p1.limbs, M_p2.limbs);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
popFrame();
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
#if 0
void (*volatile inner)(void);
inner = PreMainInner;
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000();
(*inner)();
#else
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000();
PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
(*inner)();
#else
PreMain();
NimMainInner();
#endif
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
NIM_BOOL* nimErr_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
reduce__temp_u95((&r__temp_u86), a__temp_u84, M__temp_u85);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
}
```
2024-06-24T16:57:02
2024-06-24T16:57:03
95.77 Kb (98,072 bytes)
```cpp
#define NIM_INTBITS 64
#include "nimbase.h"
# 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_BigInt__lUGTCTfPVJpLI319b8vggHQ tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ;
typedef NU64 tyArray__pJyLF64dqQG9cdH8O4TEEew[1];
struct tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ {
tyArray__pJyLF64dqQG9cdH8O4TEEew limbs;
};
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u94)(tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ* r, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ a, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ M);
static N_INLINE(void, reduce__temp_u146)(NU64* r, tyArray__pJyLF64dqQG9cdH8O4TEEew a, tyArray__pJyLF64dqQG9cdH8O4TEEew M);
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u182)(NU64* r, NU64* a, NI aBits, NU64* M, NI mBits);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u2997)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_DatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ a__temp_u83;
N_LIB_PRIVATE tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ M__temp_u84;
N_LIB_PRIVATE tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ r__temp_u85;
extern TFrame* framePtr__system_u2564;
static N_INLINE(void, nimFrame)(TFrame* s) {
{
if (!(framePtr__system_u2564 == ((TFrame*) NIM_NIL))) goto LA3_;
(*s).calldepth = ((NI16) 0);
}
goto LA1_;
LA3_: ;
{
(*s).calldepth = (NI16)((*framePtr__system_u2564).calldepth + ((NI16) 1));
}
LA1_: ;
(*s).prev = framePtr__system_u2564;
framePtr__system_u2564 = s;
{
if (!((*s).calldepth == ((NI16) 2000))) goto LA8_;
callDepthLimitReached__system_u2997();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u2564 = (*framePtr__system_u2564).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u182)(NU64* r, NU64* a, NI aBits, NU64* M, NI mBits) {
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
popFrame();
}
static N_INLINE(void, reduce__temp_u146)(NU64* r, tyArray__pJyLF64dqQG9cdH8O4TEEew a, tyArray__pJyLF64dqQG9cdH8O4TEEew M) {
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
reduce__temp_u182(((NU64*) (r)), ((NU64*) (a)), ((NI) 64), ((NU64*) (M)), ((NI) 64));
popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u94)(tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ* r, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ a, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ M) {
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
reduce__temp_u146((*r).limbs, a.limbs, M.limbs);
popFrame();
}
static N_INLINE(void, initStackBottomWith)(void* locals) {
nimGC_setStackBottom(locals);
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
void (*volatile inner)(void);
inner = PreMainInner;
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_DatInit000();
initStackBottomWith((void *)&inner);
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_Init000();
(*inner)();
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
reduce__temp_u94((&r__temp_u85), a__temp_u83, M__temp_u84);
popFrame();
}
}
```
2024-06-24T16:57:05
2024-06-24T16:57:06
91.52 Kb (93,712 bytes)
```cpp
#define NIM_INTBITS 64
#include "nimbase.h"
# 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_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA;
typedef NU64 tyArray__pJyLF64dqQG9cdH8O4TEEew[1];
struct tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA {
tyArray__pJyLF64dqQG9cdH8O4TEEew limbs;
};
N_LIB_PRIVATE N_NIMCALL(void, reduce__9caK38Hkd2c3IeEAA0rtAHA)(tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA* r, tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA a, tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA M);
static N_INLINE(void, reduce__7LjO8d4pQkv4X5OXdc0Lrwtemp)(NU64* r, tyArray__pJyLF64dqQG9cdH8O4TEEew a, tyArray__pJyLF64dqQG9cdH8O4TEEew M);
N_LIB_PRIVATE N_NIMCALL(void, reduce__R7PY5TneSSsEfK7Fr9aVoMA)(NU64* r, NU64* a, NI aBits, NU64* M, NI mBits);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA a__pmzNoNHAcaDPxnGmV0hjXA;
N_LIB_PRIVATE tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA M__9aYiHOGnE31oAqZnrG9aCL5g;
N_LIB_PRIVATE tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA r__3y4WFr27BcUGKoBlMBNdbw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
static N_INLINE(void, nimFrame)(TFrame* s) {
{
if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == ((TFrame*) NIM_NIL))) goto LA3_;
(*s).calldepth = ((NI16) 0);
}
goto LA1_;
LA3_: ;
{
(*s).calldepth = (NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1));
}
LA1_: ;
(*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s;
{
if (!((*s).calldepth == ((NI16) 2000))) goto LA8_;
callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__R7PY5TneSSsEfK7Fr9aVoMA)(NU64* r, NU64* a, NI aBits, NU64* M, NI mBits) {
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
popFrame();
}
static N_INLINE(void, reduce__7LjO8d4pQkv4X5OXdc0Lrwtemp)(NU64* r, tyArray__pJyLF64dqQG9cdH8O4TEEew a, tyArray__pJyLF64dqQG9cdH8O4TEEew M) {
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
reduce__R7PY5TneSSsEfK7Fr9aVoMA(((NU64*) (r)), ((NU64*) (a)), ((NI) 64), ((NU64*) (M)), ((NI) 64));
popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__9caK38Hkd2c3IeEAA0rtAHA)(tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA* r, tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA a, tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA M) {
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
reduce__7LjO8d4pQkv4X5OXdc0Lrwtemp((*r).limbs, a.limbs, M.limbs);
popFrame();
}
static N_INLINE(void, initStackBottomWith)(void* locals) {
nimGC_setStackBottom(locals);
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
void (*volatile inner)(void);
inner = PreMainInner;
systemDatInit000();
initStackBottomWith((void *)&inner);
systemInit000();
(*inner)();
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
reduce__9caK38Hkd2c3IeEAA0rtAHA((&r__3y4WFr27BcUGKoBlMBNdbw), a__pmzNoNHAcaDPxnGmV0hjXA, M__9aYiHOGnE31oAqZnrG9aCL5g);
popFrame();
}
}
```
2024-06-24T16:57:08
2024-06-24T16:57:08
91.24 Kb (93,432 bytes)
```cpp
#define NIM_INTBITS 64
#include "nimbase.h"
# 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_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA;
typedef NU64 tyArray__pJyLF64dqQG9cdH8O4TEEew[1];
struct tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA {
tyArray__pJyLF64dqQG9cdH8O4TEEew limbs;
};
N_LIB_PRIVATE N_NIMCALL(void, reduce__9caK38Hkd2c3IeEAA0rtAHA)(tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA* r, tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA a, tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA M);
static N_INLINE(void, reduce__7LjO8d4pQkv4X5OXdc0Lrwtemp)(NU64* r, tyArray__pJyLF64dqQG9cdH8O4TEEew a, tyArray__pJyLF64dqQG9cdH8O4TEEew M);
N_LIB_PRIVATE N_NIMCALL(void, reduce__R7PY5TneSSsEfK7Fr9aVoMA)(NU64* r, NU64* a, NI aBits, NU64* M, NI mBits);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA a__pmzNoNHAcaDPxnGmV0hjXA;
N_LIB_PRIVATE tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA M__9aYiHOGnE31oAqZnrG9aCL5g;
N_LIB_PRIVATE tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA r__3y4WFr27BcUGKoBlMBNdbw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
static N_INLINE(void, nimFrame)(TFrame* s) {
{
if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA3_;
(*s).calldepth = ((NI16) 0);
}
goto LA1_;
LA3_: ;
{
(*s).calldepth = (NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1));
}
LA1_: ;
(*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s;
{
if (!((*s).calldepth == ((NI16) (((NI) 2000))))) goto LA8_;
callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__R7PY5TneSSsEfK7Fr9aVoMA)(NU64* r, NU64* a, NI aBits, NU64* M, NI mBits) {
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
popFrame();
}
static N_INLINE(void, reduce__7LjO8d4pQkv4X5OXdc0Lrwtemp)(NU64* r, tyArray__pJyLF64dqQG9cdH8O4TEEew a, tyArray__pJyLF64dqQG9cdH8O4TEEew M) {
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
reduce__R7PY5TneSSsEfK7Fr9aVoMA(((NU64*) (r)), ((NU64*) (a)), ((NI) 64), ((NU64*) (M)), ((NI) 64));
popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__9caK38Hkd2c3IeEAA0rtAHA)(tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA* r, tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA a, tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA M) {
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
reduce__7LjO8d4pQkv4X5OXdc0Lrwtemp((*r).limbs, a.limbs, M.limbs);
popFrame();
}
static N_INLINE(void, initStackBottomWith)(void* locals) {
nimGC_setStackBottom(locals);
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
void (*volatile inner)(void);
inner = PreMainInner;
systemDatInit000();
initStackBottomWith((void *)&inner);
systemInit000();
(*inner)();
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
reduce__9caK38Hkd2c3IeEAA0rtAHA((&r__3y4WFr27BcUGKoBlMBNdbw), a__pmzNoNHAcaDPxnGmV0hjXA, M__9aYiHOGnE31oAqZnrG9aCL5g);
popFrame();
}
}
```
2024-06-24T16:57:11
2024-06-24T16:57:12
86.34 Kb (88,416 bytes)
```cpp
#define NIM_INTBITS 64
#include "nimbase.h"
# 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_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA;
typedef NU64 tyArray__pJyLF64dqQG9cdH8O4TEEew[1];
struct tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA {
tyArray__pJyLF64dqQG9cdH8O4TEEew limbs;
};
N_LIB_PRIVATE N_NIMCALL(void, reduce__9caK38Hkd2c3IeEAA0rtAHA)(tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA* r, tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA a, tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA M);
static N_INLINE(void, reduce__7LjO8d4pQkv4X5OXdc0Lrwtemp)(NU64* r, tyArray__pJyLF64dqQG9cdH8O4TEEew a, tyArray__pJyLF64dqQG9cdH8O4TEEew M);
N_LIB_PRIVATE N_NIMCALL(void, reduce__R7PY5TneSSsEfK7Fr9aVoMA)(NU64* r, NU64* a, NI aBits, NU64* M, NI mBits);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA a__pmzNoNHAcaDPxnGmV0hjXA;
tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA M__9aYiHOGnE31oAqZnrG9aCL5g;
tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA r__3y4WFr27BcUGKoBlMBNdbw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
static N_INLINE(void, nimFrame)(TFrame* s) { NI T1_;
T1_ = (NI)0;
{
if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA4_;
T1_ = ((NI) 0);
}
goto LA2_;
LA4_: ;
{
T1_ = ((NI) ((NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1))));
}
LA2_: ;
(*s).calldepth = ((NI16) (T1_));
(*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s;
{
if (!((*s).calldepth == ((NI16) (((NI) 2000))))) goto LA9_;
callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
}
LA9_: ;
}
static N_INLINE(void, popFrame)(void) { framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__R7PY5TneSSsEfK7Fr9aVoMA)(NU64* r, NU64* a, NI aBits, NU64* M, NI mBits) { nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
popFrame();
}
static N_INLINE(void, reduce__7LjO8d4pQkv4X5OXdc0Lrwtemp)(NU64* r, tyArray__pJyLF64dqQG9cdH8O4TEEew a, tyArray__pJyLF64dqQG9cdH8O4TEEew M) { nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
reduce__R7PY5TneSSsEfK7Fr9aVoMA(((NU64*) (r)), ((NU64*) (a)), ((NI) 64), ((NU64*) (M)), ((NI) 64));
popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__9caK38Hkd2c3IeEAA0rtAHA)(tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA* r, tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA a, tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA M) { nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
reduce__7LjO8d4pQkv4X5OXdc0Lrwtemp((*r).limbs, a.limbs, M.limbs);
popFrame();
}
static N_INLINE(void, initStackBottomWith)(void* locals) { nimGC_setStackBottom(locals);
}
void PreMainInner(void) {
}
int cmdCount;
char** cmdLine;
char** gEnv;
void PreMain(void) {
void (*volatile inner)(void);
inner = PreMainInner;
systemDatInit000();
initStackBottomWith((void *)&inner);
systemInit000();
(*inner)();
}
N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
reduce__9caK38Hkd2c3IeEAA0rtAHA((&r__3y4WFr27BcUGKoBlMBNdbw), a__pmzNoNHAcaDPxnGmV0hjXA, M__9aYiHOGnE31oAqZnrG9aCL5g);
popFrame();
}
}
```
2024-06-24T16:57:14
2024-06-24T16:57:15
2023-12-31 16:52:52 +0000
on commit #ccc7c45d7 with message:
```
`typRel` and `sumGeneric` adjustments (#23137)
Filling in some more logic in `typeRel` that I came across when poking
the compiler in another PR. Some of the cases where `typeRel` returns an
"incorrect" result are actually common, but `sumGeneric` ends up
breaking the tie correctly. There isn't anything wrong with that
necessarily, but I assume that it's preferred these functions behave
just as well in isolation as they do when integrated.
I will be following up this description with specific examples.
```
The bug is in the files:
```
compiler/sigmatch.nim
```
The bug can be in the commits:
(Diagnostics sometimes off-by-one).11.4.0
14.0.0
20.3
2024-06-24T16:50:18Z
1
nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
:robot: Bug found in 54 minutes
bisecting 671
commits at 12
commits per second
@Graveflo
I'm guessing this call to reduceToBase
is the culprit, is it needed? According to the declaration of reduceToBase
:
proc reduceToBase(f: PType): PType =
#[
Returns the lowest order (most general) type that that is compatible with the input.
E.g.
A[T] = ptr object ... A -> ptr object
A[N: static[int]] = array[N, int] ... A -> array
]#
This seems like it loses information for static inference.
@Graveflo
I'm guessing this call to
reduceToBase
is the culprit, is it needed? According to the declaration ofreduceToBase
:proc reduceToBase(f: PType): PType = #[ Returns the lowest order (most general) type that that is compatible with the input. E.g. A[T] = ptr object ... A -> ptr object A[N: static[int]] = array[N, int] ... A -> array ]#
This seems like it loses information for static inference.
Not sure what you mean by "needed". It wasn't a prank or anything. I'll look at it later tonight when I have time. The way typeRel works is lossy because it recursively calls itself, often with a subset of the node structure. Ofc there are ways of sending info downstream, but generally that is just how it works. If this is the problem then it likely needs to be handled earlier.
Besides I have a suspicion this might be related to the inferred return type downgrading instead of this function. Can see "Need to devalue isInferred" from the PR text: https://github.com/nim-lang/Nim/pull/23137
Not sure what you mean by "needed"
The line I linked to was added in #23137 (here), I was asking if removing that line would result in any wrong behavior. I just tried it and removing that line makes the code in this issue compile, We could test it against CI but I was wondering if there was any side effect you would be aware of that CI wouldn't catch, or any other insight as to whether or not that line should be there. It seems like it's stripping information about unresolved static values that subsequent lines in that block previously looked for to infer static parameter values.
I was asking if removing that line would result in any wrong behavior.
I can't think of any side effects that the CI won't catch.. That is, as they were when I made the PR. Also there were edge cases that I only coaxed out of the CI in incremental versions of the PR chains. There is a minimal example of why the line is there in the "Array" section of the PR text. I would guess that the correct fix would be to detect the static before the line you highlighted and treat them differently.
reduced:
type
BigInt*[bits: static int] = object
limbs*: array[8, uint64]
type Limbs*[N: static int] = array[N, uint64]
proc view*(a: Limbs) =
discard
proc view*(a: var Limbs) =
discard
var r: BigInt[64]
r.limbs.view()
I'm getting closer to figuring out what is going on here. Just so you guys know. The way things were before the PR, that branch of typeRel
in the tyArray
section would have returned isNone
. That may be valid or invalid (we'll see) but to me that proves that this doesn't have anything to do with the proc that metagn brought up erasing information down the callgraph because it would have simply returned before.
I would think that array[5, 3]
statically would be it's own rigid type that has an isNone
relationship (in the accepting direction) with anything other than an exact match. So the isNone
return value seems right to me.
also, this produces a different error.
type
BigInt*[bits: static int] = object
limbs*: array[8, uint64]
proc view*[N](a: array[N, uint64]) =
discard
proc view*[N](a: var array[N, uint64]) =
discard
var r: BigInt[64]
r.limbs.view()
I think that the tyArray
branch just isn't designed to handle stuff like this currently. I don't think the current logic handles generics very well
!nim c
type
BigInt*[bits: static int] = object
limbs*: array[8, uint64]
proc view*[N](a: array[N, uint64]) =
discard
proc view*[N](a: var array[N, uint64]) =
discard
var r: BigInt[64]
r.limbs.view()
0 (0 bytes)
```cpp
```
2024-06-25T05:16:20
2024-06-25T05:16:20
0 (0 bytes)
```cpp
```
2024-06-25T05:16:21
2024-06-25T05:16:22
0 (0 bytes)
```cpp
```
2024-06-25T05:16:25
2024-06-25T05:16:25
0 (0 bytes)
```cpp
```
2024-06-25T05:16:28
2024-06-25T05:16:29
0 (0 bytes)
```cpp
```
2024-06-25T05:16:31
2024-06-25T05:16:32
0 (0 bytes)
```cpp
```
2024-06-25T05:16:34
2024-06-25T05:16:34
87.03 Kb (89,120 bytes)
```cpp
#define NIM_INTBITS 64
#include "nimbase.h"
# 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_BigInt__ozQDf32ivpAQw9aNbZADH9cQ tyObject_BigInt__ozQDf32ivpAQw9aNbZADH9cQ;
typedef NU64 tyArray__9cHI9ce3NOVpqam1bGmXg5vw[8];
struct tyObject_BigInt__ozQDf32ivpAQw9aNbZADH9cQ {
tyArray__9cHI9ce3NOVpqam1bGmXg5vw limbs;
};
N_LIB_PRIVATE N_NIMCALL(void, view__DN6WYQ3dL5Q9a6KKb0uHaLw)(NU64* a);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE tyObject_BigInt__ozQDf32ivpAQw9aNbZADH9cQ r__3y4WFr27BcUGKoBlMBNdbw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
static N_INLINE(void, nimFrame)(TFrame* s) {
{
if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA3_;
(*s).calldepth = ((NI16) 0);
}
goto LA1_;
LA3_: ;
{
(*s).calldepth = (NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1));
}
LA1_: ;
(*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s;
{
if (!((*s).calldepth == ((NI16) (((NI) 2000))))) goto LA8_;
callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, view__DN6WYQ3dL5Q9a6KKb0uHaLw)(NU64* a) {
nimfr_("view", "/home/runner/work/Nim/Nim/temp.nim");
popFrame();
}
static N_INLINE(void, initStackBottomWith)(void* locals) {
nimGC_setStackBottom(locals);
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
void (*volatile inner)(void);
inner = PreMainInner;
systemDatInit000();
initStackBottomWith((void *)&inner);
systemInit000();
(*inner)();
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
view__DN6WYQ3dL5Q9a6KKb0uHaLw(r__3y4WFr27BcUGKoBlMBNdbw.limbs);
popFrame();
}
}
```
2024-06-25T05:16:37
2024-06-25T05:16:38
86.13 Kb (88,200 bytes)
```cpp
#define NIM_INTBITS 64
#include "nimbase.h"
# 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_BigInt__ozQDf32ivpAQw9aNbZADH9cQ tyObject_BigInt__ozQDf32ivpAQw9aNbZADH9cQ;
typedef NU64 tyArray__9cHI9ce3NOVpqam1bGmXg5vw[8];
struct tyObject_BigInt__ozQDf32ivpAQw9aNbZADH9cQ {
tyArray__9cHI9ce3NOVpqam1bGmXg5vw limbs;
};
N_LIB_PRIVATE N_NIMCALL(void, view__DN6WYQ3dL5Q9a6KKb0uHaLw)(NU64* a);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
tyObject_BigInt__ozQDf32ivpAQw9aNbZADH9cQ r__3y4WFr27BcUGKoBlMBNdbw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
static N_INLINE(void, nimFrame)(TFrame* s) { NI T1_;
T1_ = (NI)0;
{
if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA4_;
T1_ = ((NI) 0);
}
goto LA2_;
LA4_: ;
{
T1_ = ((NI) ((NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1))));
}
LA2_: ;
(*s).calldepth = ((NI16) (T1_));
(*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s;
{
if (!((*s).calldepth == ((NI16) (((NI) 2000))))) goto LA9_;
callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
}
LA9_: ;
}
static N_INLINE(void, popFrame)(void) { framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, view__DN6WYQ3dL5Q9a6KKb0uHaLw)(NU64* a) { nimfr_("view", "/home/runner/work/Nim/Nim/temp.nim");
popFrame();
}
static N_INLINE(void, initStackBottomWith)(void* locals) { nimGC_setStackBottom(locals);
}
void PreMainInner(void) {
}
int cmdCount;
char** cmdLine;
char** gEnv;
void PreMain(void) {
void (*volatile inner)(void);
inner = PreMainInner;
systemDatInit000();
initStackBottomWith((void *)&inner);
systemInit000();
(*inner)();
}
N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
view__DN6WYQ3dL5Q9a6KKb0uHaLw(r__3y4WFr27BcUGKoBlMBNdbw.limbs);
popFrame();
}
}
```
2024-06-25T05:16:40
2024-06-25T05:16:40
2020-08-27 05:56:38 -0500
on commit #d11933ad9 with message:
```
fix some issues overloading with generics and inheritance (#15211)
* fix some issues overloading with generics and inheritance
* fix passing procs with subtype matches
```
The bug is in the files:
```
compiler/sigmatch.nim
tests/overload/toverload_various.nim
```
The bug can be in the commits:
(Diagnostics sometimes off-by-one).11.4.0
14.0.0
20.3
2024-06-25T05:09:41Z
9
nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
:robot: Bug found in 37 minutes
bisecting 5094
commits at 137
commits per second
The following snippet works on Nim v2.0.6 but crashes on Nim-devel
It crashes in release mode at
And in debug: