bitset 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{bitset}
8
- s.version = "0.0.2"
8
+ s.version = "0.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tyler McMullen"]
12
- s.date = %q{2011-02-19}
12
+ s.date = %q{2011-02-26}
13
13
  s.description = %q{A fast C-based Bitset. It supports the standard set operations as well as operations you may expect on bit arrays. (popcount, for instance)}
14
14
  s.email = %q{tbmcmullen@gmail.com}
15
15
  s.extensions = ["ext/bitset/extconf.rb"]
@@ -55,8 +55,8 @@ void raise_index_error() {
55
55
  rb_raise(rb_eIndexError, "Index out of bounds");
56
56
  }
57
57
 
58
- #define _bit_segment(bit) ((bit) >> 6)
59
- #define _bit_mask(bit) (1 << ((bit) & 0x3f))
58
+ #define _bit_segment(bit) ((bit) >> 6UL)
59
+ #define _bit_mask(bit) (1UL << ((bit) & 0x3f))
60
60
 
61
61
  void validate_index(Bitset * bs, int idx) {
62
62
  if(idx < 0 || idx >= bs->len)
@@ -330,7 +330,7 @@ void Init_bitset() {
330
330
  rb_define_alias(cBitset, "^", "xor");
331
331
  rb_define_alias(cBitset, "symmetric_difference", "xor");
332
332
  rb_define_method(cBitset, "not", rb_bitset_not, 0);
333
- rb_define_alias(cBitset, "!", "not");
333
+ rb_define_alias(cBitset, "~", "not");
334
334
  rb_define_method(cBitset, "hamming", rb_bitset_hamming, 1);
335
335
  rb_define_method(cBitset, "each", rb_bitset_each, 0);
336
336
  rb_define_method(cBitset, "to_s", rb_bitset_to_s, 0);
@@ -104,6 +104,12 @@ describe Bitset do
104
104
  bs.clear?(0,2,3,6).should == true
105
105
  end
106
106
 
107
+ it 'returns works with the full range of 64 bit values' do
108
+ bs = Bitset.new(68)
109
+ bs.set 0, 2, 66
110
+ bs.clear?(32, 33, 34).should == true
111
+ end
112
+
107
113
  it 'returns False if not all bits indexed are clear' do
108
114
  bs = Bitset.new(8)
109
115
  bs.set 1, 4
@@ -231,6 +237,10 @@ describe Bitset do
231
237
  bs = Bitset.new(4)
232
238
  bs.set 0, 2
233
239
  bs.to_s.should == "1010"
240
+
241
+ bs = Bitset.new(68)
242
+ bs.set 0, 2, 66
243
+ bs.to_s.should == "101" + ("0" * 63) + "10"
234
244
  end
235
245
  end
236
246
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Tyler McMullen
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-02-19 00:00:00 -08:00
17
+ date: 2011-02-26 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies: []
20
20