CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2001
    Posts
    2,455

    what does this << mean?

    Looking at an example of drawing rounded rectangles, I see this:
    Code:
    int d = raius << 1;
    What does this do? I know it is a shift operator, but what is this doing?

    Mike B

  2. #2
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: what does this << mean?

    Pefroming a shift to the left by one bit. It is basic binary methamatics and is equivilant to a *2 when applied to an integral type (but often faster - althought the compiler may internally optimize a *2 into a <<1)
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

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

Featured