math.big: minor clean up
parent
b3e0926601
commit
939e10cb28
|
@ -1,6 +1,7 @@
|
||||||
## V 0.1.30
|
## V 0.1.30
|
||||||
*28 Nov 2020*
|
*28 Nov 2020*
|
||||||
(V 0.2 RC)
|
(V 0.2 RC)
|
||||||
|
- Builtin compile-time JSON serializer now supports `time.Time`
|
||||||
TODO
|
TODO
|
||||||
|
|
||||||
## V 0.1.27
|
## V 0.1.27
|
||||||
|
|
|
@ -106,18 +106,6 @@ pub fn from_string(input string) Number {
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_string2(input string) Number {
|
|
||||||
mut n := Number{}
|
|
||||||
C.bignum_init(&n)
|
|
||||||
if input.len == 0 {
|
|
||||||
return from_int(0)
|
|
||||||
}
|
|
||||||
for i, c in input {
|
|
||||||
n.array[i] = u32(c - `0`)
|
|
||||||
}
|
|
||||||
return n
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn (n Number) int() int {
|
pub fn (n Number) int() int {
|
||||||
r := C.bignum_to_int(&n)
|
r := C.bignum_to_int(&n)
|
||||||
return r
|
return r
|
||||||
|
|
|
@ -78,10 +78,6 @@ fn test_mod() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_from_str() {
|
fn test_from_str() {
|
||||||
x := big.from_string2('23')
|
|
||||||
println('kek')
|
|
||||||
println(x.str())
|
|
||||||
exit(0)
|
|
||||||
assert big.from_string('').hexstr() == '0'
|
assert big.from_string('').hexstr() == '0'
|
||||||
assert big.from_string('1').hexstr() == '1'
|
assert big.from_string('1').hexstr() == '1'
|
||||||
assert big.from_string('0').hexstr() == '0'
|
assert big.from_string('0').hexstr() == '0'
|
||||||
|
|
Loading…
Reference in New Issue