[A83] Re: Signed division by a power of two.


[Prev][Next][Index][Thread]

[A83] Re: Signed division by a power of two.



The sra instruction does divide a signed byte by 2.  But take note of what
happens when the number is not even.  In this case, the low bit is discarded,
so the value is always rounded down.  Thus if you divide 1 by 2, you get 0,
but dividing -1 by 2 will not give 0, but rather -1 again.  Whether or not
this is a problem may depend on your exact application




Follow-Ups: References: