Forum Discussion
Eduardo_Saito_1
Nimbostratus
Sep 25, 2007STATISTIC_BYTES_OUT with negative numbers.
Hello Everybody.
I'm having the following problem and I hope someone can help me.
I did a .net CSharp program that collects STATISTIC_BYTES_IN and STATISTIC_BYTES_OUT.
It really works wh...
Sep 26, 2007
The statistics are returned in a structure with two 32bit signed values
struct ULong64 {
long high;
log low;
}Q: Why have a structure instead of a native 64 bit number?
A: The XML Schema that we use for typing doesn't support 64 bit numbers and some of the client side tooklits don't support 64 bit numbers natively either.
Q: Why use signed instead of unsigned values? (or, why is the low value negative in your second example).
A: We had to use signed values as Java doesn't support unsigned values (at least it didn't when we first developed iControl). By using the unsigned long schema type, we were getting runtime errors with the java toolkits. So we had to use signed numbers. Numbers that go half way over the 32bit mark, will have the highest bit of 1 which indicates a negative number for signed values.
Q: Why does the high value show a value of 1?
A: The calculation in C is: 64bit = ((ulong)high<<32) | (uint)low; In your case, the 33rd bit in the 64 bit number is one meaning your number broke the 32bit boundary of 2^32.
The bottom line is that you should use a helper method to convert your two 32bit signed values into a 64bit unsigned value before you do calculations on it.
-Joe
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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