From 39f2b95140d441806f5b7c1ad241914bbe76c15a Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Mon, 11 Mar 2013 00:59:57 -0700 Subject: [PATCH] More convenience functions. --- src/cpp/ripple/SerializedTypes.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/cpp/ripple/SerializedTypes.h b/src/cpp/ripple/SerializedTypes.h index f407bfae86..30cb3b8fb2 100644 --- a/src/cpp/ripple/SerializedTypes.h +++ b/src/cpp/ripple/SerializedTypes.h @@ -435,6 +435,15 @@ public: static STAmount divRound(const STAmount& v1, const STAmount& v2, const uint160& currency, const uint160& issuer, bool roundUp); + static STAmount mulRound(const STAmount& v1, const STAmount& v2, const STAmount& saUnit, bool roundUp) + { return mulRound(v1, v2, saUnit.getCurrency(), saUnit.getIssuer(), roundUp); } + static STAmount mulRound(const STAmount& v1, const STAmount& v2, bool roundUp) + { return mulRound(v1, v2, v1.getCurrency(), v1.getIssuer(), roundUp); } + static STAmount divRound(const STAmount& v1, const STAmount& v2, const STAmount& saUnit, bool roundUp) + { return divRound(v1, v2, saUnit.getCurrency(), saUnit.getIssuer(), roundUp); } + static STAmount divRound(const STAmount& v1, const STAmount& v2, bool roundUp) + { return divRound(v1, v2, v2.getCurrency(), v2.getIssuer(), roundUp); } + // Someone is offering X for Y, what is the rate? // Rate: smaller is better, the taker wants the most out: in/out static uint64 getRate(const STAmount& offerOut, const STAmount& offerIn);