summaryrefslogtreecommitdiffstatshomepage
path: root/src/nvim/math.h
blob: 59be5461a1327bf6e3b5c7b3cdd564f91478ba89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#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);
}

#include "math.h.generated.h"