MCPcopy Create free account
hub / github.com/BitcoinUnlimited/BitcoinUnlimited / safeAdd

Method safeAdd

src/script/script.h:386–394  ·  view source on GitHub ↗

Arithmetic operations

Source from the content-addressed store, hash-verified

384
385 // Arithmetic operations
386 ScriptNumResult safeAdd(int64_t x) const noexcept
387 {
388 const bool overflow = __builtin_add_overflow(_value, x, &x);
389 if (overflow)
390 {
391 return boost::none;
392 }
393 return fromInt(x);
394 }
395
396 ScriptNumResult safeAdd(CScriptNum const &x) const noexcept { return safeAdd(x._value); }
397

Callers 6

StepMethod · 0.45
CheckAddOldRulesFunction · 0.45
CheckAddNewRulesFunction · 0.45
RunCreateOldRulesSetFunction · 0.45
RunCreateNewRulesSetFunction · 0.45
CheckTxTokensFunction · 0.45

Calls

no outgoing calls

Tested by 4

CheckAddOldRulesFunction · 0.36
CheckAddNewRulesFunction · 0.36
RunCreateOldRulesSetFunction · 0.36
RunCreateNewRulesSetFunction · 0.36