AND bitwise operator with 0xFF to mask out all bits except the lower 8.
Mostly a precaution when moving data into a data type with fewer bytes.
It doesn't make for pretty code but it does allow one to safely compact a
lot of data into a single variable for storage. (or in this case, extract
into multiple variables)
----- Original Message -----
From: "Phillip Streck" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Friday, May 18, 2001 1:49 PM
Subject: Re: MemMove
> what does &0x00FF do.. excuse my ignorance.
>
> Philip Streck
> Akron General Medical Center
> Information Systems
>
> >>> "Dave Lippincott" <[EMAIL PROTECTED]> 05/18/01 01:22PM >>>
> or
> ULong x = value;
> UShort a,b,c,d
>
> a = (UShort)(x &0x00FF)
> b = (UShort)((x>>8)&0x00FF)
> c = (UShort)((x>>16)&0x00FF)
> d = (UShort)((x>>24)&0x00FF)
>
> ----- Original Message -----
> From: "Phillip Streck" <[EMAIL PROTECTED]>
> To: "Palm Developer Forum" <[EMAIL PROTECTED]>
> Sent: Friday, May 18, 2001 1:10 PM
> Subject: MemMove
>
>
> > Ok, i'm not if this would work so let me know.
> >
> > I need to separate a ULong into 4 UShorts so...
> >
> > ULong x = value;
> >
> > UShort a, b, c, d ;
> >
> > MemMove ( a, x, 2 );
> > MemMove ( b, x, 2 );
> > MemMove ( c, x, 2 );
> > MemMove ( d, x, 2 );
> >
> > Make sense?
> >
> > thanks,
> >
> >
> >
> > Philip Streck
> > Akron General Medical Center
> > Information Systems
> >
> >
> > --
> > For information on using the Palm Developer Forums, or to unsubscribe,
> please see http://www.palmos.com/dev/tech/support/forums/
> >
>
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/