c# - Read/Write compressed binary data -


I read everywhere, people talk about compressing objects on a small scale on some scale. "Things like the first three bits are such and in this case, the next two represent this and twelve bits for it"

I understand why it would be desirable to reduce memory usage, but I I can not think of a good idea how to implement it I know that I will pack it in one or more integers (or taller, whatever), but I can not imagine an easy way to work with it. Ta. It would be great if there is a class where I can get an arbitrary bit of arbitrary binary field, and it will take care of things for me, and I will not have to miss it about it

to:

Bitair Class

manages the compact array of bit values, which is represented as a boolean, where true is indicating that the bit (1) is on And that false signal bit is off (0).

Example:

  BitArray myBitArray = new BitArray (5); MyBitArray [3] = True; // set bit offset 3 to 1  

BitArray allows you to set individual bits only, though. If you want to infer values ​​with more bits, then probably & amp; 'S and there is no way around to roam with masks and accessories: -)


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -