Class: Roaring::Bitmap32
Constant Summary
collapse
- MIN =
0
- MAX =
(2**32) - 1
- RANGE =
MIN..MAX
Class Method Summary
collapse
Instance Method Summary
collapse
#<=>, #>, #>=, #_dump, #disjoint?, #hash, included, #initialize, #initialize_copy, #inspect, #to_a, #to_set
Class Method Details
.deserialize(str) ⇒ Object
192
193
194
195
196
197
|
# File 'ext/roaring/bitmap32.c', line 192
static VALUE rb_roaring32_deserialize(VALUE self, VALUE str)
{
roaring_bitmap_t *bitmap = roaring_bitmap_portable_deserialize_safe(RSTRING_PTR(str), RSTRING_LEN(str));
return TypedData_Wrap_Struct(cRoaringBitmap32, &roaring_type, bitmap);
}
|
Instance Method Details
#&(other) ⇒ Object
219
220
221
222
|
# File 'ext/roaring/bitmap32.c', line 219
static VALUE rb_roaring32_and(VALUE self, VALUE other)
{
return rb_roaring32_binary_op(self, other, roaring_bitmap_and);
}
|
#-(other) ⇒ Object
234
235
236
237
|
# File 'ext/roaring/bitmap32.c', line 234
static VALUE rb_roaring32_andnot(VALUE self, VALUE other)
{
return rb_roaring32_binary_op(self, other, roaring_bitmap_andnot);
}
|
#<(other) ⇒ Object
244
245
246
247
|
# File 'ext/roaring/bitmap32.c', line 244
static VALUE rb_roaring32_lt(VALUE self, VALUE other)
{
return rb_roaring32_binary_op_bool(self, other, roaring_bitmap_is_strict_subset);
}
|
#<<(val) ⇒ Object
67
68
69
70
71
72
73
74
|
# File 'ext/roaring/bitmap32.c', line 67
static VALUE rb_roaring32_add(VALUE self, VALUE val)
{
roaring_bitmap_t *data = get_bitmap(self);
uint32_t num = NUM2UINT32(val);
roaring_bitmap_add(data, num);
return self;
}
|
#<=(other) ⇒ Object
249
250
251
252
|
# File 'ext/roaring/bitmap32.c', line 249
static VALUE rb_roaring32_lte(VALUE self, VALUE other)
{
return rb_roaring32_binary_op_bool(self, other, roaring_bitmap_is_subset);
}
|
#==(other) ⇒ Object
239
240
241
242
|
# File 'ext/roaring/bitmap32.c', line 239
static VALUE rb_roaring32_eq(VALUE self, VALUE other)
{
return rb_roaring32_binary_op_bool(self, other, roaring_bitmap_equals);
}
|
#[](rankv) ⇒ Object
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
# File 'ext/roaring/bitmap32.c', line 134
static VALUE rb_roaring32_aref(VALUE self, VALUE rankv)
{
roaring_bitmap_t *data = get_bitmap(self);
uint32_t rank = NUM2UINT32(rankv);
uint32_t val;
if (roaring_bitmap_select(data, rank, &val)) {
return UINT2NUM(val);
} else {
return Qnil;
}
return self;
}
|
#^(other) ⇒ Object
229
230
231
232
|
# File 'ext/roaring/bitmap32.c', line 229
static VALUE rb_roaring32_xor(VALUE self, VALUE other)
{
return rb_roaring32_binary_op(self, other, roaring_bitmap_xor);
}
|
#add(val) ⇒ Object
67
68
69
70
71
72
73
74
|
# File 'ext/roaring/bitmap32.c', line 67
static VALUE rb_roaring32_add(VALUE self, VALUE val)
{
roaring_bitmap_t *data = get_bitmap(self);
uint32_t num = NUM2UINT32(val);
roaring_bitmap_add(data, num);
return self;
}
|
#add?(val) ⇒ Boolean
76
77
78
79
80
81
82
|
# File 'ext/roaring/bitmap32.c', line 76
static VALUE rb_roaring32_add_p(VALUE self, VALUE val)
{
roaring_bitmap_t *data = get_bitmap(self);
uint32_t num = NUM2UINT32(val);
return roaring_bitmap_add_checked(data, num) ? self : Qnil;
}
|
#cardinality ⇒ Object
60
61
62
63
64
65
|
# File 'ext/roaring/bitmap32.c', line 60
static VALUE rb_roaring32_cardinality(VALUE self)
{
roaring_bitmap_t *data = get_bitmap(self);
uint64_t cardinality = roaring_bitmap_get_cardinality(data);
return ULONG2NUM(cardinality);
}
|
#clear ⇒ Object
115
116
117
118
119
120
|
# File 'ext/roaring/bitmap32.c', line 115
static VALUE rb_roaring32_clear(VALUE self)
{
roaring_bitmap_t *data = get_bitmap(self);
roaring_bitmap_clear(data);
return self;
}
|
#each ⇒ Object
127
128
129
130
131
132
|
# File 'ext/roaring/bitmap32.c', line 127
static VALUE rb_roaring32_each(VALUE self)
{
roaring_bitmap_t *data = get_bitmap(self);
roaring_iterate(data, rb_roaring32_each_i, NULL);
return self;
}
|
#empty? ⇒ Boolean
109
110
111
112
113
|
# File 'ext/roaring/bitmap32.c', line 109
static VALUE rb_roaring32_empty_p(VALUE self)
{
roaring_bitmap_t *data = get_bitmap(self);
return RBOOL(roaring_bitmap_is_empty(data));
}
|
#include?(val) ⇒ Boolean
101
102
103
104
105
106
107
|
# File 'ext/roaring/bitmap32.c', line 101
static VALUE rb_roaring32_include_p(VALUE self, VALUE val)
{
roaring_bitmap_t *data = get_bitmap(self);
uint32_t num = NUM2UINT32(val);
return RBOOL(roaring_bitmap_contains(data, num));
}
|
#intersect?(other) ⇒ Boolean
254
255
256
257
|
# File 'ext/roaring/bitmap32.c', line 254
static VALUE rb_roaring32_intersect_p(VALUE self, VALUE other)
{
return rb_roaring32_binary_op_bool(self, other, roaring_bitmap_intersect);
}
|
#max ⇒ Object
161
162
163
164
165
166
167
168
169
170
171
|
# File 'ext/roaring/bitmap32.c', line 161
static VALUE rb_roaring32_max(VALUE self)
{
roaring_bitmap_t *data = get_bitmap(self);
if (roaring_bitmap_is_empty(data)) {
return Qnil;
} else {
uint32_t val = roaring_bitmap_maximum(data);
return UINT2NUM(val);
}
}
|
#min ⇒ Object
149
150
151
152
153
154
155
156
157
158
159
|
# File 'ext/roaring/bitmap32.c', line 149
static VALUE rb_roaring32_min(VALUE self)
{
roaring_bitmap_t *data = get_bitmap(self);
if (roaring_bitmap_is_empty(data)) {
return Qnil;
} else {
uint32_t val = roaring_bitmap_minimum(data);
return UINT2NUM(val);
}
}
|
#remove(val) ⇒ Object
84
85
86
87
88
89
90
91
|
# File 'ext/roaring/bitmap32.c', line 84
static VALUE rb_roaring32_remove(VALUE self, VALUE val)
{
roaring_bitmap_t *data = get_bitmap(self);
uint32_t num = NUM2UINT32(val);
roaring_bitmap_remove(data, num);
return self;
}
|
#remove?(val) ⇒ Boolean
93
94
95
96
97
98
99
|
# File 'ext/roaring/bitmap32.c', line 93
static VALUE rb_roaring32_remove_p(VALUE self, VALUE val)
{
roaring_bitmap_t *data = get_bitmap(self);
uint32_t num = NUM2UINT32(val);
return roaring_bitmap_remove_checked(data, num) ? self : Qnil;
}
|
#replace(other) ⇒ Object
51
52
53
54
55
56
57
58
|
# File 'ext/roaring/bitmap32.c', line 51
static VALUE rb_roaring32_replace(VALUE self, VALUE other) {
roaring_bitmap_t *self_data = get_bitmap(self);
roaring_bitmap_t *other_data = get_bitmap(other);
roaring_bitmap_overwrite(self_data, other_data);
return self;
}
|
#run_optimize ⇒ Object
173
174
175
176
177
|
# File 'ext/roaring/bitmap32.c', line 173
static VALUE rb_roaring32_run_optimize(VALUE self)
{
roaring_bitmap_t *data = get_bitmap(self);
return RBOOL(roaring_bitmap_run_optimize(data));
}
|
#serialize ⇒ Object
179
180
181
182
183
184
185
186
187
188
189
190
|
# File 'ext/roaring/bitmap32.c', line 179
static VALUE rb_roaring32_serialize(VALUE self)
{
roaring_bitmap_t *data = get_bitmap(self);
size_t size = roaring_bitmap_portable_size_in_bytes(data);
VALUE str = rb_str_buf_new(size);
size_t written = roaring_bitmap_portable_serialize(data, RSTRING_PTR(str));
rb_str_set_len(str, written);
return str;
}
|
#|(other) ⇒ Object
224
225
226
227
|
# File 'ext/roaring/bitmap32.c', line 224
static VALUE rb_roaring32_or(VALUE self, VALUE other)
{
return rb_roaring32_binary_op(self, other, roaring_bitmap_or);
}
|