From 854aaed7643cc2224987738f04384f884d1084d5 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Tue, 12 Jan 2016 07:42:30 -0500 Subject: some FP wrappers and test code, not very good yet --- bigtest.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 bigtest.c (limited to 'bigtest.c') diff --git a/bigtest.c b/bigtest.c new file mode 100644 index 0000000..f6b2551 --- /dev/null +++ b/bigtest.c @@ -0,0 +1,44 @@ +#include +#include + +#include "bignum.h" + +unsigned long values[] = { + 123456789L, + 12345678L, + 1234567L, + 123456L, + 65536L, + 65535L, + 4294966190L, /* works, (2**32-1)-1105 */ + 4294967295L, + 665, + 78, + 1, + 0 +}; + +int main(void) { + char i, j; + unsigned long l = 123456789L; // 075bcd15, or 52501 + 256 * 1883 + bignum(b); + + /* + ulong_to_big(l, b); + for(i=0; i<6; i++) + printf("%02x ", b[i]); + */ + + POKEW(19,0); + for(i=0; i < (sizeof(values)) / (sizeof(long)); i++) { + l = values[i]; + printf("%lu: ", l); + ulong_to_big(l, b); + l = 666L; + j = big_to_ulong(b, &l); + printf("%d %lu\n", j, l); + } + + printf("%d\n", PEEK(20)+256*PEEK(19)); +hang: goto hang; +} -- cgit v1.2.3