Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bignum_from_string not works on odd nbytes #25

Open
minocoko opened this issue Jun 28, 2021 · 0 comments
Open

bignum_from_string not works on odd nbytes #25

minocoko opened this issue Jun 28, 2021 · 0 comments

Comments

@minocoko
Copy link

minocoko commented Jun 28, 2021

`
char buffer[500];
struct bn a, b, c;

bignum_from_string(&a, "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe", 64);
bignum_to_string(&a, buffer, 500);
printf("%s\n", buffer);

bignum_from_int(&b, 3);

bignum_add(&a, &b, &c);
bignum_to_string(&c, buffer, 500);
printf("%s\n", buffer);

`

length of "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe" is 63
if I change 64 to 63 and comment out
// require((nbytes & 1) == 0, "string format must be in hex -> equal number of bytes"); // require((nbytes % (sizeof(DTYPE) * 2)) == 0, "string length must be a multiple of (sizeof(DTYPE) * 2) characters");

that code works correct

PR created: #26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant