jacob navia
4/17/2011 6:53:00 AM
Le 17/04/11 01:23, Alan Curry a écrit :
> In article<iod0nj$a5i$1@speranza.aioe.org>,
> jacob navia<jacob@jspamsink.org> wrote:
>> Hi
>>
>> I am programming the "ValArray" for my containers library and I am
>> adding operations like "clamped add" or clamped subtract:
>>
>> c = ((a+b)> 65535) ? 65535 : a+b; // What name should it have?
>>
>> c = ((a-b)< 0) ? 0 : a-b; // Same question
>
> "clamped" is not a bad name, but "saturated arithmetic" seems to be a little
> more widespread (in MMX and Altivec documentation for example). The
> operations would be called "add/subtract with saturation" or "saturated
> addition/subtraction" in documentation, and in reducing those names to a C
> identifier, you could use saturated_add() or sat_add() or sadd() depending on
> how short you want it to be.
>
Saturated. OK.
Thanks for your input. After you wrote I have searched in Google
and there is even an article in Wikipedia. So that is the name
I was looking for
Thanks