Questions tagged [bitset]

A collection of bits organized as an array of bits, in which each bit can be accessed separately. For C++ bitsets, prefer the tag std-bitset

A collection of bits organized as an array of bits, in which each bit can be accessed separately.

Usage guidelines:

Related tags, with slighly differences:

751 questions
0
votes
1 answer

Java- Mapping multi-dimensional arrays to single

I am posting this in relation to another open question i have, however I thought that this deserved it's own question. Alternate question (for reference): Java Proxy Discovering Bot Basically, I need to store a very large amount of data and have it…
Colby
  • 452
  • 4
  • 19
0
votes
2 answers

C++: bitset doesn't work properly

I need a std::bitset<64> for my project. But while printing the number something goes wrong: unsigned long long var = 18446462598732906495ULL; std::cout << std::bitset<64>(var) << std::endl; it…
user4637731
0
votes
2 answers

How to handle BitSet type table with the BitSet methods?

I have to create a table with two type BitSet dimensions (9x9). I fulfills this table with bit values 1 to 9. I wish to withdraw a value of a particular case (exemple 5), but .set method (int, boolean) modifies all the boxes in my chart. how to do…
0
votes
2 answers

How to store a set of values in Grails?

In one of my domain classes I need to store a set of symbols chosen from a finite set. In my case it's a choice of one or more weekdays, say Monday plus Tuesday. Generally speaking I would approach this problem with a bitset (bit 0 = Monday, bit 1 =…
Tobia
  • 17,856
  • 6
  • 74
  • 93
0
votes
1 answer

Convert Array of Bitset to vector

I have set of zeroes and ones as my input like below, I need to do some pairwise Boolean operation (and, or, Xor, not) between them (consider each line as). 111100000000 101100000010 111011100000 111100000001 001100010001 The code for reading and…
Am1rr3zA
  • 7,115
  • 18
  • 83
  • 125
0
votes
5 answers

instantiating bitset using hex character

Hey, I'm trying to figure out how to instantiate a 4 bit bitset based on a hex character. For instance, If I have a character with value 'F', I want to create a bitset of size 4 initialized to 1111 or if it is A, i want to initialize it to 1010. I…
user338948
  • 1
  • 1
  • 1
0
votes
1 answer

Find an integer not present in given 4 billion integers

I came across this question in cracking the coding interview book. Question: Given an input file with four billion non-negative integers, provide an algorithm to generate an integer which is not contained in the file. Assume you have 1 GB of…
Walt
  • 1,426
  • 2
  • 17
  • 30
0
votes
1 answer

bitset to dynamic bitset

I have a function where i use bitset.Now i need to convert it to a dynamic bitset.. but i don't know how. Can somebody help me ? set generateCandidates(set ck,unsigned int k){ set nk ; for (set::const_iterator p =…
mr.bio
  • 1,646
  • 4
  • 19
  • 27
0
votes
1 answer

Reading individual hex values line by line in c++

I am trying to read a text file filled with individual hex values formatted like this: 0c 10 00 04 20 00 09 1a 00 20 What I would like is to read them in, convert to binary, then store in a vector. I would like my print statement to output like…
David
  • 501
  • 3
  • 10
  • 30
0
votes
1 answer

Use std::bitset to produce binary file

I am using std::bitset to give me a binary representation of a number. I now want to use this and output to std::cout using only the binary representation - I do not want the ASCII representation of std::bitset - I merely want to output my bitset as…
Zambezi
  • 767
  • 1
  • 9
  • 19
0
votes
2 answers

Segmentation fault while checking size of bitset

I get a segmentation fault when I try to run the code below. I've tried commenting out bits of the code, and found that the while loop with the condition j < is_prime.size() is the culprit. This is puzzling to me because I perform the same check…
castle-bravo
  • 1,389
  • 15
  • 34
0
votes
2 answers

Serialize Lucene's OpenBitSet 4.9.0 using Java

Using Lucene's OpenBitSet 4.9.0, I would like to serialize an object instance of the OpenBitSet-class. As the OpenBitSet class does not implement Serializable, I made my own class which extends OpenBitSet: public class MyBitSet extends OpenBitSet…
Neman
  • 1,237
  • 2
  • 13
  • 16
0
votes
2 answers

How to set values in a bitset according to a array of floating point values conditions?

I have an array of floating point values. The array is converted to binary value array on the basis of a threshold value. e.g A = 0.3,1.3,4.4,6.4; if threshold = 4 A = 0, 0, 1, 1; Now, I want to convert it to bitset. Is there an easy way to do it. I…
user3234277
  • 63
  • 1
  • 5
0
votes
1 answer

Unresolved constructor for bitset

typedef unsigned long int uint32; uint32 c = uint32(-1) - 5; std::bitset<32> y(uint32(c)); This code yields: FeatureTest.obj : error LNK2019: unresolved external symbol "class std::bitset<32> __cdecl y(unsigned long)" …
Yola
  • 18,496
  • 11
  • 65
  • 106
0
votes
0 answers

Bit stream buffering for FIFO

My application receives a 32-bit word from hardware. The first byte signifies the data type, the remaining 3 bytes are the data (24 hard decision bits) The application is required to buffer the data bits until a sufficient number is available for…
user3542787
  • 31
  • 1
  • 4