CBigNum: Convert negative int64 values in a more well-defined way #1497

pull luke-jr wants to merge 1 commits into bitcoin:master from luke-jr:bugfix_neguint changing 1 files +3 −9
  1. luke-jr commented at 10:30 PM on June 21, 2012: member

    Since the minimum signed integer cannot be represented as positive so long as its type is signed, and it's not well-defined what happens if you make it unsigned before negating it, we instead increment the negative integer by 1, convert it, then increment the (now positive) unsigned integer by 1 to compensate @wizeman recently introduced this potential-bug in #1298, so I'd appreciate if he could comment (did not get a response on IRC)

  2. CBigNum: Convert negative int64 values in a more well-defined way
    Since the minimum signed integer cannot be represented as positive so long as its type is signed, and it's not well-defined what happens if you make it unsigned before negating it, we instead increment the negative integer by 1, convert it, then increment the (now positive) unsigned integer by 1 to compensate
    0f5a2a82d9
  3. gmaxwell referenced this in commit 3dbca25b69 on Jul 11, 2012
  4. gmaxwell merged this on Jul 11, 2012
  5. gmaxwell closed this on Jul 11, 2012

  6. nifgraup referenced this in commit d14091ae22 on Mar 30, 2014
  7. suprnurd referenced this in commit f9730cb2ec on Dec 5, 2017
  8. lateminer referenced this in commit ac12fa4b6c on Jan 22, 2019
  9. lateminer referenced this in commit fd77102258 on May 6, 2020
  10. DrahtBot locked this on Sep 8, 2021
Contributors

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 15:16 UTC

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