I'm pretty sure that Thrift doesn't support it because unsigned numbers aren't supported in all the languages (I could be wrong).

Nonetheless, I can think of two workarounds:

- Cast your number to a 64-bit signed long before transport, then re-cast it as an unsigned long on the other side.

- Use two int fields to send it, storing the first 32 bits in one and the second 32 bits in the other.
function prepareForTransport(ulong val) {
        int valA = val & 0xFFFFFFFF;
        int valB = (val >> 32) & 0xFFFFFFFF;
        return array(valA, valB)
}

function decompressFromTransport(int valA, int valB) {
        return valA + ((ulong) valB << 32);
}

Not a pretty solution, but it should work just fine.

--Jonathan

Ephraim Dan wrote:
We have some big numbers, that we use "unsigned long long" (uint64_t) for in 
our code.
Thrift apparently explicitly doesn't support unsigned integer types.
What are we to do if we do, after all, need to transport such a number using 
thrift?

Thanks
--edan


Reply via email to