Exemplo n.º 1
0
static void UnboxArray_ensureMinimumSize(KonohaContext *kctx, struct _kAbstractArray *a, size_t min)
{
	size_t minbyte = min * sizeof(uintptr_t);
	if(!(minbyte < a->a.bytemax)) {
		if(minbyte < sizeof(kObject)) minbyte = sizeof(kObject);
		KLIB KArray_Expand(kctx, &a->a, minbyte);
	}
}
Exemplo n.º 2
0
static intptr_t AddLocal(KonohaContext *kctx, KBuilder *builder, intptr_t index, ksymbol_t sym, ktypeattr_t type)
{
	LocalVarInfo *newlocal;
	int offset = builder->localVar.bytesize / sizeof(LocalVarInfo);
	if(builder->localVar.bytesize == builder->localVar.bytemax) {
		size_t newsize = sizeof(LocalVarInfo) * (1 << LOG2(offset * 2 + 1));
		KLIB KArray_Expand(kctx, &builder->localVar, newsize);
	}
	newlocal = &((LocalVarInfo *)builder->localVar.bytebuf)[offset];
	newlocal->index = index;
	newlocal->sym   = sym;
	newlocal->type  = type;
	builder->localVar.bytesize += sizeof(LocalVarInfo);
	return index;

}