Changeset View
Changeset View
Standalone View
Standalone View
src/script/script.h
Show First 20 Lines • Show All 271 Lines • ▼ Show 20 Lines | inline CScriptNum operator-(const int64_t &rhs) const { | ||||
return CScriptNum(m_value - rhs); | return CScriptNum(m_value - rhs); | ||||
} | } | ||||
inline CScriptNum operator+(const CScriptNum &rhs) const { | inline CScriptNum operator+(const CScriptNum &rhs) const { | ||||
return operator+(rhs.m_value); | return operator+(rhs.m_value); | ||||
} | } | ||||
inline CScriptNum operator-(const CScriptNum &rhs) const { | inline CScriptNum operator-(const CScriptNum &rhs) const { | ||||
return operator-(rhs.m_value); | return operator-(rhs.m_value); | ||||
} | } | ||||
inline CScriptNum operator/(const int64_t &rhs) const { | |||||
return CScriptNum(m_value / rhs); | |||||
danconnolly: There was an open question here about whether to add an additional check for division by zero. | |||||
schancelAuthorUnsubmitted Not Done Inline ActionsI spoke with deadalnix on this. It should not be necessary. Any exception would be inappropriate anyways. I think just having a test for this case is sufficient. schancel: I spoke with deadalnix on this. It should not be necessary. Any exception would be… | |||||
} | |||||
inline CScriptNum operator/(const CScriptNum &rhs) const { | |||||
return operator/(rhs.m_value); | |||||
} | |||||
inline CScriptNum &operator+=(const CScriptNum &rhs) { | inline CScriptNum &operator+=(const CScriptNum &rhs) { | ||||
return operator+=(rhs.m_value); | return operator+=(rhs.m_value); | ||||
} | } | ||||
inline CScriptNum &operator-=(const CScriptNum &rhs) { | inline CScriptNum &operator-=(const CScriptNum &rhs) { | ||||
return operator-=(rhs.m_value); | return operator-=(rhs.m_value); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 367 Lines • Show Last 20 Lines |
There was an open question here about whether to add an additional check for division by zero. In the current implementation, this is checked before this operator is used, however this cannot be guaranteed for future uses of this operator. For previous inline comments, see https://reviews.bitcoinabc.org/D1093?id=2897