🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.modula2
2 messages
2 total messages Started by fred sullivan Wed, 26 Aug 1987 20:35
Re: Bit shifting operations
#3780
Author: fred sullivan
Date: Wed, 26 Aug 1987 20:35
21 lines
1785 bytes
>Supposedly, Modula-2 is a good systems programming language; but it
>has no native bit-shifting operations.  Aren't bit-shifting 
>operations important tools for EFFICIENT systems programming?
>Turbo Pascal and "C" have native bit-shifting operations, but not
>Modula-2.  Was this omission a wise design decision?  I would like
>to read some opinions on this question.

I agree that I sometimes wish that they existed.  On the other hand, bit
operations are inherently machine dependent.  Since such things are
going to vary from machine to machine anyway, perhaps Prof. Wirth decided
that it should be up to Modula implementors for various machines to include
shifts or not.  At least one compiler (the Powell compiler for Ultrix)
includes a bit manipulation module which implements shifts as in-line code
(although they appear to the user to be procedures).  At any rate, most
things (e.g. setting up masks) can be done effiently with Intsets anyway.

Fred Sullivan
Department of Mathematical Sciences
State University of New York at Binghamton
Binghamton, New York  13903
Email: sullivan@marge.math.binghamton.edu
Re: Bit shifting operations
#3783
Author: Pete Soper
Date: Thu, 27 Aug 1987 14:18
20 lines
1560 bytes
In article <669@bingvaxu.cc.binghamton.edu>
   sullivan@marge.math.binghamton.edu (fred sullivan) writes:

>>Supposedly, Modula-2 is a good systems programming language; but it
>>has no native bit-shifting operations.  Aren't bit-shifting 

>operations are inherently machine dependent.  Since such things are
>going to vary from machine to machine anyway, perhaps Prof. Wirth decided
>that it should be up to Modula implementors for various machines to include
>shifts or not.  At least one compiler (the Powell compiler for Ultrix)

Actually, Prof. Wirth provided a slew of extremely machine
dependent procedures in module SYSTEM for his single pass compiler. These
procs expand to inline code and are extremely efficient. They include both
arithmetic and logical shifts and a rotate function. Amazingly, though,
NEW AND DISPOSE as predefined procedures are absent and each port involves
implementing them.
-- 
Pete Soper, Encore Computer Corp
uucp: {necntc,talcott,ihnp4,decvax,allegra}!encore!soper
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads