Debian Codegraph @

lang-maps/libbm/include/libbm.h

raw
1 #ifndef LIBBM_INCLUDED_H__
2 #define LIBBM_INCLUDED_H__
3 /*
4 BitMagic Library License
5
6 Copyright(c) 2002-2017 Anatoliy Kuznetsov(anatoliy_kuznetsov at yahoo.com)
7
8 Licensed under the Apache License, Version 2.0 (the "License");
9 you may not use this file except in compliance with the License.
10 You may obtain a copy of the License at
11
12 http://www.apache.org/licenses/LICENSE-2.0
13
14 Unless required by applicable law or agreed to in writing, software
15 distributed under the License is distributed on an "AS IS" BASIS,
16 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 See the License for the specific language governing permissions and
18 limitations under the License.
19
20 For more information please visit: http://bitmagic.io
21 */
22
23 #include <stddef.h>
24
25 /* Error codes */
26
27 /* General purpose codes */
28 #define BM_OK (0)
29 #define BM_ERR_BADALLOC (1)
30 #define BM_ERR_BADARG (2)
31 #define BM_ERR_RANGE (3)
32 #define BM_ERR_CPU (4)
33 #define BM_ERR_SERIALFORMAT (5)
34 #define BM_ERR_BAD_VALUE (6)
35 #define BM_ERR_RANK_SELECT_IDX_MISSING (7)
36
37 /* Error codes for Java/JNI incapsulation */
38 #define BM_ERR_DETACHED (101)
39 #define BM_ERR_JVM_NOT_SUPPORTED (102)
40 #define BM_ERR_JVM_OUT_OF_MEMORY (103)
41
42 /*
43 error codes and messages
44 */
45 #define BM_OK_MSG "BM-00: All correct"
46 #define BM_ERR_BADALLOC_MSG "BM-01: Allocation error"
47 #define BM_ERR_BADARG_MSG "BM-02: Invalid or missing function argument"
48 #define BM_ERR_RANGE_MSG "BM-03: Incorrect range or index"
49 #define BM_ERR_CPU_MSG "BM-04: Incorrect CPU vectorization (SIMD) version"
50 #define BM_ERR_SERIALFORMAT_MSG "BM-05: Serialization format error"
51 #define BM_ERR_BAD_VALUE_MSG "BM-06: Bad value"
52 #define BM_ERR_RANK_SELECT_IDX_MISSING_MSG "BM-07: Rank-Select index not constructed, call sync() first"
53
54
55
56 #define BM_ERR_DETACHED_MSG "BM-101: Current thread no attached to JVM"
57 #define BM_ERR_JVM_NOT_SUPPORTED_MSG "BM-102: JVM version not supported"
58 #define BM_ERR_JVM_OUT_OF_MEMORY_MSG "BM-103: Out of memory error"
59
60 #define BM_UNK_MSG "BM-XX: Unknown error"
61
62
63 /*
64 List of supported SIMD versions
65 */
66 #define BM_SIMD_NO 0
67 #define BM_SIMD_SSE2 1
68 #define BM_SIMD_SSE42 2
69 #define BM_SIMD_AVX2 5
70
71
72
73 /* bit-vector handle */
74 #define BM_BVHANDLE void*
75 /* bit-vector enumerator handle */
76 #define BM_BVEHANDLE void*
77
78
79 /* arguments codes and values */
80 #define BM_TRUE 1
81 #define BM_FALSE 0
82
83 // -------------------------------------------------------
84 // Windows DLL import/export definitions
85 // to enable DLL configuration #define "BM_USE_DLL"
86 // otherwise it assumes static linkage
87 //
88 #if defined(_WIN32)
89 #ifdef BMDLLEXPORTS
90 # define BM_API_EXPORT __declspec(dllexport)
91 #else
92 #if defined(BM_USE_DLL)
93 # define BM_API_EXPORT __declspec(dllimport)
94 #else
95 # define BM_API_EXPORT
96 #endif
97 #endif
98 #else
99 # define BM_API_EXPORT
100 #endif
101
102
103 #ifdef __cplusplus
104 extern "C" {
105 #endif /* __cplusplus */
106
107 /* bit vector statistics used for serialization and memory management
108 */
109 struct BM_bvector_statistics
110 {
111 size_t bit_blocks;
112 size_t gap_blocks;
113 size_t max_serialize_mem;
114 size_t memory_used;
115 };
116
117
118 /* -------------------------------------------- */
119 /* General purpose functions */
120 /* -------------------------------------------- */
121
122 /* Initialize libbm runtime before use*/
123 BM_API_EXPORT int BM_init(void*);
124
125 /**
126 return copyright info string and version information.
127 */
128 BM_API_EXPORT const char* BM_version(int* major, int* minor, int* patch);
129
130 /**
131 return SIMD version used to build binaries
132 one of BM_SIMD_* defines
133 */
134 BM_API_EXPORT int BM_simd_version(void);
135
136
137 /**
138 return error message by code
139 */
140 BM_API_EXPORT const char* BM_error_msg(int errcode);
141
142 /* ------------------------------------------------- */
143 /* bvector construction, swap and sizing methods */
144 /* ------------------------------------------------- */
145
146 /* construction and setters */
147
148 /* construct bvector handle
149 bv_max - maximum number of allowed bits (if 0 - allows maximum)
150 (it is recommened to set size to maximum always and do not use size params)
151 */
152 BM_API_EXPORT int BM_bvector_construct(BM_BVHANDLE* h, unsigned int bv_max);
153
154 /* init bvector handle to finilize construction
155 This step is optional, unless we need to call "_no_check()" functions, which bypass
156 certain checks
157 */
158 BM_API_EXPORT int BM_bvector_init(BM_BVHANDLE h);
159
160
161 /* construct bvector handle as a copy
162 hfrom - another handle to copy from
163 */
164 BM_API_EXPORT int BM_bvector_construct_copy(BM_BVHANDLE* h, BM_BVHANDLE hfrom);
165
166 /* construct bvector handle as a read-only copy
167 hfrom - another handle to copy from
168 */
169 BM_API_EXPORT int BM_bvector_construct_copy_ro(BM_BVHANDLE* h, BM_BVHANDLE hfrom);
170
171 /* construct bvector handle as a read-write copy
172 hfrom - another handle to copy from
173 */
174 BM_API_EXPORT int BM_bvector_construct_copy_rw(BM_BVHANDLE* h, BM_BVHANDLE hfrom);
175
176
177 /* destroy bvector handle */
178 BM_API_EXPORT int BM_bvector_free(BM_BVHANDLE h);
179
180 /* get bit vector size
181 psize - return size the bit vector
182 */
183 BM_API_EXPORT int BM_bvector_get_size(BM_BVHANDLE h, unsigned int* psize);
184
185 /* get bit vector capacity
186 pcap - return caapacity the bit vector
187 */
188 /*int BM_bvector_get_capacity(BM_BVHANDLE h, unsigned int* pcap);*/
189
190
191 /* resize bit vector
192 new_size - new requested size
193 */
194 BM_API_EXPORT int BM_bvector_set_size(BM_BVHANDLE h, unsigned int new_size);
195
196 /* swap two bit-vectors
197 */
198 BM_API_EXPORT int BM_bvector_swap(BM_BVHANDLE h1, BM_BVHANDLE h2);
199
200
201 /* -------------------------------------------- */
202 /* bvector functions to set and clear bits */
203 /* -------------------------------------------- */
204
205
206 /* set bit to 1 or 0
207 i - index of a bit to set
208 val - value (0 | 1)
209 */
210 BM_API_EXPORT int BM_bvector_set_bit(BM_BVHANDLE h, unsigned int i, int val);
211
212 /* set list of bits to 1
213 idx - index of bits to set
214 idx_size - size of the array to set
215 */
216 BM_API_EXPORT int BM_bvector_set_bits(BM_BVHANDLE h, unsigned int* idx, unsigned int idx_size);
217
218
219 /* set bit to 1 without extra checks (faster).
220 Use of this function requires full initialization by BM_bvector_init();
221 i - index of a bit to set
222 */
223 BM_API_EXPORT int BM_bvector_set_bit_no_check(BM_BVHANDLE h, unsigned int i);
224
225
226 /* set bit only if current value equals the condition
227 i - index of a bit to set
228 val - value (0 | 1)
229 condition - expected current value of bit i
230 pchanged - optional return value, if bit was actually changed
231 */
232 BM_API_EXPORT
233 int BM_bvector_set_bit_conditional(BM_BVHANDLE h,
234 unsigned int i,
235 int val,
236 int condition,
237 int* pchanged);
238
239 /* flip bit
240 i - index of a bit to flip
241 */
242 BM_API_EXPORT
243 int BM_bvector_flip_bit(BM_BVHANDLE h, unsigned int i);
244
245 /* swap bits
246 i1 - index of a bit 1 tpo swap
247 i1 - index of a bit 1 tpo swap
248 */
249 BM_API_EXPORT
250 int BM_bvector_swap_bits(BM_BVHANDLE h, unsigned int i1, unsigned int i2);
251
252
253 /* inc bit at position
254 i - index of a bit to flip
255 1 + 0 = 1 (no carry over)
256 1 + 1 = 0 (1 carry over)
257 carry_over - carry over bit
258 */
259 BM_API_EXPORT
260 int BM_bvector_inc_bit(BM_BVHANDLE h, unsigned int i, int* carry_over);
261
262
263 /* set all bits to 1
264 */
265 BM_API_EXPORT int BM_bvector_set(BM_BVHANDLE h);
266
267
268
269 /* Sets all bits in the specified closed interval [left,right]
270 This method DOES NOT resize vector.
271
272 left - interval start
273 right - interval end (closed interval)
274 value - value to set interval in
275
276 */
277 BM_API_EXPORT int BM_bvector_set_range(BM_BVHANDLE h,
278 unsigned int left,
279 unsigned int right,
280 int value);
281
282 /* invert all bits in the bit vector
283 */
284 BM_API_EXPORT int BM_bvector_invert(BM_BVHANDLE h);
285
286
287
288 /* set all bits to 0 and (optionally) free unused memory
289 free_mem - flag to release unused memory
290 */
291 BM_API_EXPORT int BM_bvector_clear(BM_BVHANDLE h, int free_mem);
292
293 /* find 1 bit index in the vector and set it to 0
294
295 i - index of bit to search from
296 pnext - return index of the next 1 bit. 0 - means no more 1 bits.
297 */
298 BM_API_EXPORT int BM_bvector_extract_next(BM_BVHANDLE h, unsigned int i, unsigned int* pnext);
299
300
301
302 /* -------------------------------------------- */
303 /* bvector functions to read bits */
304 /* -------------------------------------------- */
305
306
307 /* get bit value */
308 BM_API_EXPORT int BM_bvector_get_bit(BM_BVHANDLE h, unsigned int i, int* pval);
309
310
311 /* bitcount
312 pcount - return number of ON bits in the vector
313 */
314 BM_API_EXPORT int BM_bvector_count(BM_BVHANDLE h, unsigned int* pcount);
315
316 /* range bitcount
317 left - interval start
318 right - interval end (closed interval)
319 pcount - return number of ON bits in the vector
320 */
321 BM_API_EXPORT
322 int BM_bvector_count_range(BM_BVHANDLE h,
323 unsigned int left,
324 unsigned int right,
325 unsigned int* pcount);
326
327 /* check if there are any bits set
328 pval - return non-zero value if any bits are ON
329 */
330 BM_API_EXPORT int BM_bvector_any(BM_BVHANDLE h, int* pval);
331
332 /* Finds index of 1 bit starting from position
333 from - initial search position
334 ppos - found position of 1 bit (>= from)
335 pfound - 0 if nothing found
336 */
337 BM_API_EXPORT int BM_bvector_find(BM_BVHANDLE h,
338 unsigned int from, unsigned int* ppos, int* pfound);
339
340 /* Finds index of 1 bit starting from the end of the vector
341 ppos - found position of 1 bit (from the end)
342 pfound - 0 if nothing found
343 */
344 BM_API_EXPORT int BM_bvector_find_reverse(BM_BVHANDLE h,
345 unsigned int* ppos, int* pfound);
346
347 /* Finds bit-vector position (index) with specified rank
348 starting from another poistion (if 0 rank is absolute).
349
350 rank - search rank value
351 from - bit-vector position to find from
352 pidx - (out) position with relative rank
353 pfound - 0 if nothing found
354 */
355 BM_API_EXPORT int BM_bvector_find_rank(BM_BVHANDLE h,
356 unsigned int rank,
357 unsigned int from,
358 unsigned int* pidx,
359 int* pfound);
360
361
362 /* find first 1 bit index in the vector
363
364 pi - return index of first bit
365 found - return 0 if first bit not found (empty vector)
366 */
367 BM_API_EXPORT int BM_bvector_get_first(BM_BVHANDLE h, unsigned int* pi,
368 int* pfound);
369
370 /* find 1 bit index in the vector
371
372 i - index of bit to search from
373 pnext - return index of the next 1 bit. 0 - means no more 1 bits.
374 */
375 BM_API_EXPORT int BM_bvector_get_next(BM_BVHANDLE h, unsigned int i,
376 unsigned int* pnext);
377
378
379
380 /* -------------------------------------------- */
381 /* bvector operations */
382 /* -------------------------------------------- */
383
384 /* Lexicographical comparison of two bit vectors
385 pres - returns -1 if h1 less than h2, 1 - greater, 0 - equal.
386 */
387 BM_API_EXPORT int BM_bvector_compare(BM_BVHANDLE h1, BM_BVHANDLE h2, int* pres);
388
389 /* Find first mismatch between two vectors
390 pi - return found mismatch index
391 pfound - return 0 if not found (vectors are identical)
392 */
393 BM_API_EXPORT int BM_bvector_find_first_mismatch(BM_BVHANDLE h1, BM_BVHANDLE h2,
394 unsigned int* pi,
395 int* pfound);
396
397
398
399 /* Perform bit vector memory optimization
400 opt_mode - optimization level:
401 (0 - default, 1 - free empty blocks, 2 - free empty and full blocks, 3 - GAP compress)
402 pstat - optional post optimization statistics
403 */
404 BM_API_EXPORT
405 int BM_bvector_optimize(BM_BVHANDLE h,
406 int opt_mode,
407 struct BM_bvector_statistics* pstat);
408
409 /* freeze bit-vector into read-only mode. bit-vector becomes immutable.
410 */
411 BM_API_EXPORT int BM_bvector_freeze(BM_BVHANDLE h);
412
413 /* Check if bit-vector is read-only.
414 bit-vector becomes read-only after BM_bvector_freeze()
415 */
416 BM_API_EXPORT int BM_bvector_is_ro(BM_BVHANDLE h, int* pval);
417
418
419 /* Perform calculate bit vector statistics
420 pstat - bit vector statistics
421 */
422 BM_API_EXPORT
423 int BM_bvector_calc_stat(BM_BVHANDLE h,
424 struct BM_bvector_statistics* pstat);
425
426 /* perform logical operation on two bit vectors
427 hdst = hdst {OR/AND/XOR/SUB} hsrc
428 opcode - operation code
429 AND - 0
430 OR - 1
431 SUB - 2
432 XOR - 3
433 */
434 BM_API_EXPORT int BM_bvector_combine_operation(BM_BVHANDLE hdst, BM_BVHANDLE hsrc, int opcode);
435
436 /* perform logical AND operation on two bit vectors
437 hdst = hdst AND hsrc
438 */
439 BM_API_EXPORT int BM_bvector_combine_AND(BM_BVHANDLE hdst, BM_BVHANDLE hsrc);
440
441 /* perform 3-operand logical AND (set intersect) on two source bit vectors
442 hdst = hsrc1 AND hsrc2
443 compress - 0 (do not compress, 1 - compress)
444 */
445 BM_API_EXPORT int BM_bvector_combine_AND_2sc(BM_BVHANDLE hdst, BM_BVHANDLE hsrc1, BM_BVHANDLE hsrc2, int compress);
446
447 /* perform logical OR operation on two bit vectors
448 hdst = hdst OR hsrc
449 */
450 BM_API_EXPORT int BM_bvector_combine_OR(BM_BVHANDLE hdst, BM_BVHANDLE hsrc);
451
452 /* perform 3-operand logical OR (set union) on two source bit vectors
453 hdst = hsrc1 AND hsrc2
454 compress - 0 (do not compress, 1 - compress)
455 */
456 BM_API_EXPORT int BM_bvector_combine_OR_2sc(BM_BVHANDLE hdst, BM_BVHANDLE hsrc1, BM_BVHANDLE hsrc2, int compress);
457
458 /* perform logical SUB operation on two bit vectors
459 hdst = hdst SUB hsrc
460 */
461 BM_API_EXPORT int BM_bvector_combine_SUB(BM_BVHANDLE hdst, BM_BVHANDLE hsrc);
462
463 /* perform 3-operand logical AND NOT (set subtraction) between two source bit vectors
464 hdst = hsrc1 SUB hsrc2
465 compress - 0 (do not compress, 1 - compress)
466 */
467 BM_API_EXPORT int BM_bvector_combine_SUB_2sc(BM_BVHANDLE hdst, BM_BVHANDLE hsrc1, BM_BVHANDLE hsrc2, int compress);
468
469 /* perform logical XOR operation on two bit vectors
470 hdst = hdst XOR hsrc
471 */
472 BM_API_EXPORT int BM_bvector_combine_XOR(BM_BVHANDLE hdst, BM_BVHANDLE hsrc);
473
474 /* perform 3-operand logical XOR (exclusive OR) between two source bit vectors
475 hdst = hsrc1 XOR hsrc2
476 compress - 0 (do not compress, 1 - compress)
477 */
478 BM_API_EXPORT int BM_bvector_combine_XOR_2sc(BM_BVHANDLE hdst, BM_BVHANDLE hsrc1, BM_BVHANDLE hsrc2, int compress);
479
480
481 /* perform logical OR operation on two bit vectors
482 hdst = hdst OR hsrc
483 merge operation is faster than just OR, but it destroys the
484 source vector (by borrowing its memory)
485 */
486 BM_API_EXPORT int BM_bvector_merge(BM_BVHANDLE hdst, BM_BVHANDLE hsrc);
487
488
489 /* Logical shift right by 1
490 */
491 BM_API_EXPORT int BM_bvector_rshift1(BM_BVHANDLE hdst);
492
493 /* -------------------------------------------- */
494 /* bvector operations with arrays */
495 /* -------------------------------------------- */
496
497
498 /* perform logical OR operation over bit vector and an array
499 hdst - destination bit vector handle
500 arr_begin - array start
501 arr_end - array end (defined as start + size)
502 */
503 BM_API_EXPORT
504 int BM_bvector_combine_OR_arr(BM_BVHANDLE hdst,
505 const unsigned int* arr_begin,
506 const unsigned int* arr_end);
507
508 /* perform logical XOR operation over bit vector and an array
509 hdst - destination bit vector handle
510 arr_begin - array start
511 arr_end - array end (defined as start + size)
512 */
513 BM_API_EXPORT
514 int BM_bvector_combine_XOR_arr(BM_BVHANDLE hdst,
515 const unsigned int* arr_begin,
516 const unsigned int* arr_end);
517
518
519 /* perform logical SUB(MINUS) operation over bit vector and an array
520 hdst - destination bit vector handle
521 arr_begin - array start
522 arr_end - array end (defined as start + size)
523 */
524 BM_API_EXPORT
525 int BM_bvector_combine_SUB_arr(BM_BVHANDLE hdst,
526 const unsigned int* arr_begin,
527 const unsigned int* arr_end);
528
529
530 /* perform logical AND operation over bit vector and an array
531 hdst - destination bit vector handle
532 arr_begin - array start
533 arr_end - array end (defined as start + size)
534 */
535 BM_API_EXPORT
536 int BM_bvector_combine_AND_arr(BM_BVHANDLE hdst,
537 const unsigned int* arr_begin,
538 const unsigned int* arr_end);
539
540 /* perform logical AND operation over bit vector and a sorted array
541 sort order has to ascending
542 hdst - destination bit vector handle
543 arr_begin - array start
544 arr_end - array end (defined as start + size)
545 */
546 BM_API_EXPORT
547 int BM_bvector_combine_AND_arr_sorted(BM_BVHANDLE hdst,
548 const unsigned int* arr_begin,
549 const unsigned int* arr_end);
550
551
552 /* -------------------------------------------- */
553 /* bvector traversal/enumerator */
554 /* -------------------------------------------- */
555
556 /* construct bvector enumerator for ON bit index traversal
557 (starting from first ON bit)
558 h - handle of source bvector
559 peh - pointer on enumerator to be created
560 */
561 BM_API_EXPORT int BM_bvector_enumerator_construct(BM_BVHANDLE h, BM_BVEHANDLE* peh);
562
563 /* construct bvector enumerator for ON bit index traversal
564 starting from position
565 h - handle of source bvector
566 peh - pointer on enumerator to be created
567 pos - start position, if 0 - it starts from the first available bit
568 */
569 BM_API_EXPORT
570 int BM_bvector_enumerator_construct_from(BM_BVHANDLE h,
571 BM_BVEHANDLE* peh,
572 unsigned int pos);
573
574
575 /* destroy bvector enumerator handle */
576 BM_API_EXPORT int BM_bvector_enumerator_free(BM_BVEHANDLE eh);
577
578 /* Check if enumerator is valid or reached the end of traversal
579 pvalid - returns 0 if enumerator is no longer valid
580 (empty vector or end of traversal)
581 */
582 BM_API_EXPORT int BM_bvector_enumerator_is_valid(BM_BVEHANDLE eh, int* pvalid);
583
584 /* Return current enumerator value (traversal position)
585 pvalue - returns bit traversal position
586 */
587 BM_API_EXPORT int BM_bvector_enumerator_get_value(BM_BVEHANDLE eh, unsigned int* pvalue);
588
589 /* Advance enumerator to next traversal position.
590 pvalid - (optional) returns 0 if traversal ended
591 pvalue - (optional) current value
592 */
593 BM_API_EXPORT
594 int BM_bvector_enumerator_next(BM_BVEHANDLE eh,
595 int* pvalid, unsigned int* pvalue);
596
597
598 /* Advance enumerator to the specieid traversal position.
599 If bit-vector position is not 1 it will automatically go to the next available
600 1 bit.
601 pos - requested position
602 pvalid - (optional) returns 0 if traversal ended
603 pvalue - (optional) current value
604 */
605 BM_API_EXPORT
606 int BM_bvector_enumerator_goto(BM_BVEHANDLE eh, unsigned int pos,
607 int* pvalid, unsigned int* pvalue);
608
609
610 /* -------------------------------------------- */
611 /* bvector serialization */
612 /* -------------------------------------------- */
613
614 /* serialize bit vector
615 buf - buffer pointer
616 (should be allocated using BM_bvector_statistics.max_serialize_mem)
617 buf_size - size of the buffer in bytes
618 pblob_size - size of the serialized BLOB
619 */
620 BM_API_EXPORT
621 int BM_bvector_serialize(BM_BVHANDLE h,
622 char* buf,
623 size_t buf_size,
624 size_t* pblob_size);
625
626 /* deserialize bit vector
627 buf - buffer pointer
628 (should be allocated using BM_bvector_statistics.max_serialize_mem)
629 buf_size - size of the buffer in bytes
630 */
631 BM_API_EXPORT
632 int BM_bvector_deserialize(BM_BVHANDLE h,
633 const char* buf,
634 size_t buf_size);
635
636
637 /* -------------------------------------------- */
638 /* bvector algorithms */
639 /* -------------------------------------------- */
640
641 /* compute population count of AND of two const bit vectors
642 pcount - bit count of AND of two vectors
643 */
644 BM_API_EXPORT int BM_bvector_count_AND(BM_BVHANDLE h1, BM_BVHANDLE h2, unsigned int* pcount);
645
646 /* return true if AND operation of two vectors produce any result
647 (this is faster than count_AND)
648 pany - non-zero if any bits were found
649 */
650 BM_API_EXPORT int BM_bvector_any_AND(BM_BVHANDLE h1, BM_BVHANDLE h2, unsigned int* pany);
651
652 /* compute population count of XOR of two const bit vectors
653 pcount - bit count of XOR of two vectors
654 */
655 BM_API_EXPORT int BM_bvector_count_XOR(BM_BVHANDLE h1, BM_BVHANDLE h2, unsigned int* pcount);
656
657 /* return true if XOR operation of two vectors produce any result
658 (this is faster than count_XOR)
659 pany - non-zero if any bits were found
660 */
661 BM_API_EXPORT int BM_bvector_any_XOR(BM_BVHANDLE h1, BM_BVHANDLE h2, unsigned int* pany);
662
663 /* compute population count of SUB of two const bit vectors
664 pcount - bit count of SUB of two vectors
665 */
666 BM_API_EXPORT int BM_bvector_count_SUB(BM_BVHANDLE h1, BM_BVHANDLE h2, unsigned int* pcount);
667
668 /* return true if SUB operation of two vectors produce any result
669 (this is faster than count_SUB)
670 pany - non-zero if any bits were found
671 */
672 BM_API_EXPORT int BM_bvector_any_SUB(BM_BVHANDLE h1, BM_BVHANDLE h2, unsigned int* pany);
673
674 /* compute population count of OR of two const bit vectors
675 pcount - bit count of OR of two vectors
676 */
677 BM_API_EXPORT int BM_bvector_count_OR(BM_BVHANDLE h1, BM_BVHANDLE h2, unsigned int* pcount);
678
679 /* return true if SUB operation of two vectors produce any result
680 (this is faster than count_SUB)
681 pany - non-zero if any bits were found
682 */
683 BM_API_EXPORT int BM_bvector_any_OR(BM_BVHANDLE h1, BM_BVHANDLE h2, unsigned int* pany);
684
685
686 #ifdef __cplusplus
687 }
688 #endif
689
690 #endif