Skip to content

Instantly share code, notes, and snippets.

View cahirwpz's full-sized avatar

Krystian Bacławski cahirwpz

View GitHub Profile
@cahirwpz
cahirwpz / m68k-absl.c
Created April 25, 2016 07:16
m68k GCC assembly inline for abs function without jump instruction
static inline int absl(int x) {
int t;
asm("move.l %0,%1\n\t"
"add.l %1,%1\n\t"
"subx.l %1,%1\n\t"
"eor.l %1,%0\n\t"
"sub.l %1,%0\n\t"
: "+r" (x), "=r" (t));
return x;
}