How to do bit shifting in M3? #1144
Replies: 3 comments 2 replies
-
Using the Word interface, it's right on the interface index: http://modula3.github.io/cm3/help/interfaces.html#texts The language doesn't provide bitwise operators like C/C++ or Pascal. |
Beta Was this translation helpful? Give feedback.
-
1997tn's answer is right but to add a few "bits" of information:
Search for the word "Set" in the below: https://www.cs.purdue.edu/homes/hosking/m3/reference/arithmetic.html https://www.cs.purdue.edu/homes/hosking/m3/reference/relations.html If you do use Word.T, you can use BITSIZE to make your code portable. |
Beta Was this translation helpful? Give feedback.
-
On 1/19/23 12:54, 1997tn wrote:
Using the Word interface, it's right on the interface index: http://modula3.github.io/cm3/help/interfaces.html#texts
The language doesn't provide bitwise operators like C/C++ or Pascal.
Interface Word provides unsigned arithmetic, bitwise boolean operations and
shifts on INTEGER. In the library code ( found in m3-libs/m3core/src/word),
you will find it's a good but simple example of an instantiation of a generic
interface named GenWord.ig, which is also instantiated as Long.i3, for same
operations on LONGINT.
…
—
Reply to this email directly, view it on GitHub <#1144 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABSVZNBK3CLNHDSTFBLWRVDWTGEURANCNFSM6AAAAAAUAALGUA>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is it the same as SHL and SHR on Pascal? I didn't find the answer on the language manual. BTW, what about about bitwise operators (AND, OR, XOR, NOT)? Is there is list of them like what of C/C++?
Beta Was this translation helpful? Give feedback.
All reactions