Skip to content

Commit

Permalink
handle Nim 1.6 type =destroy hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
Vindaar committed Mar 4, 2024
1 parent d4c33e4 commit 371c8f4
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions impulse/fft/c_pocketfft/pocketfft.nim
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,22 @@ type
pocket*: cfft_plan
length*: int

proc `=destroy`*(plan: FFTPlanReal) =
## Frees the `rfft_plan`
destroy_rfft_plan(plan.pocket)

proc `=destroy`(plan: FFTPlanComplex) =
## Frees the `cfft_plan`
destroy_cfft_plan(plan.pocket)
when (NimMajor, NimMinor, NimPatch) >= (2, 0, 0):
proc `=destroy`*(plan: FFTPlanReal) =
## Frees the `rfft_plan`
destroy_rfft_plan(plan.pocket)

proc `=destroy`(plan: FFTPlanComplex) =
## Frees the `cfft_plan`
destroy_cfft_plan(plan.pocket)
else:
proc `=destroy`*(plan: var FFTPlanReal) =
## Frees the `rfft_plan`
destroy_rfft_plan(plan.pocket)

proc `=destroy`(plan: var FFTPlanComplex) =
## Frees the `cfft_plan`
destroy_cfft_plan(plan.pocket)

proc init*(_: typedesc[FFTPlanReal], length: int): FFTPlanReal =
result = FFTPlanReal(pocket: make_rfft_plan(length.csize_t))
Expand Down

0 comments on commit 371c8f4

Please sign in to comment.