mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-26 08:20:18 +00:00
m1n1.constructutils: Add offsetof()
Signed-off-by: Asahi Lina <lina@asahilina.net>
This commit is contained in:
parent
7889f056f9
commit
0d3ed156a1
1 changed files with 4 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue