Lucene++ - a full-featured, c++ search engine
API Documentation


 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
BitUtil.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2011 Alan Wright. All rights reserved.
3 // Distributable under the terms of either the Apache License (Version 2.0)
4 // or the GNU Lesser General Public License.
6 
7 #ifndef BITUTIL_H
8 #define BITUTIL_H
9 
10 #include "LuceneObject.h"
11 
12 namespace Lucene
13 {
15  class LPPAPI BitUtil : public LuceneObject
16  {
17  public:
18  virtual ~BitUtil();
20 
21  public:
23  static const uint8_t ntzTable[];
24 
25  public:
27  static int32_t pop(int64_t x);
28 
30  static int64_t pop_array(const int64_t* A, int32_t wordOffset, int32_t numWords);
31 
33  static int64_t pop_intersect(const int64_t* A, const int64_t* B, int32_t wordOffset, int32_t numWords);
34 
36  static int64_t pop_union(const int64_t* A, const int64_t* B, int32_t wordOffset, int32_t numWords);
37 
39  static int64_t pop_andnot(const int64_t* A, const int64_t* B, int32_t wordOffset, int32_t numWords);
40 
42  static int64_t pop_xor(const int64_t* A, const int64_t* B, int32_t wordOffset, int32_t numWords);
43 
45  static int32_t ntz(int64_t val);
46 
48  static int32_t ntz(int32_t val);
49 
52  static int32_t ntz2(int64_t x);
53 
56  static int32_t ntz3(int64_t x);
57 
59  static bool isPowerOfTwo(int32_t v);
60 
62  static bool isPowerOfTwo(int64_t v);
63 
65  static int32_t nextHighestPowerOfTwo(int32_t v);
66 
68  static int64_t nextHighestPowerOfTwo(int64_t v);
69 
70  protected:
71  inline static void CSA(int64_t& h, int64_t& l, int64_t a, int64_t b, int64_t c);
72  };
73 }
74 
75 #endif

clucene.sourceforge.net