bips icon indicating copy to clipboard operation
bips copied to clipboard

64bit arithmetic op codes

Open Christewart opened this issue 2 years ago • 2 comments

This BIP describes a soft fork to add 64-bit arithmetic op codes to bitcoin

Implementation: https://github.com/bitcoin/bitcoin/pull/29221

Christewart avatar Jan 10 '24 20:01 Christewart

Why not push the overflow amount and the result back on the stack?

Rather than $2^{64}-1 + 3 = \mbox{FALSE}$, do $2^{64}-1 + 3 = 2, 1$. Where $2 = 2^{64}-1 + 3 \mod 2^{64}$ is the result and 1 is the overflow.

This would simply doing 256-bit math from 64-bit stack elements and I don't see any downsides for 64-bit operations.

EthanHeilman avatar Jan 17 '24 16:01 EthanHeilman

Why not push the overflow amount and the result back on the stack?

Rather than 264−1+3=FALSE, do 264−1+3=2,1. Where 2=264−1+3mod264 is the result and 1 is the overflow.

This would simply doing 256-bit math from 64-bit stack elements and I don't see any downsides for 64-bit operations.

Sorry I don't understand this. Could you maybe give a more concrete example, perhaps on delvingbitcoin? We have a thread going here: https://delvingbitcoin.org/t/64-bit-arithmetic-soft-fork/397/25

Christewart avatar Feb 01 '24 21:02 Christewart