12-11-2006 10:33 AM
12-11-2006 10:48 AM
Tim,
Not sure why you are converting to strings - but that is a huge resource hog. If you need to see certain bits, the most efficient way to di it is using bit masks to 0 the bits you are not interested in and then us shift operations to convert to a number if you need to.
An example would be if bits 3-5 represented a uint between 0-7, you would logical AND the16 bit word with 0000000000111000 binary. Then use a logical shift to move bits 3-5 to bit positions 0-2.
Bitwise operations like these are very fast because they are done at the register level
Bill F
12-11-2006
12:03 PM
- last edited on
05-05-2025
10:20 AM
by
Content Cleaner
If you are interested in a 2d array of booleans, you could typecast the U16 into an array of booleans (make you sure you have 4.x conversion) right click on the type cast
A little background:
In LV 4.x and earlier an array of booleans were bit-wise in memory, each bit was one element.
After that they changed it to bytewise, each byte is one element.
Depending on you purpose this might be faster.
Another way might be AND-ing like Bill said, then do a conversion into U8. And then typecast it into an array of booleans (NOT 4.x style0) this works on one bit, because false is declared 0, and true non-zero.
Ton
See here
12-11-2006
03:01 PM
- last edited on
05-05-2025
10:20 AM
by
Content Cleaner
The very first LV Challenge was the "Bit Twidler". See here.
http://zone.ni.com/devzone/cda/tut/p/id/5307
There was plenty to learn in that challenge!
Ben