Thread: logical shift and arithmetic shift.(bit shifting in C )

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Sep 2006
    Location
    Beaverton, Oregon, United States
    Posts
    176

    logical shift and arithmetic shift.(bit shifting in C )

    From what I'm told, right shifting of signed integers on some machine cause 1's to be shifted in and on others 0's are shifted in. Now for a signed integer, say -32, is only the last one shifted in as a 1 if its multiple shifts to the right?

    And if its shifting in zeros, how does it know its negative without the 1 in the most significant bit spot? Can someone give me an example of this?
    Last edited by A34Chris; 08-26-2012 at 04:10 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Logical Right Shift
    By theotherindian in forum C Programming
    Replies: 10
    Last Post: 09-22-2011, 01:26 PM
  2. Bit shift
    By nenpa8lo in forum C Programming
    Replies: 8
    Last Post: 09-03-2008, 07:30 AM
  3. arithmatic vs logical shift operation
    By onebrother in forum C Programming
    Replies: 2
    Last Post: 02-21-2008, 04:21 AM
  4. Shift operators in C
    By jedi_jinn in forum C Programming
    Replies: 4
    Last Post: 10-23-2006, 02:52 AM
  5. Shift Key
    By gnu-ehacks in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 01-31-2002, 05:47 PM