PPaste!

Bigints!!!!!!!!!§§§§§§

Home - All the pastes - Authored by Thooms

Raw version

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
    // Addition with two numbers of different slices number, with a
    // carry from the first slice to the second and a final carry
    bignum_init_u64(&b1, 0x2BAF3C89D41AB2F3);
    bignum_init_hexstr(&b2, "FFFFFFFFFFFFFFFFFEDCBA9876543210");
    bignum_add(&b1, &b2);
    convstr = bignum_to_hexstr(&b1);
    ASSERT_EXPR(strcmp(convstr, "000000000000000100000000000000002A8BF7224A6EE503") == 0);
    free(convstr);
    bignum_fini(&b1);
    bignum_fini(&b2);