Jump to content
Excelsior Forums
slathakamatchi

help me to use shift,logical and bitwise operators

Recommended Posts

Dear Sir/Ma'm,

I am new to Modula programming.Basically I'm a java programmer.

I need to convert a modula program to Java program.

So I downloaded your Native XDS-x86 2.45 Modula complier.

In my program i need to use bitwise shift operators.

But I feel a bit difficult to find which def module the logical AND and OR and bitwise operations defined in.

In the program i need to convert,the use the follwoing statement

FROM Bios IMPORT Shift,LOR,LAND,XOR;

They also use the string functions

FROM StringsP IMPORT CopyString,AppendString,AssignString,StringLength,

EqualStrings,ClearString,CompareStringsNoCase,

CompareResult,InsertString;

I replace them with

Append and Assign functions.

They also use a function

NumToString(i,16,4,StringValue);

which gives 4 character hexa string.

I need to get the definitions for XOR,LOR,SHIFT and LAND functions.

Check := XOR(Check,CardArr[j]);

Check := LOR(Shift(Check,-1),

LAND(XOR(Shift(CardArr[j],5),Shift(CardArr[j],2)),1));

I post the program as next post

I humbly request you to provide me the help.

Thank you in advance

Latha

Share this post


Link to post
Share on other sites

See "Report on the Programming Language Modula-2" in Wirth's

PROGRAMMING IN MODULA-2.

8.2.3. Set Operators shows that you can apply +, -, *, and / to

BITSET expressions. Thus, cast your INTEGER (or anything) to

BITSET, and

  + will give you bitwise OR

  * bitwise AND

  / bitwise XOR.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×