From: <sv...@ww...> - 2005-12-13 04:23:51
|
Author: mkrose Date: 2005-12-12 20:23:45 -0800 (Mon, 12 Dec 2005) New Revision: 1769 Modified: trunk/CSP/csp/csplib/data/LUT.h Log: Possible fix for warnings when using double precision floats to index into single precision lookup tables under windows. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=1769 Modified: trunk/CSP/csp/csplib/data/LUT.h =================================================================== --- trunk/CSP/csp/csplib/data/LUT.h 2005-12-13 04:23:30 UTC (rev 1768) +++ trunk/CSP/csp/csplib/data/LUT.h 2005-12-13 04:23:45 UTC (rev 1769) @@ -218,7 +218,8 @@ public: /** Specify another coordinate. */ - inline WRAP<N,T> &operator[](T x); + template <typename Y> + inline WRAP<N,T> &operator[](Y y); /** Coerce the return value. */ @@ -515,9 +516,10 @@ * * @param x The first coordinate to sample. */ - inline WRAP<N,X> operator[](X x) const { + template <typename Y> + inline WRAP<N,X> operator[](Y y) const { this->checkInterpolated(); - return WRAP<N,X>(this, x); + return WRAP<N,X>(this, static_cast<X>(y)); } /** Test if the table contains no data. @@ -707,8 +709,9 @@ * the coordinates are set. */ template <int N, typename X> -inline WRAP<N,X> &WRAP<N,X>::operator[](X x) { - m_Vec(x); +template <typename Y> +inline WRAP<N,X> &WRAP<N,X>::operator[](Y y) { + m_Vec(static_cast<X>(y)); if (++m_N == N && m_Bind) { m_Value = m_Bind->getValue(m_Vec); } |