octave-maintainers
[Top][All Lists]
Advanced

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

Re: bitshift of int8, int16, etc?


From: Daniel J Sebald
Subject: Re: bitshift of int8, int16, etc?
Date: Mon, 25 Jun 2007 15:09:27 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020

Daniel J Sebald wrote:

There are other prefered behaviors for shift. Say for example the user wants saturation (-127 << 1 => -128 and 126 << 1 => 127) rather than wrap around, which one could use in signal processing. But that might be a type other than int8.

And in fact, this is the way that the function int8() itself seems to behave:

octave:7> int8(-129)
ans = -128
octave:8> int8(-257)
ans = -128

i.e., saturates rather than wraps.

Dan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]