mirror of
https://github.com/edwinb/Idris2-boot.git
synced 2024-08-17 03:40:33 +03:00
Merge pull request #367 from cypheon/bugfix/ttc-bigint-unmarshalling
Fix unmarshalling of Integer values in TTC (Fixes: #345)
This commit is contained in:
commit
c0b7c6a9d8
@ -383,17 +383,16 @@ count : List.Elem x xs -> Int
|
||||
count Here = 0
|
||||
count (There p) = 1 + count p
|
||||
|
||||
toLimbs : Integer -> List Int
|
||||
toLimbs : Integer -> List Bits8
|
||||
toLimbs x
|
||||
= if x == 0
|
||||
then []
|
||||
else if x == -1 then [-1]
|
||||
else fromInteger (prim__andBigInt x 0xffffffff) ::
|
||||
toLimbs (prim__ashrBigInt x 32)
|
||||
else fromInteger (prim__andBigInt x 0xff) ::
|
||||
toLimbs (prim__ashrBigInt x 8)
|
||||
|
||||
fromLimbs : List Int -> Integer
|
||||
fromLimbs : List Bits8 -> Integer
|
||||
fromLimbs [] = 0
|
||||
fromLimbs (x :: xs) = cast x + prim__shlBigInt (fromLimbs xs) 32
|
||||
fromLimbs (x :: xs) = prim__zextB8_BigInt x + prim__shlBigInt (fromLimbs xs) 8
|
||||
|
||||
export
|
||||
TTC Integer where
|
||||
|
@ -1,4 +1,4 @@
|
||||
[3518437212327232157160858338944, 1537557061787000452679295093927559, 3518437212327232157160858338070, 8051343735302590748651849744, 379]
|
||||
[3518437212345678901234567890560, 1537557061795061679839506167983751, 3518437212345678901234567889686, 8051343735344802977653473432, 339]
|
||||
[8650625671965379659, 5435549321212129090, 8650625671965378905, 365458446121836181, 357]
|
||||
1/1: Building Numbers (Numbers.idr)
|
||||
Main> Main> Bye for now!
|
||||
|
Loading…
Reference in New Issue
Block a user