Skip to content

Instantly share code, notes, and snippets.

i96751414 i96751414

Block or report user

Report or block i96751414

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@i96751414
i96751414 / integer_conversion.py
Last active Jun 20, 2019
Automatically convert integers to hex strings
View integer_conversion.py
def bytes_size(value):
if value == 0:
return 1
size = (value.bit_length() + 7) // 8
if value < 0 and not value & (1 << (size * 8 - 1)):
size += 1
return size
def integer_to_hex(value, decimals=0):
You can’t perform that action at this time.