csources_v2/c_code/2_18/@mbitsets.nim.c
2022-12-16 10:54:01 +08:00

450 lines
7.2 KiB
C

/* Generated by Nim Compiler v1.9.0 */
#define NIM_INTBITS 32
#include "nimbase.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_(x, y)
#define nimln_(x, y)
typedef struct tySequence__6H5Oh5UUvVCLiakt9aTwtUQ tySequence__6H5Oh5UUvVCLiakt9aTwtUQ;
typedef struct tySequence__6H5Oh5UUvVCLiakt9aTwtUQ_Content tySequence__6H5Oh5UUvVCLiakt9aTwtUQ_Content;
struct tySequence__6H5Oh5UUvVCLiakt9aTwtUQ {
NI len; tySequence__6H5Oh5UUvVCLiakt9aTwtUQ_Content* p;
};
typedef NU8 tyArray__PgpowgA9aFQHq0cr9b7SoUgw[256];
#ifndef tySequence__6H5Oh5UUvVCLiakt9aTwtUQ_Content_PP
#define tySequence__6H5Oh5UUvVCLiakt9aTwtUQ_Content_PP
struct tySequence__6H5Oh5UUvVCLiakt9aTwtUQ_Content { NI cap; NU8 data[SEQ_DECL_SIZE];};
#endif
N_LIB_PRIVATE N_NIMCALL(void, newSeq__bitsets_59)(tySequence__6H5Oh5UUvVCLiakt9aTwtUQ* s, NI len);
N_LIB_PRIVATE NIM_CONST tyArray__PgpowgA9aFQHq0cr9b7SoUgw populationCount__bitsets_189 = {((NU8)0),
((NU8)1),
((NU8)1),
((NU8)2),
((NU8)1),
((NU8)2),
((NU8)2),
((NU8)3),
((NU8)1),
((NU8)2),
((NU8)2),
((NU8)3),
((NU8)2),
((NU8)3),
((NU8)3),
((NU8)4),
((NU8)1),
((NU8)2),
((NU8)2),
((NU8)3),
((NU8)2),
((NU8)3),
((NU8)3),
((NU8)4),
((NU8)2),
((NU8)3),
((NU8)3),
((NU8)4),
((NU8)3),
((NU8)4),
((NU8)4),
((NU8)5),
((NU8)1),
((NU8)2),
((NU8)2),
((NU8)3),
((NU8)2),
((NU8)3),
((NU8)3),
((NU8)4),
((NU8)2),
((NU8)3),
((NU8)3),
((NU8)4),
((NU8)3),
((NU8)4),
((NU8)4),
((NU8)5),
((NU8)2),
((NU8)3),
((NU8)3),
((NU8)4),
((NU8)3),
((NU8)4),
((NU8)4),
((NU8)5),
((NU8)3),
((NU8)4),
((NU8)4),
((NU8)5),
((NU8)4),
((NU8)5),
((NU8)5),
((NU8)6),
((NU8)1),
((NU8)2),
((NU8)2),
((NU8)3),
((NU8)2),
((NU8)3),
((NU8)3),
((NU8)4),
((NU8)2),
((NU8)3),
((NU8)3),
((NU8)4),
((NU8)3),
((NU8)4),
((NU8)4),
((NU8)5),
((NU8)2),
((NU8)3),
((NU8)3),
((NU8)4),
((NU8)3),
((NU8)4),
((NU8)4),
((NU8)5),
((NU8)3),
((NU8)4),
((NU8)4),
((NU8)5),
((NU8)4),
((NU8)5),
((NU8)5),
((NU8)6),
((NU8)2),
((NU8)3),
((NU8)3),
((NU8)4),
((NU8)3),
((NU8)4),
((NU8)4),
((NU8)5),
((NU8)3),
((NU8)4),
((NU8)4),
((NU8)5),
((NU8)4),
((NU8)5),
((NU8)5),
((NU8)6),
((NU8)3),
((NU8)4),
((NU8)4),
((NU8)5),
((NU8)4),
((NU8)5),
((NU8)5),
((NU8)6),
((NU8)4),
((NU8)5),
((NU8)5),
((NU8)6),
((NU8)5),
((NU8)6),
((NU8)6),
((NU8)7),
((NU8)1),
((NU8)2),
((NU8)2),
((NU8)3),
((NU8)2),
((NU8)3),
((NU8)3),
((NU8)4),
((NU8)2),
((NU8)3),
((NU8)3),
((NU8)4),
((NU8)3),
((NU8)4),
((NU8)4),
((NU8)5),
((NU8)2),
((NU8)3),
((NU8)3),
((NU8)4),
((NU8)3),
((NU8)4),
((NU8)4),
((NU8)5),
((NU8)3),
((NU8)4),
((NU8)4),
((NU8)5),
((NU8)4),
((NU8)5),
((NU8)5),
((NU8)6),
((NU8)2),
((NU8)3),
((NU8)3),
((NU8)4),
((NU8)3),
((NU8)4),
((NU8)4),
((NU8)5),
((NU8)3),
((NU8)4),
((NU8)4),
((NU8)5),
((NU8)4),
((NU8)5),
((NU8)5),
((NU8)6),
((NU8)3),
((NU8)4),
((NU8)4),
((NU8)5),
((NU8)4),
((NU8)5),
((NU8)5),
((NU8)6),
((NU8)4),
((NU8)5),
((NU8)5),
((NU8)6),
((NU8)5),
((NU8)6),
((NU8)6),
((NU8)7),
((NU8)2),
((NU8)3),
((NU8)3),
((NU8)4),
((NU8)3),
((NU8)4),
((NU8)4),
((NU8)5),
((NU8)3),
((NU8)4),
((NU8)4),
((NU8)5),
((NU8)4),
((NU8)5),
((NU8)5),
((NU8)6),
((NU8)3),
((NU8)4),
((NU8)4),
((NU8)5),
((NU8)4),
((NU8)5),
((NU8)5),
((NU8)6),
((NU8)4),
((NU8)5),
((NU8)5),
((NU8)6),
((NU8)5),
((NU8)6),
((NU8)6),
((NU8)7),
((NU8)3),
((NU8)4),
((NU8)4),
((NU8)5),
((NU8)4),
((NU8)5),
((NU8)5),
((NU8)6),
((NU8)4),
((NU8)5),
((NU8)5),
((NU8)6),
((NU8)5),
((NU8)6),
((NU8)6),
((NU8)7),
((NU8)4),
((NU8)5),
((NU8)5),
((NU8)6),
((NU8)5),
((NU8)6),
((NU8)6),
((NU8)7),
((NU8)5),
((NU8)6),
((NU8)6),
((NU8)7),
((NU8)6),
((NU8)7),
((NU8)7),
((NU8)8)}
;
N_LIB_PRIVATE N_NIMCALL(void, bitSetInit__bitsets_56)(tySequence__6H5Oh5UUvVCLiakt9aTwtUQ* b, NI length) {
newSeq__bitsets_59((&(*b)), ((NI) (length)));
}
N_LIB_PRIVATE N_NIMCALL(void, bitSetIncl__bitsets_23)(tySequence__6H5Oh5UUvVCLiakt9aTwtUQ* x, NI64 elem) {
(*x).p->data[(NI64)((NI64)(elem) >> (NU64)(((NI)3)))] = (NU8)((*x).p->data[(NI64)((NI64)(elem) >> (NU64)(((NI)3)))] | (NU8)((NU64)(((NU8)1)) << (NU64)((NI64)(elem & IL64(7)))));
}
N_LIB_PRIVATE N_NIMCALL(NI64, bitSetCard__bitsets_202)(tySequence__6H5Oh5UUvVCLiakt9aTwtUQ x) {
NI64 result;
result = (NI64)0;
{
NU8* it;
NI i;
NI L;
NI T2_;
it = (NU8*)0;
i = ((NI)0);
T2_ = x.len;
L = T2_;
{
while (1) {
if (!(i < L)) goto LA4 ;
it = (&x.p->data[i]);
result += ((NI) (populationCount__bitsets_189[((*it))- 0]));
i += ((NI)1);
} LA4: ;
}
}
return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, bitSetContains__bitsets_127)(tySequence__6H5Oh5UUvVCLiakt9aTwtUQ x, tySequence__6H5Oh5UUvVCLiakt9aTwtUQ y) {
NIM_BOOL result;
{ result = (NIM_BOOL)0;
{
NI i;
NI colontmp_;
NI T2_;
NI res;
i = (NI)0;
colontmp_ = (NI)0;
T2_ = (x.len-1);
colontmp_ = T2_;
res = ((NI)0);
{
while (1) {
if (!(res <= colontmp_)) goto LA4 ;
i = res;
{
if (!!(((NU8)(x.p->data[i] & (NU8)((NU8) ~(y.p->data[i]))) == ((NU8)0)))) goto LA7_;
result = NIM_FALSE;
goto BeforeRet_;
}
LA7_: ;
res += ((NI)1);
} LA4: ;
}
}
result = NIM_TRUE;
}BeforeRet_: ;
return result;
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, bitSetEquals__bitsets_115)(tySequence__6H5Oh5UUvVCLiakt9aTwtUQ x, tySequence__6H5Oh5UUvVCLiakt9aTwtUQ y) {
NIM_BOOL result;
{ result = (NIM_BOOL)0;
{
NI i;
NI colontmp_;
NI T2_;
NI res;
i = (NI)0;
colontmp_ = (NI)0;
T2_ = (x.len-1);
colontmp_ = T2_;
res = ((NI)0);
{
while (1) {
if (!(res <= colontmp_)) goto LA4 ;
i = res;
{
if (!!((x.p->data[i] == y.p->data[i]))) goto LA7_;
result = NIM_FALSE;
goto BeforeRet_;
}
LA7_: ;
res += ((NI)1);
} LA4: ;
}
}
result = NIM_TRUE;
}BeforeRet_: ;
return result;
}
N_LIB_PRIVATE N_NIMCALL(void, bitSetIntersect__bitsets_104)(tySequence__6H5Oh5UUvVCLiakt9aTwtUQ* x, tySequence__6H5Oh5UUvVCLiakt9aTwtUQ y) {
{
NI i;
NI colontmp_;
NI T2_;
NI res;
i = (NI)0;
colontmp_ = (NI)0;
T2_ = ((*x).len-1);
colontmp_ = T2_;
res = ((NI)0);
{
while (1) {
if (!(res <= colontmp_)) goto LA4 ;
i = res;
(*x).p->data[i] = (NU8)((*x).p->data[i] & y.p->data[i]);
res += ((NI)1);
} LA4: ;
}
}
}
N_LIB_PRIVATE N_NIMCALL(NIM_BOOL, bitSetIn__bitsets_11)(tySequence__6H5Oh5UUvVCLiakt9aTwtUQ x, NI64 e) {
NIM_BOOL result;
result = (NIM_BOOL)0;
result = !(((NU8)(x.p->data[(NI64)((NI64)(e) >> (NU64)(((NI)3)))] & (NU8)((NU64)(((NU8)1)) << (NU64)((NI64)(e & IL64(7))))) == ((NU8)0)));
return result;
}
N_LIB_PRIVATE N_NIMCALL(void, bitSetUnion__bitsets_71)(tySequence__6H5Oh5UUvVCLiakt9aTwtUQ* x, tySequence__6H5Oh5UUvVCLiakt9aTwtUQ y) {
{
NI i;
NI colontmp_;
NI T2_;
NI res;
i = (NI)0;
colontmp_ = (NI)0;
T2_ = ((*x).len-1);
colontmp_ = T2_;
res = ((NI)0);
{
while (1) {
if (!(res <= colontmp_)) goto LA4 ;
i = res;
(*x).p->data[i] = (NU8)((*x).p->data[i] | y.p->data[i]);
res += ((NI)1);
} LA4: ;
}
}
}
N_LIB_PRIVATE N_NIMCALL(void, bitSetDiff__bitsets_82)(tySequence__6H5Oh5UUvVCLiakt9aTwtUQ* x, tySequence__6H5Oh5UUvVCLiakt9aTwtUQ y) {
{
NI i;
NI colontmp_;
NI T2_;
NI res;
i = (NI)0;
colontmp_ = (NI)0;
T2_ = ((*x).len-1);
colontmp_ = T2_;
res = ((NI)0);
{
while (1) {
if (!(res <= colontmp_)) goto LA4 ;
i = res;
(*x).p->data[i] = (NU8)((*x).p->data[i] & (NU8)((NU8) ~(y.p->data[i])));
res += ((NI)1);
} LA4: ;
}
}
}