[comp.sys.sgi] Shifts on 4-D

mike@BRL.ARPA (Mike Muuss) (05/19/88)

I just discovered that on the SGI 4-D, negative shifts on (at least)
variables declared "register unsigned" don't work.  It would appear that
perhaps such a shift is being interpreted as a large positive shift.
At any rate, the values always came up zero in the low byte.

I wouldn't ordinarily write code that does this sort of thing -- this
particular piece of code was something that somebody else had written
quite a while ago, and I just chose this evening to port it to the 4-D.
On the other hand, the VAX and the Gould and probably many other machines
all permit negative shifts, so this seems like something that other
folks may encounter.

K&R are silent on this point (ref: pages 44, 189).  No help there.
So, I'm not asking that this be fixed, just surfacing it as an issue for
others to watch out for.

The upshot of this is that CAT-FB (a port of Ron Natalie's ICAT program)
now runs on the 4D, and very quickly.  It takes TROFF output and "typesets"
it into the current framebuffer, using the vfont bitmaps.  Very nice
for making slides.
	-Mike

gwyn@BRL.ARPA (Doug Gwyn, VLD/VMB) (05/20/88)

> K&R are silent on this point (ref: pages 44, 189).

K&R second edition p.206:
	The result is undefined if the right operand is negative, ...