Skip to content

Instantly share code, notes, and snippets.

@Jacajack
Created November 2, 2017 12:38
Show Gist options
  • Save Jacajack/1474013ca012becd8c68d4f42a543a01 to your computer and use it in GitHub Desktop.
Save Jacajack/1474013ca012becd8c68d4f42a543a01 to your computer and use it in GitHub Desktop.
AVR inline assembly 8bit multiplication upper half
#define HMUL( ans, b1, b2 ) \
asm volatile( \
"mul %1, %2\n\t" \
"mov %0, r1\n\t" \
: "=l"(ans) \
: "d"(b1), "d"(b2) \
);
#define HMULS( ans, b1, b2 ) \
asm volatile( \
"muls %1, %2\n\t" \
"mov %0, r1\n\t" \
: "=l"(ans) \
: "d"(b1), "d"(b2) \
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment