Skip to content

Commit

Permalink
Merge pull request #4 from aguspiza/fix-nim-020
Browse files Browse the repository at this point in the history
fix case warning with nim 0.20.0+
  • Loading branch information
ba0f3 authored Jul 23, 2019
2 parents e498592 + 2923276 commit ec1dd83
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions struct.nim
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,16 @@ proc getSize(t: char): int {.noSideEffect, inline.} =
of 'q', 'Q', 'd': 8
else: 0

proc newStructChar*(c: char): StructNode =
result.kind = StructChar
result.ch = c
proc newStructChar*(c: char): StructNode = StructNode(kind: StructChar, ch: c)

proc newStructBool*(b: bool): StructNode =
result.kind = StructBool
result.bval = b
proc newStructBool*(b: bool): StructNode = StructNode(kind: StructBool, bval: b)

proc newStructInt*[T: uint|int|int16|uint16|int32|uint32|int64|uint64|BiggestInt](i: T): StructNode =
result.kind = StructInt
result.num = i.BiggestInt
proc newStructInt*[T: uint|int|int16|uint16|int32|uint32|int64|uint64|BiggestInt](i: T): StructNode =
result = StructNode(kind: StructInt, num: i.BiggestInt)

proc newStructFloat*(d: BiggestFloat): StructNode =
result.kind = StructFloat
result.fval = d
proc newStructFloat*(d: BiggestFloat): StructNode = StructNode(kind: StructFloat, fval: d)

proc newStructString*(s: string): StructNode =
result.kind = StructString
result.str = s
proc newStructString*(s: string): StructNode = StructNode(kind: StructString, str: s)

proc newStructContext(): StructContext =
result.byteOrder = system.cpuEndian
Expand Down

0 comments on commit ec1dd83

Please sign in to comment.