Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QM translation of C++
#3
for question one, as it's a bit tough to comprehend

i copied the wrong structure, its actually
struct {

DWORD dwSampleRate; // 48000, 44100 and 32000 allowed
BYTE byMode; // BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO
WORD wBitrate; // 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 and 320 allowed
BOOL bPrivate;
BOOL bCRC;
BOOL bCopyright;
BOOL bOriginal;

} mp3;

so type ____BE_CONFIG11 dwSampleRate !byMode [+1]@wBitrate bPrivate bCRC bCopyright bOriginal

holds in bytes size:

4/1/2/1/1/1/1

so dwSampleRate has offset 0, bymode offset 4, wBitrate offset 5

pack 1 is used to set wBitrate to 6, so it is offset is divisible by it's size, 2.
is this correct?
is yes, is size of bymode 2 instead of 1 then by padding, and then strucuture size is 12 instead of 11 at the original declaration?

would it be possible to invert bymode and wBitrate to make it aligned correctly (1 byte should be always well aligned)

____BE_CONFIG11 dwSampleRate @wBitrate !byMode bPrivate bCRC bCopyright bOriginal

then we have in sizes

4/2/1/1/1/1/1 and no pragma required, as those variables don't seem to be in the exact order in the struct declaration, or i'm mistaken on that point.

will study other answers later...


Messages In This Thread

Forum Jump:


Users browsing this thread: 5 Guest(s)