From d95a792230bf5bd42922d773e31ed6c3c2799aa3 Mon Sep 17 00:00:00 2001 From: dzaima Date: Wed, 14 Aug 2024 04:45:03 +0300 Subject: [PATCH] add bitwiden & bitnarrow to header --- src/core/stuff.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/stuff.h b/src/core/stuff.h index b4536882..d26ce7e2 100644 --- a/src/core/stuff.h +++ b/src/core/stuff.h @@ -195,6 +195,9 @@ void bit_negatePtr(u64* rp, u64* xp, usz count); // count is number of u64-s B widenBitArr(B x, ur axis); // consumes x, assumes bitarr; returns some array with cell size padded to the nearest of 8,16,32,64 if ≤64 bits, or a multiple of 64 bits otherwise B narrowWidenedBitArr(B x, ur axis, ur cr, usz* csh); // consumes x.val; undoes widenBitArr, overriding shape past axis to cr↑csh +void bitnarrow(void* rp, ux rcsz, void* xp, ux xcsz, ux cam); +void bitwiden(void* rp, ux rcsz, void* xp, ux xcsz, ux cam); + Arr* cpyWithShape(B x); // consumes; returns new array with the same shape as x; to allocate a new shape in its place, the previous one needs to be freed, rank set to 1, and then shape & rank set to the new ones Arr* emptyArr(B x, ur xr); // doesn't consume; returns an empty array with the same fill as x; if xr>1, shape must be set NOINLINE Arr* emptyWithFill(B fill); // consumes; returns new array with unset shape and the specified fill