[Oberon] Bit manipulation in Oberon-07

Chris Burrows chris at cfbsoftware.com
Sun Oct 28 02:22:05 CEST 2018


> -----Original Message-----
> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of
> Skulski, Wojciech
> Sent: Sunday, 28 October 2018 9:46 AM
> To: ETH Oberon and related systems
> Subject: Re: [Oberon] Bit manipulation in Oberon-07
> 
> >Portability is not a realistic aim when working with hardware-
> defined
> >interfaces,
> 
> Same here. Meanwhile we will adopt your example procedures in our
> code.
> 

If you are working with beginners, you might want to make the functions a
little more robust to quickly draw attention to common errors. Because all
of the parameters are integers I have discovered (just by writing the test
program) that it is easy to make mistakes. If the parameters are not used in
the correct order the resulting problems can be tricky to diagnose. If
performance is not a crucial issue then it is wise to add some
parameter-checking assertions so that these sorts of errors are detected
ASAP. 

e.g. check that MSB and LSB are in the correct order; LSB and MSB are both
in the range 0..31 and that the bitfield parameter to BFI is not larger than
the space allocated to it. I have updated the sample code to do this, but as
this email server tends to make a mess of code-formatting, I have presented
the revised code on the corresponding discussion on the Astrobe forum:

http://www.astrobe.com/forum/viewtopic.php?f=4&t=588

Regards,
Chris

Chris Burrows
CFB Software
http://www.astrobe.com/RISC5






More information about the Oberon mailing list