Skip to content

Commit

Permalink
endians: fix ambiguous endians2/io names (#162)
Browse files Browse the repository at this point in the history
* endians: fix ambiguous endians2/io names

* oops
  • Loading branch information
arnetheduck authored Dec 3, 2024
1 parent b06bb21 commit 12f85ad
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions stint/io.nim
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ func dumpHex*(a: StInt or StUint, order: static[Endianness] = bigEndian): string
# --------------------------------------------------------
{.push raises: [], inline, noinit, gcsafe.}

export fromBytes, toBytes, toBytesLE, toBytesBE
export fromBytes, toBytes, fromBytesLE, toBytesLE, fromBytesBE, toBytesBE

func readUintBE*[bits: static[int]](ba: openArray[byte]): StUint[bits] {.noinit, inline.}=
## Convert a big-endian array of (bits div 8) Bytes to an UInt[bits] (in native host endianness)
Expand All @@ -402,9 +402,6 @@ func toByteArrayBE*[bits: static[int]](n: StUint[bits]): array[bits div 8, byte]
## - a big-endian array of the same size
result = n.toBytesBE()

template fromBytesBE*(T: type StUint, ba: openArray[byte]): T {.deprecated: "endians2.fromBytesBE".}=
endians2.fromBytesBE(T, ba)

template initFromBytesBE*(x: var StUint, ba: openArray[byte]) =
x = endians2.fromBytesBE(type x, ba)

Expand All @@ -424,9 +421,6 @@ template toByteArrayLE*[bits: static[int]](n: StUint[bits]): array[bits div 8, b
## - a little-endian array of the same size
n.toBytesLE()

func fromBytesLE*(T: type StUint, ba: openArray[byte]): T {.deprecated: "endians2.fromBytesLE".} =
endians2.fromBytesLE(T, ba)

template initFromBytesLE*(x: var StUint, ba: openArray[byte]) =
x = fromBytesLE(type x, ba)

Expand All @@ -440,9 +434,6 @@ func readIntBE*[bits: static[int]](ba: openArray[byte]): StInt[bits] {.noinit, i
## - A signed integer of the same size with `bits` bits
result.impl = (typeof result.impl).fromBytesBE(ba)

func fromBytesBE*(T: type StInt, ba: openArray[byte]): T {.noinit, inline.}=
result = readIntBE[T.bits](ba)

template initFromBytesBE*(x: var StInt, ba: openArray[byte]) =
x = fromBytesBE(type x, ba)

Expand All @@ -462,18 +453,9 @@ template toByteArrayLE*[bits: static[int]](n: StInt[bits]): array[bits div 8, by
## - a little-endian array of the same size
result = n.impl.toBytesLE()

template fromBytesLE*(T: type StInt, ba: openArray[byte]): T {.deprecated: "endians2.fromBytesLE".} =
endians2.fromBytesLE(T, ba)

template initFromBytesLE*(x: var StInt, ba: openArray[byte]) =
x = fromBytesLE(type x, ba)

template toBytesLE*[bits: static[int]](n: StInt[bits]): array[bits div 8, byte] {.deprecated: "endians2.toBytesLE".} =
endians2.toBytesLE(n)

template toBytesBE*[bits: static[int]](n: StInt[bits]): array[bits div 8, byte] {.deprecated: "endians2.toBytesBE".} =
endians2.toBytesBE(n)

{.pop.}

include
Expand Down

0 comments on commit 12f85ad

Please sign in to comment.