unified int & char cases for ⊏

This commit is contained in:
dzaima 2022-05-01 01:53:45 +03:00
parent 7ece6b2179
commit 7ab504c8bc

View File

@ -20,17 +20,19 @@ static void* tyany_ptr(B x) {
return IS_SLICE(t)? c(TySlice,x)->a : c(TyArr,x)->a;
}
#define M_TYARR(OVER, MID, RV) { \
#define M_TYARR(OVER, MID, RV, PRE) { PRE \
Arr* r = m_arr(TYARR_SZW(w, ia) OVER, type, ia); \
MID \
*rp = RV; \
return ((TyArr*)r)->a; \
}
// width in bytes for m_tyarr*; overalloc is a byte count
static void* m_tyarrp (Arr** rp, usz w, usz ia, u8 type ) M_TYARR( , , r)
static void* m_tyarrpO(Arr** rp, usz w, usz ia, u8 type, usz over) M_TYARR(+over, , r)
static void* m_tyarrv (B* rp, usz w, usz ia, u8 type ) M_TYARR( , arr_shVec((Arr*)r);, taga(r))
static void* m_tyarrvO(B* rp, usz w, usz ia, u8 type, usz over) M_TYARR(+over, arr_shVec((Arr*)r);, taga(r))
static void* m_tyarrp (Arr** rp, usz w, usz ia, u8 type ) M_TYARR( , , r, )
static void* m_tyarrpO(Arr** rp, usz w, usz ia, u8 type, usz over) M_TYARR(+over, , r, )
static void* m_tyarrv (B* rp, usz w, usz ia, u8 type ) M_TYARR( , arr_shVec((Arr*)r);, taga(r), )
static void* m_tyarrvO(B* rp, usz w, usz ia, u8 type, usz over) M_TYARR(+over, arr_shVec((Arr*)r);, taga(r), )
static void* m_tyarrc (B* rp, usz w, B x, u8 type ) M_TYARR( , arr_shCopy((Arr*)r,x);, taga(r), usz ia = a(x)->ia;)
static void* m_tyarrcO(B* rp, usz w, B x, u8 type, usz over) M_TYARR(+over, arr_shCopy((Arr*)r,x);, taga(r), usz ia = a(x)->ia;)
extern u8 elType2type[];
#define el2t(X) elType2type[X] // TODO maybe reorganize array types such that this can just be addition?