Forum Discussion
Whoaa_aaa_14293
Nimbostratus
Feb 26, 2014High and low bits of 64-bit long and C#
Hi, what is the best way to take the high and low bits provided through iControl and create a 'long' in C from them?
I am currently using:
long wut = (ssl.statistics[0].value.high << 32) | ...
- Feb 26, 2014
I can't help you with C, but maybe you'll be able to convert this. Here's how I do it in Python:
def convert_to_64_bit(high, low): """ Converts two 32 bit signed integers to a 64-bit unsigned integer. """ if high < 0: high = high + (1 << 32) if low < 0: low = low + (1 << 32) value = long((high << 32) | low) assert(value >= 0) return value
mhite_60883
Cirrocumulus
Feb 26, 2014I can't help you with C, but maybe you'll be able to convert this. Here's how I do it in Python:
def convert_to_64_bit(high, low):
""" Converts two 32 bit signed integers to a 64-bit unsigned integer.
"""
if high < 0:
high = high + (1 << 32)
if low < 0:
low = low + (1 << 32)
value = long((high << 32) | low)
assert(value >= 0)
return value
Whoaa_aaa_14293
Nimbostratus
Feb 26, 2014I must be misunderstanding what the high and low values are then. Even when porting your code to C (which was basically just adding the if checks), I get the same exact behaviour. And I can't find any documentation detailing getting the real value out of these two high and low values.
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