Updated C++ interface slightly, to make it more coherent.

This commit is contained in:
flatmush 2011-03-02 14:21:26 +00:00
parent 46cb5cd8df
commit 62eb1059a5
1 changed files with 16 additions and 15 deletions

View File

@ -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; }