Forum Discussion
weikang_Hu_9799
Nimbostratus
Nov 27, 2007Got a negative integer which returned by getLow();
As the structure defined as below . high/low are unsigned integer .
struct Common.ULong64 {
long high;
long low;
};
However, I got a negative integer ..
...
Nov 27, 2007
Actually, the values are signed, not unsigned. The problem is that when I wrote the original iControl interfaces, java didn't support the XML Schema "unsigned long" type. Maybe that's changed now, but we can't change the interface without breaking backward compatibility. The structure was titled ULong64 but we had to make a type change at last minute and all the interfaces didn't make the change to the Long64 structure.
Since you work in java more than I do (I do very very little), does java support unsigned types now? Also, does it support 64 bit numbers?
If so, the likely problem with your conversion code:
long myresult = (commonstat[5].getValue().getHigh()<<32)|commonstat[5].getValue().getLow();
is that the LSFT 32 of the high value is likely casted into a 32 bit value, not the top 32 bits of a 64 bit value. This will result in a 32bit value of zero and when you OR that with the low value, you'll get a low value.
I believe Don had a conversion process for java to build native 64 bit values from the Common::ULong64 structure but I can't seem to find it. I'll dig around...
-Joe
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
