20.05.2013 Views

Scorrimenti (Shift)

Scorrimenti (Shift)

Scorrimenti (Shift)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Shift</strong> a sinistra (sll) di un numero relativo<br />

In generale il valore della sequenza<br />

a31 a30 … .. … ……….. a2 a1 a0<br />

30<br />

è N = a31 × (- 231) + ∑ i=0 ai 2i<br />

Supponiamo che entrambi i bit a31 e a30 siano uguali, allora<br />

29<br />

= - a31 × 231 + a30 × 230 + ∑ i=0 ai 2i<br />

29<br />

= - a31 × 230 - a31 × 230 + a30 × 230 + ∑ i=0 ai 2i (a31 = a30 )<br />

29<br />

= - a30 × 230 - a30 × 230 + a30 × 230 + ∑ i=0 ai 2i<br />

29<br />

= - a30 × 230 + ∑ i=0 ai 2i<br />

Dopo lo shift (sll) di un bit la sequenza diviene<br />

il cui valore è<br />

a30 … .. … ……….. a2 a1 a0 0<br />

- a30 × 231 + ∑ i=0 ai 2i+1 + 0 = 2 · (- a30 × 230 + ∑ i=0 ai 2i )<br />

= 2 × N<br />

30 29

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!