LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

LabWindows CVI: Bitshfting issue

I cannot understand why LabWindows refuses to shift bits at all; it pretends the command doesn't even exist when tracking with breakpoints:

int pattern = 1;
.
.
.
if (pattern == 255)
    {
    pattern =1;
// I have other assignments here that do not involve pattern.
    }
else
    {
    pattern << 1;
// I have other assignments here that do not involve pattern and that work fine.
    }

I'm at my wits end and the help file is providing no help whatsoever.  Given this is working just fine and dandy in XCode/gcc, I'm wondering why LabWindows refuses to do as it is told.  I can only speculate that bitshifting is done differently in LabWindows?

Any help would be appreciated.
0 Kudos
Message 1 of 4
(3,211 Views)
Figured it out.

I have to use a temporary variable to save the shifting result, that is,

int a = 0;

a = (pattern >> 1);
0 Kudos
Message 2 of 4
(3,209 Views)
You're right. You cannot simply shift your variable, but you must explicitly assign the result to it, the same as for incrementing it you'd have used "pattern += 4;" I don't remember now if "<<=" is a valid operator, but you can simply try it: the compilator will tell you! Smiley Wink


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 4
(3,201 Views)
Back in the office. Confirmed that assign left shift operator is good working in CVI. Smiley Happy


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 4
(3,196 Views)