Michael Barton wrote: > In r.mapcalc docs there is an operator >>> for an unsigned right shift. > > Is there a corresponding <<< that is not mentioned?
No. A left shift is neither signed nor unsigned; it always inserts zeros into the least significant bits. An unsigned right shift inserts zeros into the most significant bits; a signed right shift inserts copies of the most signficant bit. This ensures that shifting right by N places is equivalent to division by 2^N. E.g. 0xFFFFFFF0 is either -16 or 4294967280, depending upon whether it is signed or unsigned. If it's unsigned, division by 2 should yield 0x7FFFFFF8 = 2147483640; if it's signed, it should be 0xFFFFFFF8 = -8. Technically, CELL is a signed type, with a range of -2147483647 to 2147483647 inclusive (-2147483648 is used for null). But r.mapcalc's >>> operator allows you to treat it as an unsigned 32-bit integer with a range of 0 to 4294967295 inclusive (excluding 2147483648, which is null; maybe that should be changed?). -- Glynn Clements <[email protected]> _______________________________________________ grass-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/grass-dev
