use mut_copy for building fold_rows result
This commit is contained in:
parent
1c0b797456
commit
680d0f8601
@ -14,6 +14,7 @@
|
|||||||
#include "../core.h"
|
#include "../core.h"
|
||||||
#include "../builtins.h"
|
#include "../builtins.h"
|
||||||
#include "../utils/calls.h"
|
#include "../utils/calls.h"
|
||||||
|
#include "../utils/mut.h"
|
||||||
|
|
||||||
#if SINGELI_X86_64
|
#if SINGELI_X86_64
|
||||||
#define SINGELI_FILE fold
|
#define SINGELI_FILE fold
|
||||||
@ -337,7 +338,7 @@ B fold_rows(Md1D* fd, B x) {
|
|||||||
usz *sh = SH(x); usz n = sh[0]; usz m = sh[1];
|
usz *sh = SH(x); usz n = sh[0]; usz m = sh[1];
|
||||||
usz b = (block + m - 1) / m; // Normal block length
|
usz b = (block + m - 1) / m; // Normal block length
|
||||||
usz b_max = b + b/4; // Last block max length
|
usz b_max = b + b/4; // Last block max length
|
||||||
B r = bi_N;
|
MAKE_MUT(r, n);
|
||||||
BSS2A slice = TI(x,slice);
|
BSS2A slice = TI(x,slice);
|
||||||
for (usz i=0, im=0; i<n; ) {
|
for (usz i=0, im=0; i<n; ) {
|
||||||
usz l = n-i; if (l > b_max) { incG(x); l = b; }
|
usz l = n-i; if (l > b_max) { incG(x); l = b; }
|
||||||
@ -347,9 +348,10 @@ B fold_rows(Md1D* fd, B x) {
|
|||||||
ssh[0] = l;
|
ssh[0] = l;
|
||||||
ssh[1] = m;
|
ssh[1] = m;
|
||||||
B sr = insert_c1(fd, C1(transp, taga(sl)));
|
B sr = insert_c1(fd, C1(transp, taga(sl)));
|
||||||
r = q_N(r) ? sr : C2(join, r, sr);
|
mut_copy(r, i, sr, 0, l);
|
||||||
|
decG(sr);
|
||||||
i += l; im += sia;
|
i += l; im += sia;
|
||||||
}
|
}
|
||||||
return r;
|
return mut_fv(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user