Skip to content

Commit

Permalink
allow switching between simdArray versions
Browse files Browse the repository at this point in the history
  • Loading branch information
jcosborn committed Nov 16, 2024
1 parent d66f963 commit bfac7cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 7 additions & 1 deletion src/simd.nim
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ template msa(T: untyped, N: static[int], F: typedesc) {.dirty,used.} =
#makeSimdArray(N, F, `T Obj`)
#template `T Array` = discard
#makeSimdArray(`T Obj`, N, F)
type `T Obj`* = SimdArrayObj[N,F]
when declared SimdArrayObj:
type `T Obj`* = SimdArrayObj[N,F]
else:
makeSimdArray(`T Obj`, N, F)
type T* = Simd[`T Obj`]
type `T Array`* = `T Obj`
#static: echo "made type", $T
Expand Down Expand Up @@ -340,6 +343,9 @@ macro simdObjType*(N: static int, T: typedesc): auto =
type
SimdObjType*[N:static int, T] = simdObjType(N,T)

when not declared SimdArrayObj:
type SimdArrayObj*[N:static int,T] = SimdObjType[N,T]

#[
template toDoubleImpl*(x: T): auto =
mixin simdObjType, assign
Expand Down
8 changes: 4 additions & 4 deletions src/simd/simdArray.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#import simdArrayOld
#export simdArrayOld
import simdArrayOld
export simdArrayOld

import simdArrayNew
export simdArrayNew
#import simdArrayNew
#export simdArrayNew

0 comments on commit bfac7cb

Please sign in to comment.