× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I need to change a data  into variable length bits, then translate these
bits to a number.  As an example. I start reading the bits, and if I
read  00110101 then I translate it to the number 0.  If I read 000111 I
translate it to 1,  0111 translates to 2, 1000 goes to 3, 10011 is 8,
..... 0100111 translates to 18.   There is about 100 of these codes.  My
concern is speed, since I have to translate up to 30k of these 100
codes, if I take too many steps doing this, or if I am not efficient
then it can easily eat up the CPU.  The table needs to be from 2 bits to
12 bits.  I currently see no easy way of doing this, efficiently.   But
I know there are a lot smarter people than me on this list.  Any
suggestions?

Example.  00110101000111011110001011000000000001 would translate to
0,1,2,3,4,999.

Next,
I need to take the translated number and turn on bits.  If I get
1,2,3,4, then I would create
1111111111.  Which the 1 produces 1 bit, 2 would produce 11, 3 would
produce 111, and 4 would produce 1111.  With these number I could turn
bits on or off.  1,-2,3,-4 would be 1001110000.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.