assert partial HArrs are finished

This commit is contained in:
dzaima 2021-05-24 13:18:01 +03:00
parent b7f5b6b3ce
commit cc36fd0d7c
4 changed files with 7 additions and 4 deletions

View File

@ -13,7 +13,7 @@ rtperf: FLAGS=-O3 -DRT_PERF
rtperf: gen
heapverify: FLAGS=-DDEBUG -g -DHEAP_VERIFY
heapverify: gen
rtverify: FLAGS=-O3 -DRT_VERIFY
rtverify: FLAGS=-DDEBUG -O3 -DRT_VERIFY
rtverify: gen
gen: builtins core base utils

View File

@ -135,10 +135,10 @@ void harrP_print(B x) {
B* p = c(HArr,x)->a;
usz am = *c(HArr,x)->sh;
usz ia = a(x)->ia;
printf("(partial HArr %d/%d %p %p: ?⥊", am, ia, c(HArr,x)->sh, &a(x)->ia);
printf("(partial HArr %d/%d: ⟨", am, ia);
for (usz i = 0; i < ia; i++) {
if (i) printf(", ");
if (i>=am) printf("(…)\n");
if (i>=am) printf("?");
else print(p[i]);
}
printf("⟩)");

View File

@ -28,6 +28,7 @@ static HArr_p m_harrs(usz ia, usz* ctr) { // writes just ia
return harr_parts(r);
}
static B harr_fv(HArr_p p) { VTY(p.b, t_harrPartial);
assert(p.c->ia == *p.c->sh);
p.c->type = t_harr;
p.c->sh = &p.c->ia;
srnk(p.b, 1);
@ -35,12 +36,14 @@ static B harr_fv(HArr_p p) { VTY(p.b, t_harrPartial);
return p.b;
}
static B harr_fc(HArr_p p, B x) { VTY(p.b, t_harrPartial);
assert(p.c->ia == *p.c->sh);
p.c->type = t_harr;
arr_shCopy(p.b, x);
gsPop();
return p.b;
}
static B harr_fcd(HArr_p p, B x) { VTY(p.b, t_harrPartial);
assert(p.c->ia == *p.c->sh);
p.c->type = t_harr;
arr_shCopy(p.b, x);
dec(x);

View File

@ -86,7 +86,7 @@ typedef u8 ur;
#define UR_MAX 255
#define CTR_FOR(F)
#define CTR_PRINT(N) printf(#N ": %lu\n", N);
#define CTR_PRINT(N) if(N) printf(#N ": %lu\n", N);
#define F(N) extern u64 N;
CTR_FOR(F)
#undef F