I am trying to generate a 512bit pattern where the word 0xdeadbeef keeps rotating (shifted left by one) across the 512bits, each time I want to right the data to memory.
Baiscally, 0xffffffff.......deadbeefffffffff (512 bits total). Keep shifting the deadbeef part by one and after each time write the whole pattern to memory.
Is bitset the correct container in this case? I was able to use all the needed operations (<< ^ ...etc) but I can't find a way to translate the 512bit data into 64bit long long variables to write to memory.
Bitset is not really a container, it's a representation class. Iternally it may represented by array or list of bool. Only way to export its content to array is to do it manually. It's arguably more effective to do aforementioned shifting without bitset, provided that all you need is the actual offset, which gives you address of pattern, rest of bits would be defaulted to 1.
Question is, how endianness should be handled in your application: does positiob of pattern represent lsb-msb sequence within each word, or it should be byte-wise aligned.
User contributions licensed under CC BY-SA 3.0