aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorflatmush <flatmush@d3e1167c-abe1-51d5-8199-f9061ebe54e4>2011-03-02 14:21:26 +0000
committerflatmush <flatmush@d3e1167c-abe1-51d5-8199-f9061ebe54e4>2011-03-02 14:21:26 +0000
commit62eb1059a5b15e3229c2504818440be4b511c1a1 (patch)
treec6a34d0d7f1deae10a63ec26fa4b7465493512dd
parent46cb5cd8df43d3ca9f1877f1d6c810749f34867b (diff)
downloadlibfixmath-62eb1059a5b15e3229c2504818440be4b511c1a1.tar.gz
Updated C++ interface slightly, to make it more coherent.
-rw-r--r--libfixmath/fix16.hpp31
1 files changed, 16 insertions, 15 deletions
diff --git a/libfixmath/fix16.hpp b/libfixmath/fix16.hpp
index 4b376d8..3cdec7c 100644
--- a/libfixmath/fix16.hpp
+++ b/libfixmath/fix16.hpp
@@ -6,27 +6,28 @@ class Fix16 {
fix16_t value;
Fix16() { value = 0; }
- Fix16(const Fix16 &inValue) { value = inValue.value; }
- Fix16(const fix16_t inValue) { value = inValue; }
+ Fix16(const Fix16 &inValue) { value = inValue.value; }
+ Fix16(const fix16_t inValue) { value = inValue; }
Fix16(const float inValue) { value = fix16_from_float(inValue); }
- Fix16(const double inValue) { value = fix16_from_dbl(inValue); }
- Fix16(const int16_t inValue) { value = fix16_from_int(inValue); }
+ Fix16(const double inValue) { value = fix16_from_dbl(inValue); }
+ Fix16(const int16_t inValue) { value = fix16_from_int(inValue); }
- operator double() { return fix16_to_dbl(value); }
- operator float() { return fix16_to_float(value); }
- operator int() { return fix16_to_int(value); }
+ operator fix16_t() { return value; }
+ operator double() { return fix16_to_dbl(value); }
+ operator float() { return fix16_to_float(value); }
+ operator int16_t() { return fix16_to_int(value); }
- Fix16 & operator=(const Fix16 &rhs) { value = rhs.value; return *this; }
- Fix16 & operator=(const fix16_t rhs) { value = rhs; return *this; }
- Fix16 & operator=(const double rhs) { value = fix16_from_dbl(rhs); return *this; }
+ Fix16 & operator=(const Fix16 &rhs) { value = rhs.value; return *this; }
+ Fix16 & operator=(const fix16_t rhs) { value = rhs; return *this; }
+ Fix16 & operator=(const double rhs) { value = fix16_from_dbl(rhs); return *this; }
Fix16 & operator=(const float rhs) { value = fix16_from_float(rhs); return *this; }
- Fix16 & operator=(const int16_t rhs) { value = fix16_from_int(rhs); return *this; }
+ Fix16 & operator=(const int16_t rhs) { value = fix16_from_int(rhs); return *this; }
- Fix16 & operator+=(const Fix16 &rhs) { value += rhs.value; return *this; }
- Fix16 & operator+=(const fix16_t rhs) { value += rhs; return *this; }
- Fix16 & operator+=(const double rhs) { value += fix16_from_dbl(rhs); return *this; }
+ Fix16 & operator+=(const Fix16 &rhs) { value += rhs.value; return *this; }
+ Fix16 & operator+=(const fix16_t rhs) { value += rhs; return *this; }
+ Fix16 & operator+=(const double rhs) { value += fix16_from_dbl(rhs); return *this; }
Fix16 & operator+=(const float rhs) { value += fix16_from_float(rhs); return *this; }
- Fix16 & operator+=(const int16_t rhs) { value += fix16_from_int(rhs); return *this; }
+ Fix16 & operator+=(const int16_t rhs) { value += fix16_from_int(rhs); return *this; }
Fix16 & operator-=(const Fix16 &rhs) { value -= rhs.value; return *this; }
Fix16 & operator-=(const fix16_t rhs) { value -= rhs; return *this; }