Results 1 to 7 of 7

Thread: [RESOLVED] Syntax Clarification Again

Threaded View

  1. #1

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Resolved [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.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width