Skip to content

Commit

Permalink
size fix
Browse files Browse the repository at this point in the history
  • Loading branch information
arnetheduck committed Dec 10, 2024
1 parent b9c0938 commit c42f695
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions bncurve/arith.nim
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func macDigit[N, N2: static int](
muladd2(carry, acc[i], 0, c, acc[i], carry)

func mulReduce(a: var BNU256, by: BNU256, modulo: static BNU256, inv: static uint64) =
var res {.align: 32.}: array[4 * 2, uint64]
var res {.align: 32.}: array[8, uint64]
staticFor i, 0 ..< 4:
macDigit(res, i, by, a[i])

Expand Down Expand Up @@ -323,9 +323,15 @@ func toBytes*(
): bool {.deprecated: "toBytesBE".} =
toBytesBE(src, dst)

func toString*(src: BNU256 | BNU512, lowercase = true): string =
func toString*(src: BNU256, lowercase = true): string =
## Convert 256bit integer ``src`` to big-endian hexadecimal representation.
var a: array[4 * sizeof(uint64), byte]
var a: array[32, byte]
discard src.toBytesBE(a)
a.toHex(lowercase)

func toString*(src: BNU512, lowercase = true): string =
## Convert 256bit integer ``src`` to big-endian hexadecimal representation.
var a: array[64, byte]
discard src.toBytesBE(a)
a.toHex(lowercase)

Expand Down

0 comments on commit c42f695

Please sign in to comment.