[Oberon] Bit manipulation in Oberon-07
Chris Burrows
chris at cfbsoftware.com
Wed Oct 24 12:17:27 CEST 2018
> -----Original Message-----
> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of
> Skulski, Wojciech
> Sent: Wednesday, 24 October 2018 9:04 AM
> To: ETH Oberon and related systems
> Subject: [Oberon] Bit manipulation in Oberon-07
>
> All:
>
> my students want to know how to manipulate bits in an integer
> variable. I said "use SETs". We looked how to convert an integer to a
> SET and vice versa. We found that the way from a SET to INTEGER is
> via ORD. What is the other way from an INTEGER to SET without using
> SYSTEM.VAL?
>
Ask your students *why* do they think they want to manipulate bits in an
integer? What problem are they trying to solve?
Coincidentally (?) a similar question has just been asked on the Astrobe
forum. In that case all they wanted to do is to extract one (or possibly
more?) byte(s) from an integer. If that is what they are trying to do then
there are several easier ways to do this in Oberon-07 than using set-based
bit manipulation.
Regards,
Chris Burrows
CFB Software
http://www.astrobe.com/RISC5
More information about the Oberon
mailing list