summaryrefslogtreecommitdiff
path: root/src/test.c
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2010-05-14 01:09:42 +0200
committerHenrik Rydberg <rydberg@euromail.se>2010-05-14 01:41:39 +0200
commitf02210172efc6bfc05c4598c14e1268d2828097e (patch)
tree00457552d4fe048b17b4a73d58d17c9db63552f8 /src/test.c
parent1e37ed517ef0906767a230ab384b8e66869cf4b2 (diff)
Simplify bit bookkeeping
In preparation of adding several additional finger bit registers, remove the redundant bit-counting variables and introduce fast bit-traversal functions instead. Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'src/test.c')
-rw-r--r--src/test.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test.c b/src/test.c
index e9b8ce3..fc16201 100644
--- a/src/test.c
+++ b/src/test.c
@@ -19,10 +19,23 @@
19 * 19 *
20 **************************************************************************/ 20 **************************************************************************/
21 21
22#include "common.h"
22#include <stdio.h> 23#include <stdio.h>
23#include <time.h> 24#include <time.h>
24 25
26static void print_bitfield(unsigned m)
27{
28 int i;
29
30 printf("%d\n", m);
31 foreach_bit(i, m)
32 printf("%d %d\n", i, 1 << i);
33}
34
25int main(int argc, char *argv[]) 35int main(int argc, char *argv[])
26{ 36{
37 print_bitfield(5);
38 print_bitfield(126);
39 print_bitfield(0);
27 return 0; 40 return 0;
28} 41}