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)
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-
luke-jr commented at 10:30 PM on June 21, 2012: member
-
0f5a2a82d9
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
- gmaxwell referenced this in commit 3dbca25b69 on Jul 11, 2012
- gmaxwell merged this on Jul 11, 2012
- gmaxwell closed this on Jul 11, 2012
- nifgraup referenced this in commit d14091ae22 on Mar 30, 2014
- suprnurd referenced this in commit f9730cb2ec on Dec 5, 2017
- lateminer referenced this in commit ac12fa4b6c on Jan 22, 2019
- lateminer referenced this in commit fd77102258 on May 6, 2020
- DrahtBot locked this on Sep 8, 2021
Contributors
Linked (view graph)