|
Boost-Commit : |
From: hljin_at_[hidden]
Date: 2007-09-18 17:19:06
Author: hljin
Date: 2007-09-18 17:19:05 EDT (Tue, 18 Sep 2007)
New Revision: 39376
URL: http://svn.boost.org/trac/boost/changeset/39376
Log:
GIL:
1. changed int to std::ptrdiff_t in utilities.hpp and iterator_from_2d.hpp for problems under 64-bit platforms
2. removed several extra semi-colons after GIL_CLASS_REQUIRE
Text files modified:
trunk/boost/gil/iterator_from_2d.hpp | 22 +++++++++++-----------
trunk/boost/gil/step_iterator.hpp | 8 ++++----
trunk/boost/gil/utilities.hpp | 38 +++++++++++++++++++-------------------
3 files changed, 34 insertions(+), 34 deletions(-)
Modified: trunk/boost/gil/iterator_from_2d.hpp
==============================================================================
--- trunk/boost/gil/iterator_from_2d.hpp (original)
+++ trunk/boost/gil/iterator_from_2d.hpp 2007-09-18 17:19:05 EDT (Tue, 18 Sep 2007)
@@ -17,7 +17,7 @@
/// \brief pixel step iterator, pixel image iterator and pixel dereference iterator
/// \author Lubomir Bourdev and Hailin Jin \n
/// Adobe Systems Incorporated
-/// \date 2005-2007 \n Last updated on February 12, 2007
+/// \date 2005-2007 \n Last updated on September 18, 2007
///
////////////////////////////////////////////////////////////////////////////////////////
@@ -66,9 +66,9 @@
typedef typename Loc2::x_iterator x_iterator;
typedef typename Loc2::point_t point_t;
- int width() const { return _width; } // number of pixels per image row
- int x_pos() const { return _coords.x; } // current x position
- int y_pos() const { return _coords.y; } // current y position
+ std::ptrdiff_t width() const { return _width; } // number of pixels per image row
+ std::ptrdiff_t x_pos() const { return _coords.x; } // current x position
+ std::ptrdiff_t y_pos() const { return _coords.y; } // current y position
/// For some reason operator[] provided by iterator_adaptor returns a custom class that is convertible to reference
/// We require our own reference because it is registered in iterator_traits
@@ -78,7 +78,7 @@
x_iterator& x() { return _p.x(); }
iterator_from_2d(){}
- iterator_from_2d(const Loc2& p, int width, int x=0, int y=0) : _coords(x,y), _width(width), _p(p) {}
+ iterator_from_2d(const Loc2& p, std::ptrdiff_t width, std::ptrdiff_t x=0, std::ptrdiff_t y=0) : _coords(x,y), _width(width), _p(p) {}
iterator_from_2d(const iterator_from_2d& pit) : _coords(pit._coords), _width(pit._width), _p(pit._p) {}
template <typename Loc> iterator_from_2d(const iterator_from_2d<Loc>& pit) : _coords(pit._coords), _width(pit._width), _p(pit._p) {}
@@ -109,11 +109,11 @@
if (_width==0) return; // unfortunately we need to check for that. Default-constructed images have width of 0 and the code below will throw if executed.
point_t delta;
if (_coords.x+d>=0) { // not going back to a previous row?
- delta.x=(_coords.x+(int)d)%_width - _coords.x;
- delta.y=(_coords.x+(int)d)/_width;
+ delta.x=(_coords.x+(std::ptrdiff_t)d)%_width - _coords.x;
+ delta.y=(_coords.x+(std::ptrdiff_t)d)/_width;
} else {
- delta.x=(_coords.x+(int)d*(1-_width))%_width -_coords.x;
- delta.y=-(_width-_coords.x-(int)d-1)/_width;
+ delta.x=(_coords.x+(std::ptrdiff_t)d*(1-_width))%_width -_coords.x;
+ delta.y=-(_width-_coords.x-(std::ptrdiff_t)d-1)/_width;
}
_p+=delta;
_coords.x+=delta.x;
@@ -130,8 +130,8 @@
return _coords==it._coords && _p==it._p;
}
- point2<int> _coords;
- int _width;
+ point2<std::ptrdiff_t> _coords;
+ std::ptrdiff_t _width;
Loc2 _p;
};
Modified: trunk/boost/gil/step_iterator.hpp
==============================================================================
--- trunk/boost/gil/step_iterator.hpp (original)
+++ trunk/boost/gil/step_iterator.hpp 2007-09-18 17:19:05 EDT (Tue, 18 Sep 2007)
@@ -18,7 +18,7 @@
/// \brief pixel step iterator
/// \author Lubomir Bourdev and Hailin Jin \n
/// Adobe Systems Incorporated
-/// \date 2005-2007 \n Last updated on February 12, 2007
+/// \date 2005-2007 \n Last updated on September 18, 2007
///
////////////////////////////////////////////////////////////////////////////////////////
@@ -141,7 +141,7 @@
void set_step(std::ptrdiff_t step) { _step=step; }
private:
- GIL_CLASS_REQUIRE(Iterator, boost::gil, MemoryBasedIteratorConcept);
+ GIL_CLASS_REQUIRE(Iterator, boost::gil, MemoryBasedIteratorConcept)
difference_type _step;
};
@@ -149,7 +149,7 @@
class memory_based_step_iterator : public detail::step_iterator_adaptor<memory_based_step_iterator<Iterator>,
Iterator,
memunit_step_fn<Iterator> > {
- GIL_CLASS_REQUIRE(Iterator, boost::gil, MemoryBasedIteratorConcept);
+ GIL_CLASS_REQUIRE(Iterator, boost::gil, MemoryBasedIteratorConcept)
public:
typedef detail::step_iterator_adaptor<memory_based_step_iterator<Iterator>,
Iterator,
@@ -263,7 +263,7 @@
// For step iterators, pass the function object to the base
template <typename Iterator, typename Deref>
struct iterator_add_deref<memory_based_step_iterator<Iterator>,Deref> {
- GIL_CLASS_REQUIRE(Deref, boost::gil, PixelDereferenceAdaptorConcept);
+ GIL_CLASS_REQUIRE(Deref, boost::gil, PixelDereferenceAdaptorConcept)
typedef memory_based_step_iterator<typename iterator_add_deref<Iterator, Deref>::type> type;
Modified: trunk/boost/gil/utilities.hpp
==============================================================================
--- trunk/boost/gil/utilities.hpp (original)
+++ trunk/boost/gil/utilities.hpp 2007-09-18 17:19:05 EDT (Tue, 18 Sep 2007)
@@ -32,7 +32,7 @@
/// \brief Various utilities not specific to the image library. Some are non-standard STL extensions or generic iterator adaptors
/// \author Lubomir Bourdev and Hailin Jin \n
/// Adobe Systems Incorporated
-/// \date 2005-2007 \n Last updated on August 14, 2007
+/// \date 2005-2007 \n Last updated on September 18, 2007
///
///
////////////////////////////////////////////////////////////////////////////////////////
@@ -44,7 +44,7 @@
Example:
\code
-point2<int> p(3,2);
+point2<std::ptrdiff_t> p(3,2);
assert((p[0] == p.x) && (p[1] == p.y));
assert(axis_value<0>(p) == 3);
assert(axis_value<1>(p) == 2);
@@ -74,8 +74,8 @@
point2& operator=(const point2& p) { x=p.x; y=p.y; return *this; }
- point2 operator<<(int shift) const { return point2(x<<shift,y<<shift); }
- point2 operator>>(int shift) const { return point2(x>>shift,y>>shift); }
+ point2 operator<<(std::ptrdiff_t shift) const { return point2(x<<shift,y<<shift); }
+ point2 operator>>(std::ptrdiff_t shift) const { return point2(x>>shift,y>>shift); }
point2& operator+=(const point2& p) { x+=p.x; y+=p.y; return *this; }
point2& operator-=(const point2& p) { x-=p.x; y-=p.y; return *this; }
point2& operator/=(double t) { x/=t; y/=t; return *this; }
@@ -112,10 +112,10 @@
point2<double> operator/(const point2<T>& p, double t) { return t==0 ? point2<double>(0,0):point2<double>(p.x/t,p.y/t); }
/// \ingroup PointModel
template <typename T> GIL_FORCEINLINE
-point2<T> operator*(const point2<T>& p, int t) { return point2<T>(p.x*t,p.y*t); }
+point2<T> operator*(const point2<T>& p, std::ptrdiff_t t) { return point2<T>(p.x*t,p.y*t); }
/// \ingroup PointModel
template <typename T> GIL_FORCEINLINE
-point2<T> operator*(int t, const point2<T>& p) { return point2<T>(p.x*t,p.y*t); }
+point2<T> operator*(std::ptrdiff_t t, const point2<T>& p) { return point2<T>(p.x*t,p.y*t); }
/// \ingroup PointModel
template <std::size_t K, typename T> GIL_FORCEINLINE
@@ -131,34 +131,34 @@
///
////////////////////////////////////////////////////////////////////////////////////////
-inline int iround(float x ) { return static_cast<int>(x + (x < 0.0f ? -0.5f : 0.5f)); }
-inline int iround(double x) { return static_cast<int>(x + (x < 0.0 ? -0.5 : 0.5)); }
-inline int ifloor(float x ) { return static_cast<int>(std::floor(x)); }
-inline int ifloor(double x) { return static_cast<int>(std::floor(x)); }
-inline int iceil(float x ) { return static_cast<int>(std::ceil(x)); }
-inline int iceil(double x) { return static_cast<int>(std::ceil(x)); }
+inline std::ptrdiff_t iround(float x ) { return static_cast<std::ptrdiff_t>(x + (x < 0.0f ? -0.5f : 0.5f)); }
+inline std::ptrdiff_t iround(double x) { return static_cast<std::ptrdiff_t>(x + (x < 0.0 ? -0.5 : 0.5)); }
+inline std::ptrdiff_t ifloor(float x ) { return static_cast<std::ptrdiff_t>(std::floor(x)); }
+inline std::ptrdiff_t ifloor(double x) { return static_cast<std::ptrdiff_t>(std::floor(x)); }
+inline std::ptrdiff_t iceil(float x ) { return static_cast<std::ptrdiff_t>(std::ceil(x)); }
+inline std::ptrdiff_t iceil(double x) { return static_cast<std::ptrdiff_t>(std::ceil(x)); }
/**
\addtogroup PointAlgorithm
Example:
\code
-assert(iround(point2<double>(3.1, 3.9)) == point2<int>(3,4));
+assert(iround(point2<double>(3.1, 3.9)) == point2<std::ptrdiff_t>(3,4));
\endcode
*/
/// \ingroup PointAlgorithm
-inline point2<int> iround(const point2<float >& p) { return point2<int>(iround(p.x),iround(p.y)); }
+inline point2<std::ptrdiff_t> iround(const point2<float >& p) { return point2<std::ptrdiff_t>(iround(p.x),iround(p.y)); }
/// \ingroup PointAlgorithm
-inline point2<int> iround(const point2<double>& p) { return point2<int>(iround(p.x),iround(p.y)); }
+inline point2<std::ptrdiff_t> iround(const point2<double>& p) { return point2<std::ptrdiff_t>(iround(p.x),iround(p.y)); }
/// \ingroup PointAlgorithm
-inline point2<int> ifloor(const point2<float >& p) { return point2<int>(ifloor(p.x),ifloor(p.y)); }
+inline point2<std::ptrdiff_t> ifloor(const point2<float >& p) { return point2<std::ptrdiff_t>(ifloor(p.x),ifloor(p.y)); }
/// \ingroup PointAlgorithm
-inline point2<int> ifloor(const point2<double>& p) { return point2<int>(ifloor(p.x),ifloor(p.y)); }
+inline point2<std::ptrdiff_t> ifloor(const point2<double>& p) { return point2<std::ptrdiff_t>(ifloor(p.x),ifloor(p.y)); }
/// \ingroup PointAlgorithm
-inline point2<int> iceil (const point2<float >& p) { return point2<int>(iceil(p.x), iceil(p.y)); }
+inline point2<std::ptrdiff_t> iceil (const point2<float >& p) { return point2<std::ptrdiff_t>(iceil(p.x), iceil(p.y)); }
/// \ingroup PointAlgorithm
-inline point2<int> iceil (const point2<double>& p) { return point2<int>(iceil(p.x), iceil(p.y)); }
+inline point2<std::ptrdiff_t> iceil (const point2<double>& p) { return point2<std::ptrdiff_t>(iceil(p.x), iceil(p.y)); }
////////////////////////////////////////////////////////////////////////////////////////
///
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk