m1n1.constructutils: Add offsetof()

Signed-off-by: Asahi Lina <lina@asahilina.net>
This commit is contained in:
Asahi Lina 2022-08-31 11:12:03 +09:00
parent 7889f056f9
commit 0d3ed156a1

View file

@ -598,6 +598,10 @@ class ConstructClass(ConstructClassBase, Container):
def addrof(self, name):
return self._addr + self._off[name][0]
@classmethod
def offsetof(cls, name):
return cls._off[name][0]
def clone(self):
obj = type(self)()
obj.update(self)