Fix x64 gmp init on platforms that define UL as 32 bits. #9

pull evoskuil wants to merge 1 commits into bitcoin-core:master from evoskuil:master changing 1 files +1 −1
  1. evoskuil commented at 9:16 am on April 26, 2014: contributor
  2. evoskuil renamed this:
    Fix x64 gmp initialization on platforms that defined UL as 32 bits.
    Fix x64 gmp init on platforms that defined UL as 32 bits.
    on Apr 26, 2014
  3. evoskuil renamed this:
    Fix x64 gmp init on platforms that defined UL as 32 bits.
    Fix x64 gmp init on platforms that define UL as 32 bits.
    on Apr 26, 2014
  4. in src/field_gmp_impl.h: in 99832a3c4e outdated
    17@@ -18,7 +18,7 @@ void static secp256k1_fe_inner_start(void) {
    18     for (int i=0; i<(33+GMP_NUMB_BITS-1)/GMP_NUMB_BITS; i++)
    19         secp256k1_field_pc[i] = 0;
    20     secp256k1_field_pc[0] += 0x3D1UL;
    21-    secp256k1_field_pc[32/GMP_NUMB_BITS] += (1UL << (32 % GMP_NUMB_BITS));
    22+    secp256k1_field_pc[32/GMP_NUMB_BITS] += (1ULL << (32 % GMP_NUMB_BITS));
    


    sipa commented at 10:02 am on April 29, 2014:
    How about ((mp_limb_t)1) « (32 % GMP_NUMB_BITS) ?

    evoskuil commented at 6:33 pm on April 29, 2014:
    Sure, that works too.
  5. genjix commented at 6:20 am on May 7, 2014: none
    can this pull request be closed?
  6. sipa commented at 4:24 pm on May 8, 2014: contributor
    I presume there’s a bug being fixed here. @evoskuil I would prefer using the mp_limb_t cast, as it’s more obviously correct.
  7. Fix x64 gmp init on platforms that define UL as 32 bits. ac274bff23
  8. evoskuil commented at 5:34 pm on May 8, 2014: contributor
    Yes, the resulting value is incorrect in a 64 bit build if long is defined as 32 bits (as in msvc), causing all tests to fail. With this change (either technique) all tests pass.
  9. sipa merged this on May 8, 2014
  10. sipa closed this on May 8, 2014

  11. sipa referenced this in commit a797ceffdf on May 8, 2014

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-30 05:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me