From c2a48b8910ce5a316314df255c7d3746aa499d9b Mon Sep 17 00:00:00 2001 From: Flatmush Date: Mon, 2 Jul 2012 16:07:50 +0000 Subject: Added a patch to make operator results constant in the C++ interface as suggested in Issue 15. --- libfixmath/fix16.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libfixmath/fix16.hpp b/libfixmath/fix16.hpp index 26863fe..03d7d75 100644 --- a/libfixmath/fix16.hpp +++ b/libfixmath/fix16.hpp @@ -12,10 +12,10 @@ class Fix16 { Fix16(const double inValue) { value = fix16_from_dbl(inValue); } Fix16(const int16_t inValue) { value = fix16_from_int(inValue); } - 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); } + operator fix16_t() const { return value; } + operator double() const { return fix16_to_dbl(value); } + operator float() const { return fix16_to_float(value); } + operator int16_t() const { 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; } -- cgit v1.2.3