|
-
Dec 15th, 2011, 09:18 AM
#1
[RESOLVED] Syntax Clarification Again
Good day. I'm not a C programmer but am trying to convert some code from C to VB and would appreciate clarification on a few C-related lines of code.
Example 1) value += ((-1) << x ) + 1;
value & x are both type int. I don't know how C shifts negative values but if someone can give me the result to the equation, I can figure out the rest on my own. Assume value is 3 and x is 8.
Example 2) if (!((x1 = blk[8*4] << 8) ...);
blk is an array. This line of code is first assigning x1 to blk[8*4] shifted left or is x1 assigned to blk[8*4] without the shift applied?
Example 3) x1 = x2 = x3 = x1 << 3
End result will be x1,x2,x3 will all have same value which is x1 shifted left, correct?
There are several hundred lines of code I'm trying to convert, and have encountered only a few situations where I'm doubting my interpretation. Thanks in advance.
Last edited by LaVolpe; Dec 20th, 2011 at 10:29 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|