mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Stage testing of bignum2_plus_unsigned
This commit is contained in:
parent
b2879f8f36
commit
3050be9004
3 changed files with 13 additions and 1 deletions
|
@ -1607,6 +1607,7 @@ void Cyc_int2bignum(int n, mp_int *bn);
|
|||
object Cyc_int2bignum2(gc_thread_data *data, int n);
|
||||
// TODO: debug only, remove this function from here!
|
||||
string_type *bignum2string(void *data, bignum2_type *bn, int base);
|
||||
object bignum2_plus_unsigned(void *data, bignum2_type *x, bignum2_type *y, int negp);
|
||||
|
||||
/* Remaining GC prototypes that require objects to be defined */
|
||||
void *gc_alloc_from_bignum(gc_thread_data *data, bignum_type *src);
|
||||
|
|
|
@ -2762,7 +2762,7 @@ object bignum2_plus_unsigned(void *data, bignum2_type *x, bignum2_type *y, int n
|
|||
assert(scan_r <= end_r);
|
||||
|
||||
// TODO: return C_bignum_simplify(result);
|
||||
return NULL; // DEBUG only!
|
||||
return result; // TODO: no, could be a fixnum. need to simplify using above!
|
||||
}
|
||||
|
||||
object Cyc_symbol2string(void *data, object cont, object sym)
|
||||
|
|
11
test-bn.scm
11
test-bn.scm
|
@ -1,6 +1,13 @@
|
|||
; ./sync.sh runtime.c gc.c include/cyclone/*.h test-bn.scm && cd ../cyclone-bootstrap && rm -f cyclone libcyclone.a ; ./install.sh && ./cyclone -L. -I. test-bn.scm && ./test-bn && cd ../cyclone
|
||||
(import (scheme base) (scheme write) (scheme repl))
|
||||
|
||||
(define-c test-plus
|
||||
"(void *data, int argc, closure _, object k, object fx1, object fx2)"
|
||||
" object bn1 = Cyc_int2bignum2(data, obj_obj2int(fx1));
|
||||
object bn2 = Cyc_int2bignum2(data, obj_obj2int(fx2));
|
||||
object result = bignum2_plus_unsigned(data, bn1, bn2, 0); // TODO: int negp);
|
||||
return_closcall1(data, k, result);
|
||||
")
|
||||
(define-c test-bn
|
||||
"(void *data, int argc, closure _, object k, object fx)"
|
||||
" object bn = Cyc_int2bignum2(data, obj_obj2int(fx));
|
||||
|
@ -25,11 +32,15 @@
|
|||
(write row)
|
||||
(newline))
|
||||
(list
|
||||
(test-plus 1 2)
|
||||
(test-plus -1 2)
|
||||
(test-plus #x0FFFffff #x0FFFffff)
|
||||
(test-bn 123456789 )
|
||||
(test-bn 123456789 )
|
||||
(test-larger-bn 0 #x0FFF0001 )
|
||||
(test-bn #x0FFF0001 )
|
||||
|
||||
(test-bn 0 ) ;; TODO: 0 is broken right now!
|
||||
(test-bn -10 )
|
||||
(test-bn 163264 )
|
||||
(test-bn 16326 )
|
||||
|
|
Loading…
Add table
Reference in a new issue