When Packing and unpacking you can treat your UInt32s as an array(double subscripted) of UInt32s. To pack DmWrite your struct with the Num Bytes parameter = to sizeof(PackedFooType)-sizof(UInt32*) + (NumAs+NumBs)*sizeof(UInt32) Thats the size of your structure minus the UInt32 pointer plus the number of bytes of packed data.
You shouldn't have any troubles as long as you dont try adding single byte variables to the Packed data mix (since an odd # of these can cause your other data to be on odd boundries). Good luck, Mike > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of David > Eyler > Sent: Wednesday, September 25, 2002 1:59 PM > To: Palm Developer Forum > Subject: Packing UInt32's > > > I have some records with a whole lot of Unique ID's stored. > The max now is > like 200+. My record structure looks like this > > typedef struct FooType { > UInt32 a[50] > UInt32 b[50] > ... > }FooType > > What I would like to do in order to save space is pack the > UInt32's in a > similar fashion to what most apps do to pack character > strings. So that > would make my struct look like this > > typedef struct PackedFooType { > UInt16 numAs; > UInt16 numBs; > ... > UInt32* records; > } PackedFooType > > Has anyone done this already? If so could you post your packing and > unpacking code? I'm afraid that the alignment of the memory will cause > problems. Thanks. > > > > -- > For information on using the Palm Developer Forums, or to > unsubscribe, please see http://www.palmos.com/dev/support/forums/ > -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
