Concatenate two 32 bit int to get a 64 bit long in Python
Left shift the first number by the number of bits in the second number, then add (or bitwise OR - replace +
with |
in the following examples) the second number.
result = (user_id << 32) + timestamp
With respect to your scaled-down example,
>>> x = 0b0010
>>> y = 0b0101
>>> (x << 4) + y
37
>>> 0b00100101
37
>>>
This should do it:
(x << 32) + y
foo = <some int>
bar = <some int>
foobar = (foo << 32) + bar