LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Type conversion and inplaceness ?

Hi all,

I've been wondering for a long time if type conversion was inplace Smiley Surprised
In the example below, is there any case were inplaceness will happen ?



My feeling is that :
 - no inplaceness when there is a conversion dot,
 - when converting to a representation with a larger bit depth, I believe inplaceness is not possible,
 - when converting to a representation with the same bit depth, I believe inplaceness is possible,
 - when converting to a representation with a smaller bit depth, I believe inplaceness is not possible.

Is that correct (speaking in LV 7.1.1) ?
What if put the same code in a LV 8.5 inplace structure ?


Message Edité par TiTou le 08-17-2007 10:37 AM


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 1 of 7
(3,897 Views)
Hi TiTou,

I would think the same as you already noted:
inplaceness is only possible when the bit-length is the same (think about arrays of numbers!).
But "possible" doesn't mean it is "done" inplace... And it is still up to LV to get a proper algorithm to do the conversion "inplace".
I haven't tested the LV8.5 until now, but I think the inplace-struture only works when the datatype isn't changed inside!

Message Edited by GerdW on 08-17-2007 01:05 PM

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 7
(3,878 Views)
Cross posted to LAVA Forum



We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 3 of 7
(3,863 Views)
If you look at the integer conversions of same bit size (I32->U32 for example), the conversion (or coercion) acts more like a typecast and the operation is "in place". In all other cases, a data copy is made.
 
For example, if you have an I32 value of -20, you might think that a conversion to U32 should result in 0. However, you'll get 4294967276 instead. There is NO buffer allocation.
 
However, if you insert a toSGL before the toU32, you get the expected result of 0, but you have two buffer allocations even though we're staying with 32 bits all the way and buffer re-use should be possible in principle.
 
As a rule of thumb, a conversion (or coercion) always forces a data copy. There is however an exception for integers as long as the bit size remains constant.
 
Maybe somebody from NI can shed more light on this because the help for e.g. toU32 does not go into any such details at all while all this would seem like useful information.
 
 

Message Edited by altenbach on 08-17-2007 06:07 AM

Message Edited by altenbach on 08-17-2007 06:11 AM

Message 4 of 7
(3,853 Views)

What version is your example Christian?

I just did the same experiment (I32 > U32) in LV 7.1 and got dots.

Ben

Message Edited by Ben on 08-17-2007 08:08 AM

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 7
(3,847 Views)

This is in 8.2.1.

If you convert -20 to U32, do you get 0 or 4294967276 ? Just curious.

Message Edited by altenbach on 08-17-2007 06:15 AM

0 Kudos
Message 6 of 7
(3,841 Views)
So this tends to mean that the inplace algorythm has improved !

Smart test Christian ! Smiley Wink

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 7 of 7
(3,834 Views)