Hello... My question right now is :
I have a database in the storage heap, the data is in a specific
format (my format, but this is not relevant for the question). I use 32 bits
integers. I have a routine that reads a WORD(16 bits)value and increases the
data pointer with 2, and a routine that reads an INT(32 bits)value and
increases the data pointer with 4. Let's say at one moment, I need to read 2
WORD values, something like this:
Word1=GetDataWord();
Word2=GetDataWord();
where GetDataWord:
{
WORD aux=*(WORD *)DataPointer;
DataPointer+=2;
return aux;
}
------------------------------------------------------
The same thing can be done using:
int PACK=GetDataInt();
Word1=(WORD)PACK>>16;
Word2=(WORD)PACK;
where GetDataInt: (naturally)
{
int aux=*(int *)DataPointer;
DataPointer+=4;
return aux;
}
------------------------------------------------------
So my question put short is: which kind of data access is faster? By
reading two separate 16 bit values from memory or by reading the packed
integer and splitting it into the two 16 bit values? ( I need this
routines to be as fast as possible because they are executed a big number of
times and speed is critical ). And one more thing: the answer remains valid
if the same thing is performed with WORD and BYTE values?
Thanks in advance,
Dan Patrutiu
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/