diff --git a/src/headers/ttmathuint_x86_64.h b/src/headers/ttmathuint_x86_64.h index 188fc5e..ecb639d 100644 --- a/src/headers/ttmathuint_x86_64.h +++ b/src/headers/ttmathuint_x86_64.h @@ -893,7 +893,7 @@ namespace ttmath template sint UInt::FindLeadingBitInWord(uint x) { - sint result; + int64_t result; #ifndef __GNUC__ @@ -909,7 +909,7 @@ namespace ttmath #ifdef __GNUC__ - uint dummy; + int64_t dummy; __asm__ ( @@ -918,7 +918,7 @@ namespace ttmath "cmovz %1, %0 \n" : "=r" (result), "=&r" (dummy) - : "r" (x) + : "r" (int64_t(x)) : "cc" ); #endif diff --git a/src/ttmath.nim b/src/ttmath.nim index 51bd9ad..181a822 100644 --- a/src/ttmath.nim +++ b/src/ttmath.nim @@ -1,10 +1,12 @@ import ttmathuint export ttmathuint import strutils +from os import DirSep -{.passC: "-I" & currentSourcePath.rsplit("/", 1)[0].} +const ttmathPath = currentSourcePath.rsplit(DirSep, 1)[0] +{.passC: "-I" & ttmathPath.} -const TTMATH_HEADER = "headers/ttmath.h" +const TTMATH_HEADER = ttmathPath & DirSep & "headers" & DirSep & "ttmath.h" type Int256* {.importc: "ttmath::Int<4>", header: TTMATH_HEADER.} = object diff --git a/src/ttmathuint.nim b/src/ttmathuint.nim index 3e59ae6..864a493 100644 --- a/src/ttmathuint.nim +++ b/src/ttmathuint.nim @@ -1,4 +1,7 @@ -const TTMATH_HEADER = "headers/ttmathuint.h" +from os import DirSep +from strutils import rsplit +const ttmathPath = currentSourcePath.rsplit(DirSep, 1)[0] +const TTMATH_HEADER = ttmathPath & DirSep & "headers" & DirSep & "ttmath.h" type UInt256* {.importc: "ttmath::UInt<4>", header: TTMATH_HEADER.} = object @@ -36,7 +39,7 @@ proc `or`*(a: UInt256, b: UInt256): UInt256 {.importcpp: "(# | #)".} proc `xor`*(a: UInt256, b: UInt256): UInt256 {.importcpp: "(# ^ #)".} -proc u256*(a: uint64): UInt256 {.importcpp: "ttmath::UInt<4>((uint)#)".} +proc u256*(a: uint64): UInt256 {.importcpp: "ttmath::UInt<4>((ttmath::uint)#)".} proc u256*(a: cstring): UInt256 {.importcpp: "ttmath::UInt<4>(#)".}