Re: NetRexx and Long Hex Constants

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: NetRexx and Long Hex Constants

Mystery Guest

Just following up on my previous posting.  It looks like it is
the 'L' suffix value that NetRexx does not like or does not
support.   I couldn't find anything in the manuals about it
so I assume that it is not supported.   Here is how I got
around it....


properties private
   two31 = long 2147483648


sign   = logDataInputStream.readInt();
unsign = ( long (sign & 2147483647) ) | (sign & two31)


two31 = 2^31
2147483647 = 2^31 - 1

Seems to work OK

./CK

>From: "Mystery Guest" <[hidden email]>
>To: [hidden email]
>Date: Sat, 24 Aug 2002 08:26:33 -0700
>
>
>
>I am reading a file using DataInputStream and I have the need to read
>some integers as unsigned.  The problem is DataInputStream does not
>have a readUnsignedInteger.  So I thought of converting the integer
>to long as follows:
>
>unsign = logDataInputStream.readInt() & 0x00000000ffffffffL
>
>However the NetREXX compiler comes back with an error message directed
>at my hex long constant as follows:
>
>+++ Error: Incorrect syntax for a number
>
>I understand that in order to do bitwise operations I need to make the
>class binary but I still get this error.  The NetRexx manual or the
>redbook does not seem to give any example of long hex constants [at
>least as far as I can see].  So my question is what is the proper
>syntax for a long hexadecimal constant in NetRexx?
>
>Thanks in advance.
>
>[PS.  V2.0.2 of NetRexx.  JDK1.4.0_01]
>
>./CK
>
>_________________________________________________________________
>Join the world?s largest e-mail service with MSN Hotmail.
>http://www.hotmail.com
>
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>To unsubscribe from this mailing list ( ibm-netrexx ), please send a note
>to
>[hidden email]
>with the following message in the body of the note
>unsubscribe ibm-netrexx <e-mail address>




_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail.
http://www.hotmail.com

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>


Reply | Threaded
Open this post in threaded view
|

Re: NetRexx and Long Hex Constants

Mystery Guest
Perfect.  That works just great.  Thank you.


>From: "Mike Cowlishaw" <[hidden email]>
>To: "Mystery Guest" <[hidden email]>
>CC: [hidden email]
>Subject: Re: NetRexx and Long Hex Constants
>Date: Mon, 26 Aug 2002 09:00:28 +0100
>
>
>Hex constants in NetRexx are self-defining in value; they have no type as
>such.
>
>so
>
>    mask = long 0xffffffff
>    unsign   = logDataInputStream.readInt() & mask
>
>or
>
>    unsign   = logDataInputStream.readInt() & (long 0xffffffff)
>
>should work, I think.
>
>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>Mike Cowlishaw, IBM Fellow
>IBM UK (MP5), PO Box 31, Birmingham Road, Warwick, CV34 5JL
>mailto:[hidden email]  --  http://www2.hursley.ibm.com




_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>