extract m_tyslice

This commit is contained in:
dzaima 2024-07-23 15:49:36 +03:00
parent b99d5f23d5
commit f1f4f1734e
2 changed files with 10 additions and 5 deletions

View File

@ -85,3 +85,11 @@ SHOULD_INLINE u8 kCellWidthLog(B x, ur k) {
return multWidthLog(shProd(SH(x), k, xr), lw);
}
SHOULD_INLINE u8 cellWidthLog(B x) { return kCellWidthLog(x, 1); }
static Arr* m_tyslice(void* data, Arr* parent, u8 eltype, ux ia) {
assert(eltype!=el_bit && eltype!=el_B);
Arr* a = m_arr(sizeof(TySlice), t_i8slice + eltype-el_i8, ia);
((TySlice*) a)->p = parent;
((TySlice*) a)->a = data;
return a;
}

View File

@ -296,11 +296,8 @@ DEF_FREE(mmapH) {
}
B info_c1(B,B);
static Arr* mmapH_slice(B x, usz s, usz ia) {
TySlice* r = m_arr(sizeof(TySlice), t_c8slice, ia);
r->a = c(MmapHolder,x)->a + s;
r->p = a(x);
return (Arr*)r;
static NOINLINE Arr* mmapH_slice(B x, usz s, usz ia) {
return m_tyslice(c(MmapHolder,x)->a + s, a(x), t_c8slice, ia);
}
B mmap_file(B path) {