blob: d63c0692deed3238d40322b0c992ec86301ed3a9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
|
Testing with TEST_LENGTH = 49
test _bit_byte, _bit_mask, and bitstr_size
i _bit_byte(i) _bit_mask(i) bitstr_size(i)
0 0 1 0
1 0 2 1
2 0 4 1
3 0 8 1
4 0 16 1
5 0 32 1
6 0 64 1
7 0 128 1
8 1 1 1
9 1 2 2
10 1 4 2
11 1 8 2
12 1 16 2
13 1 32 2
14 1 64 2
15 1 128 2
16 2 1 2
17 2 2 3
18 2 4 3
19 2 8 3
20 2 16 3
21 2 32 3
22 2 64 3
23 2 128 3
24 3 1 3
25 3 2 4
26 3 4 4
27 3 8 4
28 3 16 4
29 3 32 4
30 3 64 4
31 3 128 4
32 4 1 4
33 4 2 5
34 4 4 5
35 4 8 5
36 4 16 5
37 4 32 5
38 4 64 5
39 4 128 5
40 5 1 5
41 5 2 6
42 5 4 6
43 5 8 6
44 5 16 6
45 5 32 6
46 5 64 6
47 5 128 6
48 6 1 6
test bit_alloc, clearbits, bit_ffc, bit_ffs
be: 0 -1 0000000000000000000000000000000000000000000000000
is: 0 -1 0000000000000000000000000000000000000000000000000
test bit_set
be: 1 0 1001001001001001001001001001001001001001001001001
is: 1 0 1001001001001001001001001001001001001001001001001
test bit_clear
be: 0 3 0001000001000001000001000001000001000001000001000
is: 0 3 0001000001000001000001000001000001000001000001000
test bit_test using previous bitstring
i bit_test(i)
0 0
1 0
2 0
3 8
4 0
5 0
6 0
7 0
8 0
9 2
10 0
11 0
12 0
13 0
14 0
15 128
16 0
17 0
18 0
19 0
20 0
21 32
22 0
23 0
24 0
25 0
26 0
27 8
28 0
29 0
30 0
31 0
32 0
33 2
34 0
35 0
36 0
37 0
38 0
39 128
40 0
41 0
42 0
43 0
44 0
45 32
46 0
47 0
48 0
test clearbits
be: 0 -1 0000000000000000000000000000000000000000000000000
is: 0 -1 0000000000000000000000000000000000000000000000000
test bit_nset and bit_nclear
be: 0 1 0111111111111111111111111111111111111111111111110
is: 0 1 0111111111111111111111111111111111111111111111110
be: 0 1 0100000000000000000000000000000000000000000000010
is: 0 1 0100000000000000000000000000000000000000000000010
be: 0 -1 0000000000000000000000000000000000000000000000000
is: 0 -1 0000000000000000000000000000000000000000000000000
be: 48 0 1111111111111111111111111111111111111111111111110
is: 48 0 1111111111111111111111111111111111111111111111110
be: 0 -1 0000000000000000000000000000000000000000000000000
is: 0 -1 0000000000000000000000000000000000000000000000000
first 1 bit should move right 1 position each line
0 -1 0 1111111111111111111111111111111111111111111111111
1 0 1 0111111111111111111111111111111111111111111111111
2 0 2 0011111111111111111111111111111111111111111111111
3 0 3 0001111111111111111111111111111111111111111111111
4 0 4 0000111111111111111111111111111111111111111111111
5 0 5 0000011111111111111111111111111111111111111111111
6 0 6 0000001111111111111111111111111111111111111111111
7 0 7 0000000111111111111111111111111111111111111111111
8 0 8 0000000011111111111111111111111111111111111111111
9 0 9 0000000001111111111111111111111111111111111111111
10 0 10 0000000000111111111111111111111111111111111111111
11 0 11 0000000000011111111111111111111111111111111111111
12 0 12 0000000000001111111111111111111111111111111111111
13 0 13 0000000000000111111111111111111111111111111111111
14 0 14 0000000000000011111111111111111111111111111111111
15 0 15 0000000000000001111111111111111111111111111111111
16 0 16 0000000000000000111111111111111111111111111111111
17 0 17 0000000000000000011111111111111111111111111111111
18 0 18 0000000000000000001111111111111111111111111111111
19 0 19 0000000000000000000111111111111111111111111111111
20 0 20 0000000000000000000011111111111111111111111111111
21 0 21 0000000000000000000001111111111111111111111111111
22 0 22 0000000000000000000000111111111111111111111111111
23 0 23 0000000000000000000000011111111111111111111111111
24 0 24 0000000000000000000000001111111111111111111111111
25 0 25 0000000000000000000000000111111111111111111111111
26 0 26 0000000000000000000000000011111111111111111111111
27 0 27 0000000000000000000000000001111111111111111111111
28 0 28 0000000000000000000000000000111111111111111111111
29 0 29 0000000000000000000000000000011111111111111111111
30 0 30 0000000000000000000000000000001111111111111111111
31 0 31 0000000000000000000000000000000111111111111111111
32 0 32 0000000000000000000000000000000011111111111111111
33 0 33 0000000000000000000000000000000001111111111111111
34 0 34 0000000000000000000000000000000000111111111111111
35 0 35 0000000000000000000000000000000000011111111111111
36 0 36 0000000000000000000000000000000000001111111111111
37 0 37 0000000000000000000000000000000000000111111111111
38 0 38 0000000000000000000000000000000000000011111111111
39 0 39 0000000000000000000000000000000000000001111111111
40 0 40 0000000000000000000000000000000000000000111111111
41 0 41 0000000000000000000000000000000000000000011111111
42 0 42 0000000000000000000000000000000000000000001111111
43 0 43 0000000000000000000000000000000000000000000111111
44 0 44 0000000000000000000000000000000000000000000011111
45 0 45 0000000000000000000000000000000000000000000001111
46 0 46 0000000000000000000000000000000000000000000000111
47 0 47 0000000000000000000000000000000000000000000000011
48 0 48 0000000000000000000000000000000000000000000000001
first 0 bit should move right 1 position each line
0 0 -1 0000000000000000000000000000000000000000000000000
1 1 0 1000000000000000000000000000000000000000000000000
2 2 0 1100000000000000000000000000000000000000000000000
3 3 0 1110000000000000000000000000000000000000000000000
4 4 0 1111000000000000000000000000000000000000000000000
5 5 0 1111100000000000000000000000000000000000000000000
6 6 0 1111110000000000000000000000000000000000000000000
7 7 0 1111111000000000000000000000000000000000000000000
8 8 0 1111111100000000000000000000000000000000000000000
9 9 0 1111111110000000000000000000000000000000000000000
10 10 0 1111111111000000000000000000000000000000000000000
11 11 0 1111111111100000000000000000000000000000000000000
12 12 0 1111111111110000000000000000000000000000000000000
13 13 0 1111111111111000000000000000000000000000000000000
14 14 0 1111111111111100000000000000000000000000000000000
15 15 0 1111111111111110000000000000000000000000000000000
16 16 0 1111111111111111000000000000000000000000000000000
17 17 0 1111111111111111100000000000000000000000000000000
18 18 0 1111111111111111110000000000000000000000000000000
19 19 0 1111111111111111111000000000000000000000000000000
20 20 0 1111111111111111111100000000000000000000000000000
21 21 0 1111111111111111111110000000000000000000000000000
22 22 0 1111111111111111111111000000000000000000000000000
23 23 0 1111111111111111111111100000000000000000000000000
24 24 0 1111111111111111111111110000000000000000000000000
25 25 0 1111111111111111111111111000000000000000000000000
26 26 0 1111111111111111111111111100000000000000000000000
27 27 0 1111111111111111111111111110000000000000000000000
28 28 0 1111111111111111111111111111000000000000000000000
29 29 0 1111111111111111111111111111100000000000000000000
30 30 0 1111111111111111111111111111110000000000000000000
31 31 0 1111111111111111111111111111111000000000000000000
32 32 0 1111111111111111111111111111111100000000000000000
33 33 0 1111111111111111111111111111111110000000000000000
34 34 0 1111111111111111111111111111111111000000000000000
35 35 0 1111111111111111111111111111111111100000000000000
36 36 0 1111111111111111111111111111111111110000000000000
37 37 0 1111111111111111111111111111111111111000000000000
38 38 0 1111111111111111111111111111111111111100000000000
39 39 0 1111111111111111111111111111111111111110000000000
40 40 0 1111111111111111111111111111111111111111000000000
41 41 0 1111111111111111111111111111111111111111100000000
42 42 0 1111111111111111111111111111111111111111110000000
43 43 0 1111111111111111111111111111111111111111111000000
44 44 0 1111111111111111111111111111111111111111111100000
45 45 0 1111111111111111111111111111111111111111111110000
46 46 0 1111111111111111111111111111111111111111111111000
47 47 0 1111111111111111111111111111111111111111111111100
48 48 0 1111111111111111111111111111111111111111111111110
first 0 bit should move left 1 position each line
0 -1 0 1111111111111111111111111111111111111111111111111
1 48 0 1111111111111111111111111111111111111111111111110
2 47 0 1111111111111111111111111111111111111111111111100
3 46 0 1111111111111111111111111111111111111111111111000
4 45 0 1111111111111111111111111111111111111111111110000
5 44 0 1111111111111111111111111111111111111111111100000
6 43 0 1111111111111111111111111111111111111111111000000
7 42 0 1111111111111111111111111111111111111111110000000
8 41 0 1111111111111111111111111111111111111111100000000
9 40 0 1111111111111111111111111111111111111111000000000
10 39 0 1111111111111111111111111111111111111110000000000
11 38 0 1111111111111111111111111111111111111100000000000
12 37 0 1111111111111111111111111111111111111000000000000
13 36 0 1111111111111111111111111111111111110000000000000
14 35 0 1111111111111111111111111111111111100000000000000
15 34 0 1111111111111111111111111111111111000000000000000
16 33 0 1111111111111111111111111111111110000000000000000
17 32 0 1111111111111111111111111111111100000000000000000
18 31 0 1111111111111111111111111111111000000000000000000
19 30 0 1111111111111111111111111111110000000000000000000
20 29 0 1111111111111111111111111111100000000000000000000
21 28 0 1111111111111111111111111111000000000000000000000
22 27 0 1111111111111111111111111110000000000000000000000
23 26 0 1111111111111111111111111100000000000000000000000
24 25 0 1111111111111111111111111000000000000000000000000
25 24 0 1111111111111111111111110000000000000000000000000
26 23 0 1111111111111111111111100000000000000000000000000
27 22 0 1111111111111111111111000000000000000000000000000
28 21 0 1111111111111111111110000000000000000000000000000
29 20 0 1111111111111111111100000000000000000000000000000
30 19 0 1111111111111111111000000000000000000000000000000
31 18 0 1111111111111111110000000000000000000000000000000
32 17 0 1111111111111111100000000000000000000000000000000
33 16 0 1111111111111111000000000000000000000000000000000
34 15 0 1111111111111110000000000000000000000000000000000
35 14 0 1111111111111100000000000000000000000000000000000
36 13 0 1111111111111000000000000000000000000000000000000
37 12 0 1111111111110000000000000000000000000000000000000
38 11 0 1111111111100000000000000000000000000000000000000
39 10 0 1111111111000000000000000000000000000000000000000
40 9 0 1111111110000000000000000000000000000000000000000
41 8 0 1111111100000000000000000000000000000000000000000
42 7 0 1111111000000000000000000000000000000000000000000
43 6 0 1111110000000000000000000000000000000000000000000
44 5 0 1111100000000000000000000000000000000000000000000
45 4 0 1111000000000000000000000000000000000000000000000
46 3 0 1110000000000000000000000000000000000000000000000
47 2 0 1100000000000000000000000000000000000000000000000
48 1 0 1000000000000000000000000000000000000000000000000
first 1 bit should move left 1 position each line
0 0 -1 0000000000000000000000000000000000000000000000000
1 0 48 0000000000000000000000000000000000000000000000001
2 0 47 0000000000000000000000000000000000000000000000011
3 0 46 0000000000000000000000000000000000000000000000111
4 0 45 0000000000000000000000000000000000000000000001111
5 0 44 0000000000000000000000000000000000000000000011111
6 0 43 0000000000000000000000000000000000000000000111111
7 0 42 0000000000000000000000000000000000000000001111111
8 0 41 0000000000000000000000000000000000000000011111111
9 0 40 0000000000000000000000000000000000000000111111111
10 0 39 0000000000000000000000000000000000000001111111111
11 0 38 0000000000000000000000000000000000000011111111111
12 0 37 0000000000000000000000000000000000000111111111111
13 0 36 0000000000000000000000000000000000001111111111111
14 0 35 0000000000000000000000000000000000011111111111111
15 0 34 0000000000000000000000000000000000111111111111111
16 0 33 0000000000000000000000000000000001111111111111111
17 0 32 0000000000000000000000000000000011111111111111111
18 0 31 0000000000000000000000000000000111111111111111111
19 0 30 0000000000000000000000000000001111111111111111111
20 0 29 0000000000000000000000000000011111111111111111111
21 0 28 0000000000000000000000000000111111111111111111111
22 0 27 0000000000000000000000000001111111111111111111111
23 0 26 0000000000000000000000000011111111111111111111111
24 0 25 0000000000000000000000000111111111111111111111111
25 0 24 0000000000000000000000001111111111111111111111111
26 0 23 0000000000000000000000011111111111111111111111111
27 0 22 0000000000000000000000111111111111111111111111111
28 0 21 0000000000000000000001111111111111111111111111111
29 0 20 0000000000000000000011111111111111111111111111111
30 0 19 0000000000000000000111111111111111111111111111111
31 0 18 0000000000000000001111111111111111111111111111111
32 0 17 0000000000000000011111111111111111111111111111111
33 0 16 0000000000000000111111111111111111111111111111111
34 0 15 0000000000000001111111111111111111111111111111111
35 0 14 0000000000000011111111111111111111111111111111111
36 0 13 0000000000000111111111111111111111111111111111111
37 0 12 0000000000001111111111111111111111111111111111111
38 0 11 0000000000011111111111111111111111111111111111111
39 0 10 0000000000111111111111111111111111111111111111111
40 0 9 0000000001111111111111111111111111111111111111111
41 0 8 0000000011111111111111111111111111111111111111111
42 0 7 0000000111111111111111111111111111111111111111111
43 0 6 0000001111111111111111111111111111111111111111111
44 0 5 0000011111111111111111111111111111111111111111111
45 0 4 0000111111111111111111111111111111111111111111111
46 0 3 0001111111111111111111111111111111111111111111111
47 0 2 0011111111111111111111111111111111111111111111111
48 0 1 0111111111111111111111111111111111111111111111111
0 bit should move right 1 position each line
0 0 1 0111111111111111111111111111111111111111111111111
1 1 0 1011111111111111111111111111111111111111111111111
2 2 0 1101111111111111111111111111111111111111111111111
3 3 0 1110111111111111111111111111111111111111111111111
4 4 0 1111011111111111111111111111111111111111111111111
5 5 0 1111101111111111111111111111111111111111111111111
6 6 0 1111110111111111111111111111111111111111111111111
7 7 0 1111111011111111111111111111111111111111111111111
8 8 0 1111111101111111111111111111111111111111111111111
9 9 0 1111111110111111111111111111111111111111111111111
10 10 0 1111111111011111111111111111111111111111111111111
11 11 0 1111111111101111111111111111111111111111111111111
12 12 0 1111111111110111111111111111111111111111111111111
13 13 0 1111111111111011111111111111111111111111111111111
14 14 0 1111111111111101111111111111111111111111111111111
15 15 0 1111111111111110111111111111111111111111111111111
16 16 0 1111111111111111011111111111111111111111111111111
17 17 0 1111111111111111101111111111111111111111111111111
18 18 0 1111111111111111110111111111111111111111111111111
19 19 0 1111111111111111111011111111111111111111111111111
20 20 0 1111111111111111111101111111111111111111111111111
21 21 0 1111111111111111111110111111111111111111111111111
22 22 0 1111111111111111111111011111111111111111111111111
23 23 0 1111111111111111111111101111111111111111111111111
24 24 0 1111111111111111111111110111111111111111111111111
25 25 0 1111111111111111111111111011111111111111111111111
26 26 0 1111111111111111111111111101111111111111111111111
27 27 0 1111111111111111111111111110111111111111111111111
28 28 0 1111111111111111111111111111011111111111111111111
29 29 0 1111111111111111111111111111101111111111111111111
30 30 0 1111111111111111111111111111110111111111111111111
31 31 0 1111111111111111111111111111111011111111111111111
32 32 0 1111111111111111111111111111111101111111111111111
33 33 0 1111111111111111111111111111111110111111111111111
34 34 0 1111111111111111111111111111111111011111111111111
35 35 0 1111111111111111111111111111111111101111111111111
36 36 0 1111111111111111111111111111111111110111111111111
37 37 0 1111111111111111111111111111111111111011111111111
38 38 0 1111111111111111111111111111111111111101111111111
39 39 0 1111111111111111111111111111111111111110111111111
40 40 0 1111111111111111111111111111111111111111011111111
41 41 0 1111111111111111111111111111111111111111101111111
42 42 0 1111111111111111111111111111111111111111110111111
43 43 0 1111111111111111111111111111111111111111111011111
44 44 0 1111111111111111111111111111111111111111111101111
45 45 0 1111111111111111111111111111111111111111111110111
46 46 0 1111111111111111111111111111111111111111111111011
47 47 0 1111111111111111111111111111111111111111111111101
48 48 0 1111111111111111111111111111111111111111111111110
1 bit should move right 1 position each line
0 1 0 1000000000000000000000000000000000000000000000000
1 0 1 0100000000000000000000000000000000000000000000000
2 0 2 0010000000000000000000000000000000000000000000000
3 0 3 0001000000000000000000000000000000000000000000000
4 0 4 0000100000000000000000000000000000000000000000000
5 0 5 0000010000000000000000000000000000000000000000000
6 0 6 0000001000000000000000000000000000000000000000000
7 0 7 0000000100000000000000000000000000000000000000000
8 0 8 0000000010000000000000000000000000000000000000000
9 0 9 0000000001000000000000000000000000000000000000000
10 0 10 0000000000100000000000000000000000000000000000000
11 0 11 0000000000010000000000000000000000000000000000000
12 0 12 0000000000001000000000000000000000000000000000000
13 0 13 0000000000000100000000000000000000000000000000000
14 0 14 0000000000000010000000000000000000000000000000000
15 0 15 0000000000000001000000000000000000000000000000000
16 0 16 0000000000000000100000000000000000000000000000000
17 0 17 0000000000000000010000000000000000000000000000000
18 0 18 0000000000000000001000000000000000000000000000000
19 0 19 0000000000000000000100000000000000000000000000000
20 0 20 0000000000000000000010000000000000000000000000000
21 0 21 0000000000000000000001000000000000000000000000000
22 0 22 0000000000000000000000100000000000000000000000000
23 0 23 0000000000000000000000010000000000000000000000000
24 0 24 0000000000000000000000001000000000000000000000000
25 0 25 0000000000000000000000000100000000000000000000000
26 0 26 0000000000000000000000000010000000000000000000000
27 0 27 0000000000000000000000000001000000000000000000000
28 0 28 0000000000000000000000000000100000000000000000000
29 0 29 0000000000000000000000000000010000000000000000000
30 0 30 0000000000000000000000000000001000000000000000000
31 0 31 0000000000000000000000000000000100000000000000000
32 0 32 0000000000000000000000000000000010000000000000000
33 0 33 0000000000000000000000000000000001000000000000000
34 0 34 0000000000000000000000000000000000100000000000000
35 0 35 0000000000000000000000000000000000010000000000000
36 0 36 0000000000000000000000000000000000001000000000000
37 0 37 0000000000000000000000000000000000000100000000000
38 0 38 0000000000000000000000000000000000000010000000000
39 0 39 0000000000000000000000000000000000000001000000000
40 0 40 0000000000000000000000000000000000000000100000000
41 0 41 0000000000000000000000000000000000000000010000000
42 0 42 0000000000000000000000000000000000000000001000000
43 0 43 0000000000000000000000000000000000000000000100000
44 0 44 0000000000000000000000000000000000000000000010000
45 0 45 0000000000000000000000000000000000000000000001000
46 0 46 0000000000000000000000000000000000000000000000100
47 0 47 0000000000000000000000000000000000000000000000010
48 0 48 0000000000000000000000000000000000000000000000001
|