Re: Rotating bits left in BASIC
- From: Matthew Barnett <news@xxxxxxxxxxxxxxxxxxx>
- Date: Tue, 12 Sep 2006 00:24:31 +0100
druck wrote:
On 8 Sep 2006 Andrew Conroy <a.m.conroy@xxxxxxxxxxxx> wrote:Or:Moving on from here, I've now realised that the numbers I'm working with
are stupidly large and will be bigger than &7fffffff (in fact bigger than
&7fffffff*2), and so are, I guess, effectively 64bit numbers rather than
the more usual 32bit ones. This leads to two problems:
1) How do I rotate 64bit numbers?
You can do it in BASIC, but its nasty. This is a rotate right of 1 bit.
carry1% = highword% AND 1
carry2% = lowword% AND 1
highword% = (highword%>>>1) OR (carry2%<<31)
lowword% = (lowword%>>>1) OR (carry1%<<31)
temp% = highword%
highword% = (highword% >>> 1) OR (lowword% << 31)
lowword% = (lowword% >>> 1) OR (temp% << 31)
.
- References:
- Rotating bits left in BASIC
- From: Andrew Conroy
- Re: Rotating bits left in BASIC
- From: Ste (news)
- Re: Rotating bits left in BASIC
- From: Andrew Conroy
- Re: Rotating bits left in BASIC
- From: Andrew Conroy
- Re: Rotating bits left in BASIC
- From: druck
- Rotating bits left in BASIC
- Prev by Date: Re: Rotating bits left in BASIC
- Next by Date: Re: Application note 241 "The RISC OS Drag-and-Drop System"
- Previous by thread: Re: Rotating bits left in BASIC
- Next by thread: Re: Rotating bits left in BASIC
- Index(es):