Skip to content

Instantly share code, notes, and snippets.

inline static s32 BITREV(s32 a) {
s32 ret;
asm __volatile__ ("bitrev %0, %1;" : "=r" (ret) : "r"(a));
return ret;
}
inline static s32 CLZ(s32 a) {
s32 ret;
asm __volatile__ ("clz %0, %1" : "=r"(ret) : "r" (a));
return ret;
static inline s32 lsbPosition(s32 a) {
s32 ret;
asm __volatile__("bitrev $0, %0;
clz %1, $0;"
: "=r"(ret) : "r"(a));
return ret;
}
@Kern--
Kern-- / Makefile
Last active December 14, 2015 04:59
A simple makefile
#Name of the executable
TARGET =
#objects that go into the executable
OBJS =
CC = gcc
CFLAGS = -g -Wall
DEBUGGER = gdb