fixed log_2 for ARM arch

This commit is contained in:
eddyem
2015-02-09 08:34:17 +03:00
parent b53a659d40
commit c14be0eb90
6 changed files with 189 additions and 20 deletions

View File

@@ -117,12 +117,8 @@ size_t read_tty(){
}
static inline uint32_t log_2(const uint32_t x){
uint32_t y;
asm ( "\tbsr %1, %0\n"
: "=r"(y)
: "r" (x)
);
return y;
if(x == 0) return 0;
return (31 - __builtin_clz (x));
}
int send_command(uint8_t *ninebytes);