title: How can I use arithmetic right shifting with an unsigned int?
body: <p>This is a homework question.</p>
  
  <p>I need to convert an unsigned 8-bit number to a 32-bit signed one.</p>
  
  <p>For example I have this unsigned 8-bit number: <code>1111 1010</code></p>
  
  <p>So in 32-bit signed it should be <code>1111 1111 1111 1111 1111 1111 1111 1010</code></p>
  
  <p>How can I do this? I know that <code>&gt;&gt;</code> only pads with 1's when it is a signed int so I could just cast it to a signed int before bit shifting right.</p>
  
  <p>The only thing is is that I have restrictions on my problem which state that I need to make a function that "uses only left and right shifts, along with one subtraction".</p>