user0002128
user0002128

Reputation: 2921

High performance library for bit-wise operations?

Dealing with very large bool data set, try to use bit-wise operation to handle it, looking for some library that dealing with bit-set that can:

  1. Dynamic set, and can be passed by pointers or references.
  2. Read and write bitwisely.
  3. Count set bits and fast.

Obviously std::bitset's functionalities are too limited for that, any recommendations?

Upvotes: 11

Views: 1963

Answers (2)

deltheil
deltheil

Reputation: 16121

The BitMagic library might be your friend too.

Upvotes: 2

Doug Currie
Doug Currie

Reputation: 41170

GMP provides low level bit functions on arbitrarily sized natural numbers. These are "low-level GMP functions, used to implement the high-level GMP functions, but also intended for time-critical user code."

These include mpn_popcount to count 1 bits, and mpn_copyi to extract sub-sequences.

Upvotes: 11

Related Questions