Merge pull request #2 from coffeepots/win-compatibility
Win compatibility
This commit is contained in:
commit
021c3935b0
|
@ -893,7 +893,7 @@ namespace ttmath
|
||||||
template<uint value_size>
|
template<uint value_size>
|
||||||
sint UInt<value_size>::FindLeadingBitInWord(uint x)
|
sint UInt<value_size>::FindLeadingBitInWord(uint x)
|
||||||
{
|
{
|
||||||
sint result;
|
int64_t result;
|
||||||
|
|
||||||
|
|
||||||
#ifndef __GNUC__
|
#ifndef __GNUC__
|
||||||
|
@ -909,7 +909,7 @@ namespace ttmath
|
||||||
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
uint dummy;
|
int64_t dummy;
|
||||||
|
|
||||||
__asm__ (
|
__asm__ (
|
||||||
|
|
||||||
|
@ -918,7 +918,7 @@ namespace ttmath
|
||||||
"cmovz %1, %0 \n"
|
"cmovz %1, %0 \n"
|
||||||
|
|
||||||
: "=r" (result), "=&r" (dummy)
|
: "=r" (result), "=&r" (dummy)
|
||||||
: "r" (x)
|
: "r" (int64_t(x))
|
||||||
: "cc" );
|
: "cc" );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
import ttmathuint
|
import ttmathuint
|
||||||
export ttmathuint
|
export ttmathuint
|
||||||
import strutils
|
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
|
type
|
||||||
Int256* {.importc: "ttmath::Int<4>", header: TTMATH_HEADER.} = object
|
Int256* {.importc: "ttmath::Int<4>", header: TTMATH_HEADER.} = object
|
||||||
|
|
|
@ -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
|
type
|
||||||
UInt256* {.importc: "ttmath::UInt<4>", header: TTMATH_HEADER.} = object
|
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 `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>(#)".}
|
proc u256*(a: cstring): UInt256 {.importcpp: "ttmath::UInt<4>(#)".}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue