‎03-24-2009 01:50 PM
ds_1 wrote:Hi altenbach,
Thanks for the suggestions, the data can be either 12,14,16,18 24 or 30 bit so the lookup table may get a little complicated to implement, particulatrly in the case of the 30bit where it is a middle 7 bits only that i need to reverse, but I think I may need to try it out!
For the 30 bits, you would represent your data as U32. To reverse the inner 7 bits, you can split/join it while processing an 8bit part via a lookup table. Do the 7 bits cross byte boundaries?
‎03-27-2009 05:13 AM
‎03-27-2009 05:40 AM
‎03-27-2009 06:10 AM
Hi ds_1
Boolean vales are stored as 8 bit or a byte. The reason for this is how the computer memory is organized. The smallest unit you can point to (or adress) in your computer memory is a byte. So all Booleans are stored as a byte. If you are interested in how Labview store data in memory you may take a look at this
http://zone.ni.com/reference/en-XX/help/371361A-01/lvconcepts/how_labview_stores_data_in_memory/
‎03-27-2009 11:47 AM
ds_1 wrote:
I assumed each 1 and 0 would take a single bit of memory, but from earlier in this post it appears each takes a byte? Or am I missing the point?
Historically, you are not completely wrong. Back in LabVIEW 4.x, arrays of booleans were stored as 8 elements/byte and certain functions (e.g. typecast) still have legacy modes to deal with 4.x flattened boolean array data, for example. 😉
In virtually all cases, you can do all you need purely in blue. Boolean operations perform bitwise on integers.
For some illustrative examples on how to avoid boolean arrays, have a look at the results of the bit twiddling challenge from many years ago (2002). The green solutions took up to 14 seconds while some blue solutions did the same work in under 100ms. (..and today's computers would probably be another 10x faster)