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> aritmetico e divisione per 2 (continua)<br />

Siano M ed M' i valori assoluti di N ed N' rispettivamente.<br />

N = 2 × ( - 230 + ∑ i=0 ai+1 2i ) + a0<br />

29<br />

N' = - 230 + ∑ i=0 ai+1 2i<br />

Se N ed N' sono numeri negativi si ha che<br />

M = 2 × ( 230 - ∑ i=0 ai+1 2i ) - a0<br />

29<br />

M' = (230 - ∑ i=0 ai+1 2i )<br />

Pertanto, se a0 = 1 (caso N dispari) allora si ha<br />

M = 2 × M' - a0 = 2 × M' - 1 = 2 × (M' - 1) + 1<br />

Quindi: se N e' un numero negativo dispari allora il valore della<br />

sequenza che si ottiene applicando uno shift aritmetico di un bit<br />

alla rappresentazione in complemento a due di N e'<br />

29<br />

29<br />

(N div 2) - 1

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

Saved successfully!

Ooh no, something went wrong!