Guest User

Untitled

a guest
Jun 18th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. /* calculate the 32-bit product of unsigned 16-bit value op16 and 32-bit value op32 */
  2. static inline uint32_t mul_16_32(uint16_t op16, uint32_t op32) \
  3. {
  4. unsigned t1, r;
  5. asm (
  6. "mulu %[a], %[b] \n"
  7. "swap.w %[b], %[b] \n"
  8. "sts macl, %[r] \n"
  9. "mulu %[a], %[b] \n"
  10. "sts macl, %[t1] \n"
  11. "shll16 %[t1] \n"
  12. "add %[t1], %[r] \n"
  13. : [r] "=&r" (r),
  14. [t1] "=r" (t1),
  15. : [a] "r" (op16),
  16. [b] "r" (op32),
  17. );
  18. return r;
  19. }
Add Comment
Please, Sign In to add comment