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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/21/03 23:02
Read: times


 
#46302 - RE: 8-bit*16-bit multiplication
Responding to: ???'s previous message
Hi Lee,

I imagine the actual integer promotion rules are compiler dependent...I would expect my compiler to promote to int, not long. The 32 bit multiply sounds normal for a PC compiler though.

The most efficient way would be to create an assembler 8x16 multiply. Create a skeleton function in C:

unsigned long mult_8x16(unsigned char x, unsigned int y)
{
return (unsigned long)(x * y);
}

Compile, take the asm output, modify it so it does *your* 8x16 asm multiply instead of calling the library multiply functions, then call this new function from your program. (See your compiler manual for the exact method of interfacing asm to C.)

As to how your compiler does its promotions, you should be able to tell easily by looking at the compiler generated asm. If you get a compiler warning about lost precision you know it expects you to cast to longs before the multiply.

Dennis



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