Skip to content

Commit

Permalink
add win patch func
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaofeng-shu33 committed Sep 24, 2019
1 parent d7df7f1 commit be90243
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
15 changes: 15 additions & 0 deletions bhcd/winpatch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <glib.h>
static inline gint
g_bit_nth_lsf_impl_win(guint64 mask,
gint nth_bit)
{
if (G_UNLIKELY(nth_bit < -1))
nth_bit = -1;
while (nth_bit < ((GLIB_SIZEOF_LONG * 8) - 1))
{
nth_bit++;
if (mask & (1UL << nth_bit))
return nth_bit;
}
return -1;
}
4 changes: 3 additions & 1 deletion hccd/bitset.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "bitset.h"
#include "util.h"

#if _WIN32
#include "winpatch.h"
#endif
#define BITS_PER_ELEM 64
#define MASK_ELEM (BITS_PER_ELEM-1)
/* log2(BITS_PER_ELEM) */
Expand Down

0 comments on commit be90243

Please sign in to comment.