From 6850112ac1b943a5aa3c40a71b1789283c5e1d85 Mon Sep 17 00:00:00 2001 From: sageweil Date: Thu, 11 Jan 2007 19:58:21 +0000 Subject: [PATCH] fixed hack_aligned git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1004 29311d96-e01e-0410-9327-a35deaab8ce9 --- ceph/include/buffer.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ceph/include/buffer.h b/ceph/include/buffer.h index d26e2840048f2..ecd887e86a020 100644 --- a/ceph/include/buffer.h +++ b/ceph/include/buffer.h @@ -20,6 +20,7 @@ #include using std::cout; +using std::endl; #ifndef __CYGWIN__ # include @@ -140,12 +141,16 @@ private: public: raw_hack_aligned(unsigned l) : raw(l) { realdata = new char[len+4095]; - unsigned off = (unsigned)data % 4096; + unsigned off = ((unsigned)realdata) % 4096; if (off) data = realdata + 4096 - off; else data = realdata; inc_total_alloc(len+4095); + //cout << "hack aligned " << (unsigned)data + //<< " in raw " << (unsigned)realdata + //<< " off " << off << endl; + assert(((unsigned)data & 4095) == 0); } ~raw_hack_aligned() { delete[] realdata; -- 2.39.5