Created
February 21, 2020 16:49
-
-
Save Tolsi/fbd683bc14fbc7b9a1e351bb26786c48 to your computer and use it in GitHub Desktop.
handy ctypes examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ctypes import c_uint, c_int | |
print(c_uint(c_int(-49).value).value) | |
print(hex(c_uint(c_int(-49).value).value)) | |
print(c_int(c_uint(0x7fffffcf).value).value) | |
print(hex(c_int(c_uint(0x7fffffcf).value).value)) | |
# 4294967247 | |
# 0xffffffcfL | |
# 2147483599 | |
# 0x7fffffcf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment