🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #5229

Re: Shifting question

#5229
From: Rob McMahon
Date: Mon, 25 Jul 1988 21:23
25 lines
1684 bytes
In article <19962@watmath.waterloo.edu> rbutterworth@watmath.waterloo.edu (Ray Butterworth) writes:
|> In some article, someone whose name is lost in the mists of time writes:
|> > action of doing:
|> > 	x >>= 16; x>>= 16;
|> > better be the same as:
|> > 	x = x>>32;
|
|I can see why the Committee should NOT require that (for n>0)
|"x >>= n;"  be the same as  "while (n--!=0) x>>=1;".
|
|Imagine a machine with 16 bit words and a logical right shift
|instruction that only looks at the lowest 4 bits of the shift size.
|...
|No, I don't know of any such machine.

Okay, to make this concrete, have a look at a Gould sometime.  This hasn't
actually got any `shift by variable' instructions, only shift by constant.  A
shift by variable is done by constructing an instruction in a register and
then executing it.  At the moment this requires AND-OR-EXECUTE, the people who
are suggesting fixing the behaviour when `n' is < 0 or >= bits per word would
force the compiler to add tests for n >= 32 or n < 0 to this.
-- 
UUCP:   ...!mcvax!ukc!warwick!cudcv	PHONE:  +44 203 523037
JANET:  cudcv@uk.ac.warwick             ARPA:   cudcv@warwick.ac.uk
Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England
Technical Details
Message-ID: <14@titania.warwick.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!ukc!warwick!cudcv
References: <705@bnr-rsc.UUCP> <11556@steinmetz.ge.com> <60290@sun.uucp> <19962@watmath.waterloo.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!ukc!warwick!cudcv
From: cudcv@warwick.ac.uk (Rob McMahon)
Newsgroups: comp.std.c
Subject: Re: Shifting question
Message-ID: <14@titania.warwick.ac.uk>
Date: 25 Jul 88 21:23:22 GMT
References: <705@bnr-rsc.UUCP> <11556@steinmetz.ge.com> <60290@sun.uucp> <19962@watmath.waterloo.edu>
Reply-To: cudcv@warwick.ac.uk (Rob McMahon)
Organization: Computing Services, Warwick University, UK
Lines: 25