> Ok, i'm not if this would work so let me know.
>
> I need to separate a ULong into 4 UShorts so...

That's impossible without repeating values -- a ULong is 32-bits, while
a UShort is 16-bits.

> ULong x = value;
>
> UShort a, b, c, d ;
>
> MemMove ( a, x, 2 );
> MemMove ( b, x, 2 );
> MemMove ( c, x, 2 );
> MemMove ( d, x, 2 );

Assuming you mean UChar (8-bit), then you code could look like

ULong x = value;

UChar a, b, c, d ;

MemMove ( &a, &x, 1 );
MemMove ( &b, (char *)&x + 1, 1 );
MemMove ( &c, (char *)&x + 2, 1 );
MemMove ( &d, (char *)&x + 3, 1 );

or a bit more clearly

a = x >> 24;
b = x >> 16;
c = x >> 8;
d = x;

since both types are unsigned, this should work fine.




-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to