diff options
author | dzaima <dzaimagit@gmail.com> | 2024-05-22 20:07:48 +0300 |
---|---|---|
committer | dzaima <dzaimagit@gmail.com> | 2024-05-22 20:07:48 +0300 |
commit | f14583f995363f3e549a856b3ba8d1201c324959 (patch) | |
tree | 96ee2edc69518c02f6d0fe678bfdd7b9f0aa7415 | |
parent | f5e536aefeeb53fea0169b453f9ee08f55d3e69a (diff) |
faster ⍉ on large‿small⥊x
-rw-r--r-- | src/builtins/transpose.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/builtins/transpose.c b/src/builtins/transpose.c index 786d998d..3dd2c86f 100644 --- a/src/builtins/transpose.c +++ b/src/builtins/transpose.c @@ -52,7 +52,8 @@ #define DECL_BASE(T) \ static NOINLINE void transpose_##T(void* rv, void* xv, u64 bw, u64 bh, u64 w, u64 h) { \ T* rp=rv; T* xp=xv; \ - PLAINLOOP for(ux y=0;y<bh;y++) NOVECTORIZE for(ux x=0;x<bw;x++) rp[x*h+y] = xp[y*w+x]; \ + if (bh<bw) { PLAINLOOP for(ux y=0;y<bh;y++) NOVECTORIZE for(ux x=0;x<bw;x++) rp[x*h+y] = xp[y*w+x]; } \ + else { PLAINLOOP for(ux x=0;x<bw;x++) NOVECTORIZE for(ux y=0;y<bh;y++) rp[x*h+y] = xp[y*w+x]; } \ } DECL_BASE(i8) DECL_BASE(i16) DECL_BASE(i32) DECL_BASE(i64) #undef DECL_BASE |