Skip to content

Commit

Permalink
xzre_code: add count_bits
Browse files Browse the repository at this point in the history
  • Loading branch information
smx-smx committed Aug 3, 2024
1 parent f4e6005 commit 504a052
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions xzre_code/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
add_library(xzre_code
backdoor_entry.c
chacha_decrypt.c
count_bits.c
count_pointers.c
elf_parse.c
elf_symbol_get_addr.c
Expand Down
10 changes: 10 additions & 0 deletions xzre_code/count_bits.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Copyright (C) 2024 Stefano Moioli <[email protected]>
**/
#include "xzre.h"

u32 count_bits(u64 x){
u32 result;
for(result=0; x; ++result, x &= x-1);
return result;
}

0 comments on commit 504a052

Please sign in to comment.