aboutsummaryrefslogtreecommitdiff
path: root/shared/util.c
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-10-29 18:01:56 +0200
committerlonkaars <loek@pipeframe.xyz>2022-10-29 18:01:56 +0200
commit9e9ea9d07ed2a176d6f6e83b5b100da22d8fca50 (patch)
treea683bde4664dad75c3b5a1efbd4223a4ab3b40dd /shared/util.c
parentead710db271795380207141f0add7278ba12ada0 (diff)
parentaae57dc32a843351fb2e17721afcd841bedec0a6 (diff)
Merge branch 'protocol' into dev
Diffstat (limited to 'shared/util.c')
-rw-r--r--shared/util.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/shared/util.c b/shared/util.c
new file mode 100644
index 0000000..ea972b0
--- /dev/null
+++ b/shared/util.c
@@ -0,0 +1,7 @@
+#include "util.h"
+
+unsigned int ws_log16(unsigned int x) {
+ unsigned int l = 0;
+ while (x >>= 4) ++l; // bitshift right by 4 until x == 0
+ return l;
+} \ No newline at end of file