Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/22/03 01:47
Read: times


 
#46320 - RE: 8-bit*16-bit multiplication
Responding to: ???'s previous message
OK, if you will entertain a more serious response after my ramblings above, how about something more like you'd do it "on paper"...
typedef unsigned char   U8;
typedef unsigned short  U16;
typedef unsigned long   U32;

U32 product;

U32 Mul8x16(U8 b, U16 w)
{
    U32 retVal;
    U16 tmp;

    tmp    = b * (U8)w;
    retVal = b * (U8)(w >> 8);

    return (((U32)retVal << 8) + tmp);
}

void main(void)
{
    product = Mul8x16(0x80, 0x1234);

    /* Store product as 24-bits if needed... */
}

Results? No 32-bit library calls in sight. Note that I have not thought this through fully, but give it a shot an let us know how lame-brained it is.

List of 32 messages in thread
TopicAuthorDate
8-bit*16-bit multiplication            01/01/70 00:00      
   RE: 8-bit*16-bit multiplication            01/01/70 00:00      
   RE: 8-bit*16-bit multiplication            01/01/70 00:00      
      RE: Integer Promotion Rules            01/01/70 00:00      
   RE: 8-bit*16-bit multiplication            01/01/70 00:00      
      RE: 8-bit*16-bit multiplication            01/01/70 00:00      
      RE: 8-bit*16-bit multiplication            01/01/70 00:00      
         RE: 8-bit*16-bit multiplication            01/01/70 00:00      
            RE: 8-bit*16-bit multiplication            01/01/70 00:00      
               RE: 8-bit*16-bit multiplication            01/01/70 00:00      
                  RE: 8-bit*16-bit multiplication            01/01/70 00:00      
                     RE: 8-bit*16-bit multiplication            01/01/70 00:00      
                        RE: 8-bit*16-bit multiplication            01/01/70 00:00      
                        RE: 8-bit*16-bit multiplication            01/01/70 00:00      
                           RE: 8-bit*16-bit multiplication            01/01/70 00:00      
   RE: 8-bit*16-bit multiplication            01/01/70 00:00      
   RE: 8-bit*16-bit multiplication            01/01/70 00:00      
      RE: 8-bit*16-bit multiplication            01/01/70 00:00      
   RE: 8-bit*16-bit multiplication            01/01/70 00:00      
      RE: 8-bit*16-bit multiplication            01/01/70 00:00      
   RE: 8-bit*16-bit multiplication            01/01/70 00:00      
      RE: 8-bit*16-bit multiplication            01/01/70 00:00      
         RE: 8-bit*16-bit multiplication            01/01/70 00:00      
            RE: 8-bit*16-bit multiplication            01/01/70 00:00      
               MY project Details            01/01/70 00:00      
                  RE: MY project Details            01/01/70 00:00      
                     RE: MY project Details            01/01/70 00:00      
                        RE: MY project Details            01/01/70 00:00      
                           RE: MY project Details            01/01/70 00:00      
                           RE: MY project Details            01/01/70 00:00      
                           RE: MY project Details            01/01/70 00:00      
                              RE: MY project Details            01/01/70 00:00      

Back to Subject List