From 99eaa9201a1f2243b23dd74ba3268da1c86d8905 Mon Sep 17 00:00:00 2001 From: Richard Holland Date: Mon, 11 Jul 2022 15:55:14 +0000 Subject: [PATCH] static builds / change overflow to overflow_float for some compilers --- src/ripple/app/hook/Enum.h | 2 +- src/ripple/app/hook/impl/applyHook.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ripple/app/hook/Enum.h b/src/ripple/app/hook/Enum.h index d289eb764..566c70886 100644 --- a/src/ripple/app/hook/Enum.h +++ b/src/ripple/app/hook/Enum.h @@ -206,7 +206,7 @@ namespace hook_api MANTISSA_UNDERSIZED = -27, EXPONENT_OVERSIZED = -28, EXPONENT_UNDERSIZED = -29, - OVERFLOW = -30, // if an operation with a float results in an overflow + OVERFLOW_FLOAT = -30, // if an operation with a float results in an overflow NOT_IOU_AMOUNT = -31, NOT_AN_AMOUNT = -32, CANT_RETURN_NEGATIVE = -33, diff --git a/src/ripple/app/hook/impl/applyHook.cpp b/src/ripple/app/hook/impl/applyHook.cpp index c7b841d60..d03caf36e 100644 --- a/src/ripple/app/hook/impl/applyHook.cpp +++ b/src/ripple/app/hook/impl/applyHook.cpp @@ -4050,7 +4050,7 @@ inline int64_t mulratio_internal } catch (std::overflow_error& e) { - return OVERFLOW; + return OVERFLOW_FLOAT; } } @@ -4084,7 +4084,7 @@ inline int64_t float_multiply_internal_parts( while (man_lo > maxMantissa) { if (exp_out > maxExponent) - return OVERFLOW; + return OVERFLOW_FLOAT; man_lo /= 10; exp_out++; } @@ -4096,11 +4096,11 @@ inline int64_t float_multiply_internal_parts( { man_shifted -=32; if (mulratio_internal(man_out, exp_out, false, 0xFFFFFFFFU, 1) < 0) - return OVERFLOW; + return OVERFLOW_FLOAT; } if (mulratio_internal(man_out, exp_out, false, 1U << man_shifted, 1) < 0) - return OVERFLOW; + return OVERFLOW_FLOAT; // now we have our product return make_float(man_out, exp_out); @@ -4136,7 +4136,7 @@ DEFINE_HOOK_FUNCTION( } if (exp1 > dp) - return OVERFLOW; + return OVERFLOW_FLOAT; while (exp1 < dp && man1 > 0) { @@ -4195,7 +4195,7 @@ DEFINE_HOOK_FUNCTION( int32_t exp1 = get_exponent(float1); if (mulratio_internal(man1, exp1, round_up > 0, numerator, denominator) < 0) - return OVERFLOW; + return OVERFLOW_FLOAT; return make_float(man1, exp1); } @@ -4251,7 +4251,7 @@ DEFINE_HOOK_FUNCTION( } catch (std::overflow_error& e) { - return OVERFLOW; + return OVERFLOW_FLOAT; } } @@ -4281,7 +4281,7 @@ DEFINE_HOOK_FUNCTION( } catch (std::overflow_error& e) { - return OVERFLOW; + return OVERFLOW_FLOAT; } }