Skip to content

Commit

Permalink
support new (and old) form of unchecked arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
brentp committed Nov 19, 2018
1 parent cf28dc4 commit df14b1e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/hts/bam/cigar.nim
Expand Up @@ -2,7 +2,12 @@ import ../private/hts_concat
import strutils
# https://forum.nim-lang.org/t/567 (by Jehan)
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
type CArray{.unchecked.}[T] = array[0..0, T]
#
when defined(nimUncheckedArrayTyp):
type CArray[T] = UncheckedArray[T]
else:
type CArray{.unchecked.}[T] = array[0..0, T]

type CPtr*[T] = ptr CArray[T]

type SafeCPtr*[T] =
Expand Down
8 changes: 7 additions & 1 deletion src/hts/vcf.nim
Expand Up @@ -3,6 +3,12 @@ import strutils
import system
import sequtils


when defined(nimUncheckedArrayTyp):
type CArray[T] = UncheckedArray[T]
else:
type CArray{.unchecked.}[T] = array[0..0, T]

type
Header* = ref object of RootObj
## Header wraps the bam header info.
Expand Down Expand Up @@ -33,7 +39,7 @@ type
v*: Variant
p*: pointer

CArray{.unchecked.}[T] = array[0..0, T]

CPtr*[T] = ptr CArray[T]

SafeCPtr*[T] =
Expand Down

0 comments on commit df14b1e

Please sign in to comment.