aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/math.h
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-03-09 14:57:57 -0700
committerJosh Rahm <joshuarahm@gmail.com>2024-03-09 14:57:57 -0700
commitc324271b99eee4c621463f368914d57cd729bd9c (patch)
tree5d979d333a2d5f9c080991d5482fd5916f8579c6 /src/nvim/math.h
parent931bffbda3668ddc609fc1da8f9eb576b170aa52 (diff)
parentade1b12f49c3b3914c74847d791eb90ea90b56b7 (diff)
downloadrneovim-c324271b99eee4c621463f368914d57cd729bd9c.tar.gz
rneovim-c324271b99eee4c621463f368914d57cd729bd9c.tar.bz2
rneovim-c324271b99eee4c621463f368914d57cd729bd9c.zip
Merge remote-tracking branch 'upstream/master' into userreg
Diffstat (limited to 'src/nvim/math.h')
-rw-r--r--src/nvim/math.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/nvim/math.h b/src/nvim/math.h
index c88ce1e03d..0321d0c9c6 100644
--- a/src/nvim/math.h
+++ b/src/nvim/math.h
@@ -1,5 +1,14 @@
#pragma once
+#include <stdbool.h>
+#include <stdint.h>
+
+/// Check if number is a power of two
+static inline bool is_power_of_two(uint64_t x)
+{
+ return x != 0 && ((x & (x - 1)) == 0);
+}
+
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "math.h.generated.h"
#endif