Fix endianness issue in toInt64 and toUint64
This commit is contained in:
parent
5980477e0b
commit
53ceaffdfa
|
@ -56,7 +56,10 @@ macro second_least_significant_word*(x: UintImpl or IntImpl): untyped =
|
||||||
macro least_significant_two_words*(x: UintImpl or IntImpl): untyped =
|
macro least_significant_two_words*(x: UintImpl or IntImpl): untyped =
|
||||||
var words = nnkBracket.newTree()
|
var words = nnkBracket.newTree()
|
||||||
asWordsImpl(x, x, words)
|
asWordsImpl(x, x, words)
|
||||||
result = nnkBracket.newTree(words[words.len - 2], words[words.len - 1])
|
when system.cpuEndian == bigEndian:
|
||||||
|
result = nnkBracket.newTree(words[words.len - 2], words[words.len - 1])
|
||||||
|
else:
|
||||||
|
result = nnkBracket.newTree(words[words.len - 1], words[words.len - 2])
|
||||||
|
|
||||||
# #########################################################################
|
# #########################################################################
|
||||||
# Iteration macros
|
# Iteration macros
|
||||||
|
|
|
@ -137,7 +137,7 @@ suite "Testing input and output procedures":
|
||||||
x.toUint == 2'u^32 + 1
|
x.toUint == 2'u^32 + 1
|
||||||
x.toUint64 == 2'u64^32 + 1
|
x.toUint64 == 2'u64^32 + 1
|
||||||
else:
|
else:
|
||||||
echo " Skipped when Stint forces uint32 backend in test mode"
|
echo "Next test skipped when Stint forces uint32 backend in test mode"
|
||||||
|
|
||||||
suite "Testing conversion functions: Hex, Bytes, Endianness using secp256k1 curve":
|
suite "Testing conversion functions: Hex, Bytes, Endianness using secp256k1 curve":
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue