MCPcopy Create free account
hub / github.com/ElementsProject/elements / MultiplicationOverflow

Function MultiplicationOverflow

src/test/fuzz/util.h:214–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212
213template <typename T>
214[[nodiscard]] bool MultiplicationOverflow(const T i, const T j) noexcept
215{
216 static_assert(std::is_integral<T>::value, "Integral required.");
217 if (std::numeric_limits<T>::is_signed) {
218 if (i > 0) {
219 if (j > 0) {
220 return i > (std::numeric_limits<T>::max() / j);
221 } else {
222 return j < (std::numeric_limits<T>::min() / i);
223 }
224 } else {
225 if (j > 0) {
226 return i < (std::numeric_limits<T>::min() / j);
227 } else {
228 return i != 0 && (j < (std::numeric_limits<T>::max() / i));
229 }
230 }
231 } else {
232 return j != 0 && i > std::numeric_limits<T>::max() / j;
233 }
234}
235
236[[nodiscard]] bool ContainsSpentInput(const CTransaction& tx, const CCoinsViewCache& inputs) noexcept;
237

Callers 3

FUZZ_TARGET_INITFunction · 0.85
FUZZ_TARGETFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected