On Mon, Apr 22, 2013 at 11:49:20PM +0300, Paul Sokolovsky wrote:
> > Defining
> > 
> >     (x << n) = (x * 2^(n % 16)) & 0xffff
> > 
> > is just as good a mathematical definition as your desired
> > 
> >     (x << n) = (x * 2^n) & 0xffff
> > 
> > (for 16-bit ints)
> > 
> > 
> > Neither definition is "normal" mathematics.
> 
> Ok, let's recurse into getting terminology and foundation straight. So,
> I gather the most correct classification of shift is "arithmetic-logic
> bitwise operation". And it's defined in terms of iterative algorithm on
> the value represented as a vector of digits. The algorithm is of course
> obvious. So, I meant *that* mathematics - which deals with algorithms
> and stuff, not one dealt with in primary school. Prooflink that the
> former exists: http://en.wikipedia.org/wiki/Algorithm (though nowadays
> everyone laughs at wikipedia).

If your perspective happens to be more hardware-oriented than
algorithmic, you might think of a barrel shifter as being a good way to
define arbitrary bit shift. This results in the behaviour specified by
the first definition above.

Why should the algorithmic definition be considered more correct than
the hardware definition?

-- 
Daniel Beer <dlb...@gmail.com>    www.dlbeer.co.nz
IRC: inittab (Freenode)    PGP key: 2048D/160A553B

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to