Display bitmap as compressed ASCII string of set bits

  • Thread starter Thread starter davidpryce123
  • Start date Start date
D

davidpryce123

Dear Group.

For an application I am developing I need to display a 64 bit bitmap
as a compressed ascii string of bits. This is to allow for the
easier understanding of the bits for the users.

For example in the bitmap if bits, 1,2,3,4,5,6, 17,18,19 and 63 are
set they would like to display a string 1-6,17-19, 63.

Is there a easy way to do this in Csharp or do I need to roll my own?
Any suggestions on the best way to do this if I need to roll my own?

Thanks

David
 
For an application I am developing I need to display a 64 bit bitmap
as a compressed ascii string of bits. This is to allow for the
easier understanding of the bits for the users.

For example in the bitmap if bits, 1,2,3,4,5,6, 17,18,19 and 63 are
set they would like to display a string 1-6,17-19, 63.

Is there a easy way to do this in Csharp or do I need to roll my own?
Any suggestions on the best way to do this if I need to roll my own?

I don't know of anything built into the framework, but it shouldn't be
too hard.

I'd use a loop and keep track of your current "start" point while
you're going through bits which are set. When you encounter a bit
which *isn't* set, look at whether you've got one bit, two bits, or a
range. Whether you decide to represent two bits as x,y or x-y is a
choice to consider separately.

Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top