octave-maintainers
[Top][All Lists]
Advanced

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

More on bitfcns


From: Robert T. Short
Subject: More on bitfcns
Date: Sun, 19 Jul 2009 07:39:48 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.22) Gecko/20090606 SeaMonkey/1.1.17

In my search for Truth and Justice I discovered the following bitshift behavior.

Is the following correct?

% This is what MATLAB does and it seems to make sense to me.
octave:1> bitshift(uint8(0:15),1,3)
ans =

 0  2  4  6  0  2  4  6  0  2  4  6  0  2  4  6

% MATLAB doesn't support this, but octave does.  Why would shifting
% a positive signed integer give different results than unsigned?
octave:2> bitshift(int8(0:15),1,3)
ans =

  0   2   4   6   8  10  12  14  16  18  20  22  24  26  28  30




I will be out of town for a week.


Bob
--
Robert T. Short, Ph.D.
PhaseLocked Systems



reply via email to

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