image: make offset constexpr, and move inline

This commit is contained in:
Danny Robson 2015-07-24 01:36:11 +10:00
parent 4ea5896d21
commit c2bdd29944
3 changed files with 10 additions and 10 deletions

View File

@ -255,15 +255,6 @@ util::image::buffer<T>::downsample (float factor) const
///////////////////////////////////////////////////////////////////////////////
template <typename T>
size_t
buffer<T>::offset (point<2,size_t> p) const
{
return dot (stride (), p);
}
//-----------------------------------------------------------------------------
template <typename T>
T
buffer<T>::operator[] (point<2,size_t> p) const
{

View File

@ -61,7 +61,7 @@ namespace util { namespace image {
size_t s;
//---------------------------------------------------------------------
size_t offset (point<2,size_t>) const;
constexpr size_t offset (point<2,size_t>) const;
T operator[] (point<2,size_t>) const;
T& operator[] (point<2,size_t>);

View File

@ -38,6 +38,15 @@ namespace util { namespace image {
}
//-------------------------------------------------------------------------
template <typename T>
constexpr size_t
buffer<T>::offset (point<2,size_t> p) const
{
return dot (stride (), p);
}
//-------------------------------------------------------------------------
template <typename T>
constexpr size_t