LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Marc Blumentritt

New functions "Booleans to Nummber" and "Number to Booleans"

Status: Declined

Any idea that has received less than 5 kudos within 5 years after posting will be automatically declined.

If I want to convert several Booleans to the corresponding (binary) Number, I have to built an array and use the function "Boolean Array to Number". Why not create a funtion, which excepts several booleans (number of inputs can be changed like "Compound Arithmetic", starting with LSB) and gives back the corresponding number.

 

And while you are at it, you can create a "reverse" function, which has a number as input and gives back the bits as booleans (several outputs starting with LSB, which can be changed like "Compound Arithmetic").

CLD
3 Comments
David_L
Active Participant
Sounds like it would be way more work to implement a built in function than it would save from just using Build array connected to Boolean Array to Number.  If it were a multi-step procedure, then i'd say maybe but the existing implementation is just way to simple to be worth it.
Marc Blumentritt
Member

Of course it is "just" the replacement for two functions, but consider this:

You want to connvert 8 booleans to a number (by the way, it would be nice, if I could define the output data type, at least choosing between U8, U16, U32 and U64), therefore you have to build an array with 8 inputs. I d'ont know, how booleans are handled inside of LabVIEW, but I guess U8 is used. Than you convert these 8 U8 to one U32. In the end the intermediate step uses more memory then the result you want to have. If you do this alot, which is quite possible if you have to do some serious byte crunching (e.g. some communication protocolls), you are wasting memory and crunching time.

CLD
Darren
Proven Zealot
Status changed to: Declined

Any idea that has received less than 5 kudos within 5 years after posting will be automatically declined.