Re: Saturation




Tim Frink wrote:

My DSP has this instruction:
sat_abs DATAREG_A, DATAREG_B, DATAREG_C

(with DATAREG_X beeing 32bit data registers).
The manual says to this instruction:

Compute the absolute value between DATAREG_B and DATAREG_C
and store the result in DATAREG_A. The registers are treated as
signed, 32-bit integers, and saturation is performed on signed
overflow. What I don't understand is why saturation makes
sense here since in my option an overflow can never happen.
Or am I wrong?

how can an ABSolute value be signed ?
OK, if the result must fit into 31 bits then it can overflow:
b= 7fff_ffff 2^31 -1 2147483647
c= 8000_0000 -2^31 -2147483648
b-c= ffff_ffff +4294967295
is true even carryover truncated and unsigned yet
or is it - 1 ?
if abs(a)=abs(b)-abs(c) shoudn't it be +1 then ?

NEG (2's complement) of 8000_0000h wont work without using more
than 32 bits. But NEG of ffff_ffffh will produce a +1.

mov eax,ebx
sub eax,ecx
jns done ;if difference is positive
neg eax
done:

__
wolfgang



.



Relevant Pages

  • Re: Saturation
    ... (with DATAREG_X beeing 32bit data registers). ... Compute the absolute value between DATAREG_B and DATAREG_C ... sense here since in my option an overflow can never happen. ... represented in 2's complemented form can lead to an overflow as well ...
    (alt.lang.asm)
  • Re: Saturation
    ... (with DATAREG_X beeing 32bit data registers). ... Compute the absolute value between DATAREG_B and DATAREG_C ... sense here since in my option an overflow can never happen. ... negative number in the first calculation. ...
    (alt.lang.asm)
  • Re: Saturation
    ... (with DATAREG_X beeing 32bit data registers). ... Compute the absolute value between DATAREG_B and DATAREG_C ... What I don't understand is why saturation makes ... sense here since in my option an overflow can never happen. ...
    (alt.lang.asm)
  • Re: Saturation
    ... The registers are treated as ... What I don't understand is why saturation makes ... sense here since in my option an overflow can never happen. ... If it means absolute _difference_ then I agree with you. ...
    (alt.lang.asm)
  • Re: CSS2: what is the container of everything ?
    ... hidden under myhead). ... absolute for everything but make #main overflow: auto so you can scroll ... absolute. ...
    (comp.infosystems.www.authoring.html)