зеркало из https://github.com/github/vitess-gh.git
This commit is contained in:
Родитель
0b6b29f9d2
Коммит
cdf8b42ae5
|
@ -1125,10 +1125,13 @@ class Vtctld(object):
|
|||
def uint64_to_hex(integer):
|
||||
"""Returns the hexadecimal representation of integer treated as a 64-bit unsigned integer.
|
||||
|
||||
The result is padded by zeros if necessary to fill an 8 character string. Useful for converting
|
||||
The result is padded by zeros if necessary to fill an 16 character string. Useful for converting
|
||||
keyspace ids integers.
|
||||
Example:
|
||||
uint64_to_hex(1) == "00000001"
|
||||
uint64_to_hex(0xDEADBEAF) == "DEADBEEF"
|
||||
uint64_to_hex(1) == "0000000000000001"
|
||||
uint64_to_hex(0xDEADBEAF) == "00000000DEADBEEF"
|
||||
uint64_to_hex(0xDEADBEAFDEADBEAFDEADBEAF) raises an out of range exception.
|
||||
"""
|
||||
if integer > (1<<64)-1 || integer < 0:
|
||||
raise Exception('Integer out of range: %d' %d integer)
|
||||
return "%08X" % integer
|
||||
|
|
Загрузка…
Ссылка в новой задаче