The code for "mBits" in nsVoidArray seems to be just plain at odds with
the comments. Did someone move the boolean bit to the top bit from the
bottom, and just not fix the comments?
struct Impl {
/**
* Packed bits. The highest 31 bits are the array's size, which must
* always be 0 mod 2. The lowest bit is a flag that indicates
* whether or not we "own" mArray, and must free() it when
* destroyed.
*/
PRUint32 mBits;
/**
* The number of elements in the array
*/
PRInt32 mCount;
/**
* Array data, padded out to the actual size of the array.
*/
void* mArray[1];
};
Impl* mImpl;
enum {
kArrayOwnerMask = 1 << 31,
kArraySizeMask = ~kArrayOwnerMask
};
and
protected:
// The internal storage. Note that this value must be divisible by
// two because we use the LSB of mInfo to indicate array ownership.
enum { kAutoBufSize = 8 };
char mAutoBuf[sizeof(Impl) + (kAutoBufSize - 1) * sizeof(void*)];
--
Randell Jesup, Worldgate Communications, ex-Scala, ex-Amiga OS team ('88-94)
[EMAIL PROTECTED]