Tomi wrote:
Reversing a byte by using Look Up table.
Tomi,
I agree, a lookup table is always the way to go, even for 16 bits, assuming that you need to convert more often than the size of the lookup table. 😉
Typically, you would encapsulate this in a subVI and place the lookup table in an uninitialized shift register. Use a case connected to a "first call?" primitive so the lookup calculation is done only once (Since the lookup table is folded into a constant by the compiler anyway, the calculation for the lookup table will happen even before you run the VI so most likely there won't even be a penalty at the first call :)).
For some related examples, have a look at the code for my tic tac toe program posted at the following link:
Here I use a similar method to e.g. calculate the number of bits set in a given U16 integer (see U16BitsSet.vi) or find the unique transform of a position (UniqueTransformCached.vi).
For an 8bit table, you could just calculate it once and then place it as a diagram constant. It will only increase the size of the VI by ~256bytes... peanuts! 😉 Still, I prefer explicit code for the table generation, because it is easier to tell if there is a mathematical error.