top | item 45480610

(no title)

veyh | 4 months ago

Well, I'd imagine that before returning the value through their API they could just check that if the number is negative, then add 2^32 to it, which would make it look like an unsigned 32 bit integer.

discuss

order

conradfr|4 months ago

But isn't that exactly what they were trying to not do as their problem was the api users and not their internal use?

veyh|4 months ago

It was definitely a problem with their database but I suppose it's possible that the customers were also expecting 32 bit signed ints.

layer8|4 months ago

In most languages that support differently sized integer types and/or unsigned integer types, you wouldn’t have to check, but can just apply the appropriate modulo or bit operation on all values.