add invert support

This commit is contained in:
Mathieu Lacage
2010-07-07 18:17:21 +02:00
parent 4d19ee3038
commit c68f49ad25

View File

@@ -44,6 +44,8 @@ public:
inline void Sub (HighPrecision const &o);
inline void Mul (HighPrecision const &o);
inline void Div (HighPrecision const &o);
inline void MulByInvert (const HighPrecision &o);
inline static HighPrecision Invert (uint64_t v);
inline int Compare (HighPrecision const &o) const;
inline static HighPrecision Zero (void);
@@ -101,6 +103,17 @@ HighPrecision::Div (HighPrecision const &o)
{
m_value /= o.m_value;
}
void
HighPrecision::MulByInvert (const HighPrecision &o)
{
m_value *= o.m_value;
}
HighPrecision
HighPrecision::Invert (uint64_t v)
{
return HighPrecision (1.0 / v);
}
int
HighPrecision::Compare (HighPrecision const &o) const
{