Skip to content

Instantly share code, notes, and snippets.

@pp4x
pp4x / structs.py
Created February 8, 2018 16:32
C struct wrapper: this is what I believe to be simpler than ctypes
from struct import Struct
from recordtype import recordtype
def populate(value, mask):
mask = mask[-1]
if value:
return value
elif mask in 'bBhHiIlLqQfd':
return 0
elif mask in 'sp':