commit 1c077d31972cb0cb1471282e175c2040edca5eeb parent e45fd2b66e9623cdf6b934bd6312ca6cb815d197 Author: Michael Savage <mikejsavage@gmail.com> Date: Fri Dec 9 20:30:44 +0200 Add a non const Array::ptr() and rename Array::bytes to Array::num_bytes Diffstat:
array.h | | | 12 | ++++++++++-- |
pp.cc | | | 2 | +- |
diff --git a/array.h b/array.h @@ -42,11 +42,15 @@ public: return i < n; } + T * ptr() { + return elems; + } + const T * ptr() const { return elems; } - size_t bytes() const { + size_t num_bytes() const { return sizeof( T ) * n; } @@ -80,11 +84,15 @@ public: return x < w && y < h; } + T * ptr() { + return elems; + } + const T * ptr() const { return elems; } - size_t bytes() const { + size_t num_bytes() const { return sizeof( T ) * w * h; } diff --git a/pp.cc b/pp.cc @@ -142,7 +142,7 @@ static void write_tile( } printf( "writing %d_%d%s\n", tx, ty, extension.c_str() ); - write_compressed_file( tile.ptr(), tile.bytes(), + write_compressed_file( tile.ptr(), tile.num_bytes(), "%s/%d_%d%s", dir.c_str(), tx, ty, extension.c_str() ); }