0

I'm aware I could just do 0x0 - 9223372036854775807 - 1, but is there a bit shift operation I could do instead to make this faster? Context: I'm fed a uint64 number in hex string form but I want to store this number inside an 8 byte signed integer attr in PostgreSQL. Also, I would need a way to convert it back from signed integer to unsigned hex

4
  • Does this answer your question? Hex string to signed int in Python Commented Feb 16, 2023 at 15:56
  • No, that performs a two's complement. This question is asking how to interpret an unsigned integer as a signed integer via the difference (i.e. the 9223372036854775807) Commented Feb 16, 2023 at 16:20
  • No, your question as asked is about interpreting an unsigned hex string as a signed integer. Commented Feb 16, 2023 at 17:51
  • I see, feel free to edit the question title, but hopefully the description makes sense. Still, are there any other options? I can also repost the question title. Commented Feb 16, 2023 at 17:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.