LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Logical shift negative numbers


memoryleak wrote:

I don't see  an arithmetic shift function in Labview, but you could build one by converting the number to an array of booleans and shifting to your heart's content.


 

Well, the "Scale by power of 2" function does an arithmetic shift for signed integers and a bitwise shift for unsigned integers.

 

What more do you want? 😄

 

(Shifting instead of dividing is usually done for performance reason, thus going through a boolean array seems quite silly. ;))

Message Edited by altenbach on 10-09-2009 10:26 AM
Message 11 of 13
(928 Views)

Bah!  I forgot that  -1*2^(-1) would round back to -1 for integers 😞

 

I guess I'm banished back to arithmetic now 😉

Message Edited by memoryleak on 10-09-2009 12:35 PM
0 Kudos
Message 12 of 13
(922 Views)

Scale by power of two is the name of LabVIEW's arithmetic shift. I supposed an arithmetic shift function could be added to the data manipulation palette for clarity but it would do the exact same thing as the Scale by power of two.

Michael Bilyk
Former NI Software Engineer (IT)
0 Kudos
Message 13 of 13
(500 Views)