dcsimg
How can I support Unsigned 64 bit Integers in java
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Abey_Mullassery
Posted On:   Wednesday, July 18, 2001 05:25 AM

I need to support Unsigned 64 bit Integer values in my application. These values come for an external C++ program. I also need to support 32 bit unsigned, 16 bit unsigned, etc., too but they can be done with the wrapper class which uses a higher data-type in java itself and a check for the sign. The problem arises when I come to the limit of 64 bit values. I also have to do bit wise operations and arithmetic operations on these values. Hence I need to easily get the bit structure too. I tried to make a class using a BigInteger which can support all these functions and sign checking, but it is about 10 times slower than normal operations (I timed it with BigInteger addition and Integer additio   More>>

I need to support Unsigned 64 bit Integer values in my application. These values come for an external C++ program.
I also need to support 32 bit unsigned, 16 bit unsigned, etc., too but they can be done with the wrapper class which uses a higher data-type in java itself and a check for the sign.
The problem arises when I come to the limit of 64 bit values.

I also have to do bit wise operations and arithmetic operations on these values. Hence I need to easily get the bit structure too.

I tried to make a class using a BigInteger which can support all these functions and sign checking, but it is about 10 times slower than normal operations (I timed it with BigInteger addition and Integer addition)!

Can anyone suggest a better alternative?

   <<Less

Re: How can I support Unsigned 64 bit Integers in java

Posted By:   Abey_Mullassery  
Posted On:   Tuesday, August 21, 2001 02:57 AM

I had to develop a class which internally uses the BigInteger. Internally we just maintain the bit width and sign.


The sign is used only for output ie., for read methods. Internally the value is always stored as positive.
This helps all calculations to be done (and, or, add, subtract, etc..) irrespective of the sign.

This is very much helpful in my application where we are trying to simulate components defined in VHDL.

Re: How can I support Unsigned 64 bit Integers in java

Posted By:   John_Mitchell  
Posted On:   Wednesday, July 18, 2001 08:55 AM

About | Sitemap | Contact