mirror of
https://github.com/eddyem/eddys_snippets.git
synced 2026-03-21 01:00:58 +03:00
Added SMSD non-interactive command line client for Shack-Hartmann control system
This commit is contained in:
15
websockets/testlog2.c
Normal file
15
websockets/testlog2.c
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
static inline uint32_t log_2(const uint32_t x){
|
||||
if(x == 0) return 0;
|
||||
return (31 - __builtin_clz (x));
|
||||
}
|
||||
|
||||
int main(){
|
||||
uint32_t i;
|
||||
for(i = 0; i < 150; i++){
|
||||
printf("log2(%u) = %u\n", i, log_2(i));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user