02-11-2025 11:46 AM
Subject says it all really. I'd like Join Numbers to be scalable, but it isn't. So, What's the easiest way to do this?
Solved! Go to Solution.
02-11-2025 12:12 PM
02-11-2025 12:15 PM
I was so close. Your method doesn't have the coercion dot! Thanks!
02-11-2025 12:25 PM
@rds2112 wrote:
I was so close. Your method doesn't have the coercion dot! Thanks!
I assume you just connected your High to the top hi input. It is just coercing the value to a U32. The upper bits of that should all be zeros if you are using a U16, so it should not matter in this case. If you are in a tight loop, the coerce maybe faster.
02-11-2025 12:30 PM
I was getting a lot of zeros where I didn't want them. Your method makes more sense for parsing while displayed in binary.
02-11-2025 07:54 PM - edited 02-12-2025 11:25 AM
@rds2112 wrote:
Subject says it all really. I'd like Join Numbers to be scalable, but it isn't. So, What's the easiest way to do this?
How should it be made scalable? there is no 24bit or 48bit integer type, for example.
You already got a good solution but for more complicated problems, e.g. parsing a 1D U8 array of [R,G,B,R,G,B,R,G,B] to a U32 array of [RGB, RGB, RGB] etc. is often needed.
An alternative is the good old typecast, of course. Becomes more practical if you want to join 8 U8 values into a U64, for example. Using a fallen Christmas tree of "join numbers" will get tedious!
(Just make sure to pad correctly if the input is short.)
Also be aware of the desired byte order of the result.
02-12-2025 02:06 PM
@altenbach wrote:
You already got a good solution but for more complicated problems, e.g. parsing a 1D U8 array of [R,G,B,R,G,B,R,G,B] to a U32 array of [RGB, RGB, RGB] etc. is often needed.
An alternative is the good old typecast, of course. Becomes more practical if you want to join 8 U8 values into a U64, for example. Using a fallen Christmas tree of "join numbers" will get tedious!
I admit the Christmas Tree can look messy, but it takes arrays and for your RGB array example seems better suited than typecast.
02-12-2025 04:02 PM
@mcduff wrote:
I admit the Christmas Tree can look messy, but it takes arrays and for your RGB array example seems better suited than typecast.
Ah, I never noticed that you can mix U8 and U16 when joining and there isn't even a coercion dot. 😮
(That seem like a can of worms....)
It would again get messy if you want to go from seven U8 to one U64, for example.