Created
January 2, 2012 16:18
-
-
Save anonymous/1551264 to your computer and use it in GitHub Desktop.
libtommathtest_jaeckel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include<conio.h> | |
#include"tommath.h" | |
/* | |
int mp_int_loader(mp_int *a){ | |
} | |
*/ | |
void show_mp_int_fullinfo(mp_int *a){ | |
int i; | |
printf("\na.used = %d\n", a->used); | |
printf("a.alloc = %d\n", a->alloc); | |
printf("a.sign = %d\n", a->sign); | |
i = a->used - 1; | |
for(;i>=0;i--) | |
printf("dp[%d] = %d\n", i, a->dp[i] ); | |
} | |
void show_mp_int(mp_int *a){ | |
int i; | |
for(i = (a->used) - 1; i>=0; i--){ | |
printf("dp[%d] = %d\n", i, a->dp[i] ); | |
} | |
} | |
int main() | |
{ | |
const unsigned char test="ABC"; | |
mp_int a, b, c; | |
mp_init(&a); | |
show_mp_int_fullinfo(&a); | |
mp_init(&b); | |
show_mp_int_fullinfo(&b); | |
mp_init(&c); | |
show_mp_int_fullinfo(&c); | |
/** | |
mp_set_int(&a, 1073741824); // 268435456 // 10425 | |
show_mp_int_fullinfo(&a); | |
if( getch() == 'q' ) exit(0); | |
mp_set(&b, 268435455); // 268435458 (prev val + 2) // 22483 | |
show_mp_int_fullinfo(&b); | |
if( getch() == 'q' ) exit(0); | |
mp_add(&a, &b, &c); | |
show_mp_int_fullinfo(&c); | |
if( getch() == 'q' ) exit(0); | |
**/ | |
mp_read_unsigned_bin(&a, test, 1); | |
show_mp_int_fullinfo(&a); | |
getch(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment