@@ -65,24 +65,34 @@ def sequence(self, reverse=False):
6565 for i in range (start , end , step ):
6666 value = self .values [i ]
6767 count = 0
68+ values_bin = bin (value )
69+ 6870 while value != 0 :
6971 values_bin = bin (value )
7072 if value & 1 == 1 :
7173 yield count + i * (1 << self .div_num )
72- value = value >> 1
74+ value = max ( value >> 1 , 0 )
7375 count += 1
7476 else :
7577 count += 1
76- value = value >> 1
78+ value = max (value >> 1 , 0 )
79+ 7780
7881if __name__ == "__main__" :
7982 bit_map = XC_bitmap (1000 )
80- print (" need bit memory_size {a} 个整数(s) \n " .format (a = bit_map .bit_size ))
81- num_list = [32 , 63 , 64 , 65 , 125 , 126 , 126 , 128 , 129 , 98 , 999 ]
82- 83+ # print(" need bit memory_size {a} 个整数(s) \n".format(a=bit_map.bit_size))
84+ #
85+ import numpy as np
86+ #
87+ test_list = np .random .randint (0 , 1000 , 100 )
88+ print (test_list )
89+ for _ in test_list :
90+ bit_map .add (_ )
8391 print ("\n == sort == \n " )
84- for _ in bit_map .sequence (reverse = True ):
92+ for _ in bit_map .sequence (reverse = False ):
8593 print (_ )
94+ # [814 679 105 957 217 638 663 89 895 842]
95+ print ("13 + bin " + bin (- 9223372036854774784 ))
8696
8797
8898
0 commit comments