07-15-2009 04:20 PM
int16 x = 0x0;
int16 y = 0x0;
for (int8 i = 0; i < 16; i++)
{
result1 = 0x1 << i;
result2 = 0xff00 >> 8;
}
Any idea?
Thank you in advance.
Solved! Go to Solution.
07-15-2009 04:22 PM - edited 07-15-2009 04:23 PM
Numeric Palette >> Data Manipulation >>>> Logical Shift.
Or search the palette for "shift".
07-15-2009 04:27 PM
Thanks for the quick info, but I am not sure I understood the details on logical shift correctly.
According to description, it says "If y is less than 0, the function shifts x right y bits" and
this conflicts with my example, so how do you shift right if Y value is not less than 0?
Could you show me the labview example for my case?
Thank you in advance.
07-15-2009 04:36 PM
horanyee wrote:... so how do you shift right if Y value is not less than 0?
multiply y by -1 first. There is a primitive in the numeric palette called negate.
07-15-2009 04:44 PM - edited 07-15-2009 04:44 PM
Read the whole description.
"If y is greater than 0, the function shifts x left y bits (from least significant to most significant bit) and inserts zeros in the low-order bits. If y is less than 0, the function shifts x right y bits in the positive direction (from most significant to least significant bit) and inserts zeros in the high-order bits. "
If Y is positive, the shift is to the left y bits. If Y is negative, the shift is to the right y bits.
07-15-2009 04:48 PM
I was think too hard
Thank you.