When doing a 24 by 24 multiply how can I access the full 48-bit result?
The full 48-bit result is normally generated, but only the least significant 24-bit result is actually returned. To get the upper 24-bits of the result (which the compiler ignores) it is required to pull thre result directly from the mach register, as follows.
void Multiply24Bit ( int24
VdCmd, int24 VqCmd,
int24
ResultHi,
int24
ResultLo )
{
if ( IsHostServiceRequestEvent(7) )
{
// Lower 24-bit result is in
the register
ResultLo = VdCmd * VqCmd;
// Access the upper 24-bits
of the result
// directly from the register
// ( At the time of this writing
the compiler
// does not (yet?) support 48-bit
data types )
register_mach mach;
ResultHi = mach;
NOP();
}
else {} // Error recovery code ...
}