gitignore ignorable gtksparrow executable
[sparrow.git] / shift_test.c
blobae7f3ffcd6ca26f13873f1c84dadb9a8e0b8d81c
1 #include "sparrow.h"
2 #include <string.h>
3 #include <math.h>
6 static inline char *
7 int64_to_binary_string(char *s, guint64 n){
8 /* s should be a *65* byte array */
9 int i;
10 guint64 bit = 1ULL << 63;
11 for (i = 0; i < 64; i++){
12 s[i] = (n & (1ULL << (63 - i))) ? '*' : '.';
13 //s[i] = ((n & bit)) ? '*' : '.';
14 //bit >>= 1;
16 s[64] = 0;
17 return s;
20 static void
21 test_shifts()
23 static char s[65];
24 guint64 x = 1;
25 int i;
26 for (i = 0; i < 64; i++){
27 int64_to_binary_string(s, x);
28 printf("%s, %llx, %16llx\n", s, x, x);
29 x <<= 1;
33 int main()
35 test_shifts();