bitset Questions

10

Solved

I am making a analytics system, the API call would provide a Unique User ID, but it's not in sequence and too sparse. I need to give each Unique User ID an auto increment id to mark a analytics da...
Fumigant asked 5/12, 2011 at 10:38

6

Solved

For example, I have the integer a = 10; and it's binary representation (for a 32 bit integer) is 00000000000000000000000000001010 and reversed, it becomes 01010000000000000000000000000000 ...
Outfall asked 1/2, 2018 at 6:23

2

Solved

In c++. I initialize a bitset to -3 like: std::bitset<32> mybit(-3); Is there a grace way that convert mybit to -3. Beacause bitset object only have methods like to_ulong and to_string.
Julie asked 25/10, 2013 at 7:29

2

I'm working on something that requires me to get access to specific bits and ranges of bits. I decided to use bitset because it is easy to get access to specific bits; how can I extract a range (su...
Terraterrace asked 1/2, 2010 at 14:8

7

Solved

If I have an integer that I'd like to perform bit manipulation on, how can I load it into a java.util.BitSet? How can I convert it back to an int or long? I'm not so concerned about the size of the...
Ferri asked 18/3, 2010 at 21:56

3

Solved

I have a bitset which i am using to track whether an item is present or not example b = 01100110000 it represents that 2nd and 3rd items are present and 1st and 4th item are not present. While sear...
Residentiary asked 28/6, 2022 at 13:5

5

Solved

Is there a Python class or module that implements a structure that is similar to the BitSet?
Kommunarsk asked 15/10, 2010 at 20:59

3

Solved

I am looking for an efficient way how to easily convert a BitSet to a binary string. Let us say that its usual length would be thousands of bits. For example, lets have this: BitSet bits = new BitS...
Cockspur asked 12/1, 2016 at 15:48

9

Solved

What is the most optimized way to implement a < operator for std::bitset corresponding to the comparison of the unsigned integer representation (it should work for bitsets of more than 64 bits) ...
Ogive asked 20/1, 2014 at 22:6

6

I'm looking for a fast algorithm with gives me all the indexes of the set bits in a BitSet object. This is slow: BitSet bitSet = ... Collection<Integer> indexes = new ArrayList<Integer&g...
Uvarovite asked 13/3, 2013 at 16:7

7

Is there a way of iterating over a (possibly huge) std::bitset that is linear in the number of bits that are set to true? I want to prevent having to check every single position in the bitset. The ...
Terry asked 17/1, 2011 at 0:55

2

I have a very large string ( 64 characters) containing 1s and 0s. sample - 1001111111101010011101101011100101001010111000101111011110001000 All I want is to convert it into BitSet var containing t...
Lightning asked 28/10, 2015 at 5:7

7

Solved

How to write bitset data to a file? The first answer doesn't answer the question correctly, since it takes 8 times more space than it should. How would you do it ? I really need it to save a lot ...
Perihelion asked 12/1, 2011 at 8:0

7

Solved

I want to make a bitset in C++. I did a bit of research. All examples I found where like this: bitset<6> myBitset; // do something with it But I don't know the size of the bitset when I de...
Horrorstruck asked 28/6, 2010 at 17:37

7

Solved

I'm looking for a good Java BitSet example to work with 0 and 1s. I tried looking at the Javadocs but I don't understand the usage of the class by just reading that. For instance, how would the and...
Adan asked 17/2, 2012 at 18:45

3

Solved

Working with JPA, I would like to be able to save a BitSet to the DB and pull it back of course. Suppose I have: @Entity @Table(name = "myTable") public class MyClass { @Id @GeneratedValue(str...
Samellasameness asked 12/9, 2012 at 14:7

4

Is it possible to use SSE instructions on the underlying data of a std::bitset? The bitsets I am working with are larger than unsigned long, so the to_ulong() method will not suffice. For instance,...
Inane asked 7/6, 2013 at 18:41

2

Solved

Is there an efficient way to calculate a bitwise sum of uint8_t buffers (assume number of buffers are <= 255, so that we can make the sum uint8)? Basically I want to know how many bits are set a...
Offence asked 7/10, 2021 at 15:53

5

Solved

I searched around and could not find the performance time specifications for bitset::count(). Does anybody know what it is (O(n) or better) and where to find it? EDIT By STL I refer only to the St...
Maculation asked 14/1, 2011 at 17:3

4

Solved

In my program I need to check if I have already generated a value in a set of 2.5*10^9. I expect to generate about the half of the set and need to have a fast way to check and update it. The bitset...
Tungstate asked 25/4, 2011 at 15:44

9

Solved

I'm working with java. I have a byte array (8 bits in each position of the array) and what I need to do is to put together 2 of the values of the array and get a value. I'll try to explain mysel...
Roche asked 3/6, 2009 at 19:14

5

Solved

I am trying to create a map in C++ with bitset as a key. However the compiler generates the following error messages In file included from /usr/include/c++/4.6/string:50:0, from /usr/include/c++/...
Aciculate asked 14/3, 2012 at 12:50

4

Solved

What are pros/cons of usage bitsets over enum flags? namespace Flag { enum State { Read = 1 << 0, Write = 1 << 1, Binary = 1 << 2, }; } namespace Plain { enum State { Rea...
Florenceflorencia asked 7/8, 2017 at 7:45

2

Solved

I have bitset<8> v8 and its value is something like "11001101", how can I convert it to char? I need a single letter. Like letter "f"=01100110. P.S. Thanks for help. I needed this to illustrate...
Oceanid asked 17/6, 2012 at 1:10

3

Solved

When I use, std::bitset<5> op1 (std::string("01001")); std::bitset<5> op2 (std::string("10011")); std::cout << (op1|=op2) << std::endl; everything is fine obviously....
Adult asked 22/6, 2014 at 6:37

© 2022 - 2025 — McMap. All rights reserved.