Quoting Galen Seitz <[EMAIL PROTECTED]>:

> Because I wanted more control over multiplies, I've started creating
> routines like these:
>
>
> extern inline uint16_t
> mult_u16_u8u8(uint8_t a, uint8_t b)
> {
>     uint16_t product;
>     asm (
>         "mul %1, %2"    "\n\t"
>         "movw %0, r0"   "\n\t"
>         "clr r1"        "\n\t"
>         : "=w" (product)
>         : "r" (a), "r" (b)
>         );
>     return product;
> }
>
>
> extern inline uint16_t
> mult_u8h_u8u8(uint8_t a, uint8_t b)
> {
>     uint8_t product_high;
>     asm (
>         "mul %1, %2"    "\n\t"
>         "mov %0, r1"    "\n\t"
>         "clr r1"        "\n\t"
>         : "=w" (product_high)
>         : "r" (a), "r" (b)
>         );
>     return product_high;
> }
>
>
>
> I have a few others if people are interested.
>

Interesting. Would you be willing to submit a patch to the avr-libc Patch
Tracker?

Thanks
Eric

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



_______________________________________________
AVR-GCC-list mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to