Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2017
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. import sys
  2. from ctypes import *
  3. if sys.byteorder == "little":
  4.     base = BigEndianStructure
  5. else:
  6.     base = LittleEndianStructure
  7.  
  8. class T(base):
  9.     pass
  10. _fields_ = [("a", c_ubyte),
  11.             ("b", c_byte),
  12.             ("c", c_short),
  13.             ("d", c_ushort),
  14.             ("e", c_int),
  15.             ("f", c_uint),
  16.             ("g", c_long),
  17.             ("h", c_ulong),
  18.             ("i", c_longlong),
  19.             ("k", c_ulonglong),
  20.             ("l", c_float),
  21.             ("m", c_double),
  22.             ("n", c_char),
  23.             ("b1", c_byte, 3),
  24.             ("b2", c_byte, 3),
  25.             ("b3", c_byte, 2),
  26.             ("a", c_int * 3 * 3 * 3),
  27.             ]
  28. T._fields_ = _fields_
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement