Board index » cppbuilder » memory question
Totte Karlsson
CBuilder Developer |
memory question2008-04-08 02:37:01 AM cppbuilder112 Hi, I have an array of unsigned ints data[500] These bytes are mapped into a sample structure struct _SAMP_BLK { INT8U channelID; // Channel (band) ID for this blocks I/Q data INT16S sampleI; // In Phase Sample INT16S sampleQ; // Quadrature Phase Sample }; to get the data "into" a struc object I do this now _SAMP_BLK sample; //Problem? copying memory //First 8 bits is the channel ID (frequency band) sample.channelID = aChannelSample->data[i]; //Next 16 bits is the I channel sample.sampleI = aChannelSample->data[i+1]<<8; sample.sampleI |= aChannelSample->data[i+2]; //Next 16 bits is the Q channel sample.sampleQ = aChannelSample->data[i+3] << 8; sample.sampleQ |= aChannelSample->data[i+4]; I would like to "map" the data directly to a _SAMPL_BLK structure pointer. Is that possible? I'm thinking about something like _SAMP_BLK *sample = (_SAMP_BLK *) aChannelSample->data[i] | aChannelSample->data[i+1] | ...; but I don't know the syntax for such a thing.. then there would be no copying of memory, I guess? My problem is that I have billions of these and try not to ever copy them.. -totte |