skip lookup table zero-initialization for x⊐x

This commit is contained in:
dzaima 2023-02-18 23:53:58 +02:00
parent 1c70a104cd
commit 428064a5c2

View File

@ -44,9 +44,11 @@ static u64 elRange(u8 eltype) { return 1ull<<(1<<elWidthLogBits(eltype)); }
void* ip = tyany_ptr(IN); \
void* fp = tyany_ptr(FOR); \
/* Initialize */ \
if (IN.u != FOR.u) { \
if (FOR##e==el_i16 && n<ft/(64/sizeof(TY))) \
{ for (usz i=0; i<n; i++) tab[((i16*)fp)[i]]=INIT; } \
else { TY* to=tab-(ft/2-(ft==2)); for (i64 i=0; i<ft; i++) to[i]=INIT; } \
} \
/* Set */ \
if (IN##e==el_i8) { for (usz i=m; i--; ) tab[((i8 *)ip)[i]]=SET; } \
else { for (usz i=m; i--; ) tab[((i16*)ip)[i]]=SET; } \
@ -113,6 +115,7 @@ static NOINLINE B2 splitCells(B n, B p, u8 mode) { // 0:∊ 1:⊐ 2:⊒
u8 meb = neb>peb? neb : peb;
ux rb = csz<<meb;
if (rb!=0 && rb<=62) {
if (n.u == p.u) { decG(p); n=toIntCell(n,rb,1); return (B2){.n=n, .p=incG(n)}; }
if (neb!=meb) n = cpyToElLog(n, ne, meb);
else if (peb!=meb) p = cpyToElLog(p, pe, meb);
return (B2){.n=toIntCell(n,rb,nco), .p=toIntCell(p,rb,1)};