Otherwise, unsigned zero theSize underflows in pop(), causing an infinite loop.
Ipc::Mem::PageStack::push(const Value value)
{
Must(value != Writable);
- Must(value <= shared->theCapacity);
+ Must(static_cast<Offset>(value) <= shared->theCapacity);
// find a Writable slot, starting with theFirstWritable and going right
while (shared->theSize < shared->theCapacity) {
const Offset idx = shared->theFirstWritable;
void push(const Value value);
private:
- typedef unsigned int Offset; ///< stack index type
+ /// stack index and size type (may temporary go negative)
+ typedef int Offset;
struct Shared {
Shared(const unsigned int aCapacity);