05-25-2023 11:53 AM
@DailyDose wrote:
But this will produce 8 boolean, yes? Which later you must then dig out only the 6.
"Number to boolean array" will also produce 8 booleans for an U8 input. Just because you don't index them out is irrelevant. The cluster size is set to six, so that's fine.
05-25-2023 12:32 PM - edited 05-25-2023 12:35 PM
@BertMcMahan wrote:
Pre-generating a lookup table array seems to beat Solution B (as-posted) by about 2x:
.
Careful there! If you use a 6 bit LUT, the index needs to be masked to 6 bits because in the current example the indices can be any 8 bit value.
Of course in the real application this might not be needed, assuming the number is guaranteed not to exceed 6 bits (0..63).
Note that the LUT generation is "constant folded", i.e. replaced by an array constant in the compiled code)
05-25-2023 12:40 PM
@mcduff wrote:
@DailyDose wrote:
But this will produce 8 boolean, yes? Which later you must then dig out only the 6.
Don't understand the question. Your VI used only 6 booleans, if you want all 8 right click and change the array to cluster size. (This picks out the first 6 booleans in the array.) The main limitation is that you can't specify just the middle booleans, only from beginning to end.
No, that's my bad. I.... A) Didn't know you could do that. And B) Didn't see the comment. My apologies.
05-25-2023 01:22 PM
Looks like the LUT method is leading by a significant margin (and I'm even giving the LUT a handicap by building it each time). Props to @MertMcMahan and @altenbach
05-25-2023 02:15 PM
@DailyDose wrote:
(and I'm even giving the LUT a handicap by building it each time).
Make sure you turn off debugging and the LUT generation will be constant folded, i.e calculated once at compile time.. No penalty.