10-07-2009 10:25 PM
Can I use join/split function (in Data Manipulation) for intergers? Help shows it takes two unsigned numbers and returns one joined unsigned number. Like U16 and U16-> U32. What if I want I16 and I16 -> I32? Can I use the name function?
10-07-2009 10:32 PM
10-07-2009 10:32 PM - edited 10-07-2009 10:33 PM
Yes.
Just right click the input constant/control and select from "Representation", the desired one.
[Edit: Aarghhh Mark beat me by a couple of seconds..... ]
10-07-2009 10:56 PM - edited 10-07-2009 10:57 PM
While you can do it, the result doesn't make much sense to me. A signed value will have the most significant bit set to 1. Joining numbers simply copies/shifts bits. Thus, for signed numbers this operation doesn't give you a result that is equivalent to joining unsigned numbers. Take the following example in joining two 8-bit signed integers:
Note that the joined number has the bits copied in the same way that unsigned numbers would have. But what does it mean? Should bit 8 of the joined number remain a 1? It was a 1 in "Numeric 2" only because the value was negative.
Now, what about the reverse case when you want to split an I16 that happens to be negative? Should both I8 values be set to 1 for their most significant bit?
At the very least you would have to handle sign expansion.