avoid unnecessarily copying •FBytes result

This commit is contained in:
dzaima 2025-06-15 03:59:03 +03:00
parent 307be40ac7
commit dcf150cef2

View File

@ -801,12 +801,10 @@ B fchars_c2(B d, B w, B x) {
} }
STATIC_GLOBAL NFnDesc* fBytesDesc; STATIC_GLOBAL NFnDesc* fBytesDesc;
B fbytes_c1(B d, B x) { B fbytes_c1(B d, B x) {
I8Arr* tf = path_bytes(path_rel(nfn_objU(d), x, "•file.Bytes")); TyArr* tf = path_bytes(path_rel(nfn_objU(d), x, "•file.Bytes"));
usz ia = PIA(tf); assert(tf->type == t_i8arr && reusable(taga(tf)));
u8* rp; B r = m_c8arrv(&rp, ia); tf->type = t_c8arr;
COPY_TO(rp, el_i8, 0, taga(tf), 0, ia); return taga(tf);
ptr_dec(tf);
return r;
} }
B fbytes_c2(B d, B w, B x) { B fbytes_c2(B d, B w, B x) {
if (isAtm(x) || RNK(x)!=1) thrM("𝕨 •file.Bytes 𝕩: 𝕩 must be a list"); if (isAtm(x) || RNK(x)!=1) thrM("𝕨 •file.Bytes 𝕩: 𝕩 must be a list");