diff options
author | Mathias Stearn <redbeard0531@gmail.com> | 2011-01-18 23:42:27 -0500 |
---|---|---|
committer | Mathias Stearn <redbeard0531@gmail.com> | 2011-01-18 23:42:27 -0500 |
commit | 8631bb6aad20a140328dc5a22a46f646f57ce974 (patch) | |
tree | 7a0ceef4e1260b4d058b65fd060cf8a6b9e5f5e2 /util/alignedbuilder.cpp | |
parent | 85f4700e918678c1ac35fd8c7581fa57258a8efb (diff) | |
download | mongo-8631bb6aad20a140328dc5a22a46f646f57ce974.tar.gz |
More asserts in AlignedBuilder
Diffstat (limited to 'util/alignedbuilder.cpp')
-rw-r--r-- | util/alignedbuilder.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/util/alignedbuilder.cpp b/util/alignedbuilder.cpp index 8fa487d547f..6f89e8dafc1 100644 --- a/util/alignedbuilder.cpp +++ b/util/alignedbuilder.cpp @@ -27,6 +27,8 @@ namespace mongo { uassert(13584, "out of memory AlignedBuilder", _p._allocationAddress); } + BOOST_STATIC_ASSERT(sizeof(void*) == sizeof(size_t)); + void AlignedBuilder::mallocSelfAligned(unsigned sz) { assert( sz == _p._size ); void *p = malloc(sz + Alignment - 1); @@ -35,7 +37,8 @@ namespace mongo { size_t sold = s; s += Alignment - 1; s = (s/Alignment)*Alignment; - DEV assert( s >= sold ); + assert( s >= sold ); // begining + assert( (s + sz) <= (sold + Alignment - 1) ); //end _p._data = (char *) s; } |