2011/10/6 Mike Hommey <m...@glandium.org>:
> On Thu, Oct 06, 2011 at 12:21:29AM +0200,
>
> That would waste a 64-bits word. The usual way to do it is to use
> unions:
> union {
>  PRUint64 dummy;
>  struct {
>    PRUint32 m0;
>    PRUint16 m1;
>    PRUint16 m2;
>  };
> };

Thanks for pointing this out. I've never seen such a construction before.

BTW, what's better/cleaner? Align nsID or adapt Equals to make 32-bit
words comparison? Is the following code OK:

inline PRBool Equals(const nsID& other) const {
  return

    ((PRUint32*) &m0)[0] == ((PRUint32*) &other.m0)[0] &&
    ((PRUint32*) &m1)[0] == ((PRUint32*) &other.m1)[0] &&
    ((PRUint32*) &m3)[0] == ((PRUint32*) &other.m3)[0] &&
    ((PRUint32*) &m3)[1] == ((PRUint32*) &other.m3)[1];
 }

     Emeric



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to