How to Use the Full 48-Bit Result of a 24x24 Multiply

<< Click to Display Table of Contents >>

Navigation:  ETEC 'C' Compiler Information >

How to Use the Full 48-Bit Result of a 24x24 Multiply

Previous pageReturn to chapter overviewNext page

Example Download

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

        // (There is no 48-bit data type)

        register_mach mach;

        ResultHi = mach;

        NOP();

    }

    else {} // Error recovery code ...

}