dissect.cstruct 3.11.dev3__py3-none-any.whl → 3.12.dev2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,7 +22,7 @@ class Field:
22
22
  self.alignment = type_.alignment
23
23
 
24
24
  def __repr__(self):
25
- bits_str = " : {self.bits}" if self.bits else ""
25
+ bits_str = f" : {self.bits}" if self.bits else ""
26
26
  return f"<Field {self.name} {self.type}{bits_str}>"
27
27
 
28
28
 
@@ -324,6 +324,12 @@ class Union(Structure):
324
324
  size = max(len(field.type), size)
325
325
  alignment = max(field.alignment, alignment)
326
326
 
327
+ if self.align and size is not None:
328
+ # Add "tail padding" if we need to align
329
+ # This bit magic rounds up to the next alignment boundary
330
+ # E.g. offset = 3; alignment = 8; -offset & (alignment - 1) = 5
331
+ size += -size & (alignment - 1)
332
+
327
333
  self.size = size
328
334
  self.alignment = alignment
329
335
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dissect.cstruct
3
- Version: 3.11.dev3
3
+ Version: 3.12.dev2
4
4
  Summary: A Dissect module implementing a parser for C-like structures: structure parsing in Python made easy
5
5
  Author-email: Dissect Team <dissect@fox-it.com>
6
6
  License: Apache License 2.0
@@ -15,12 +15,12 @@ dissect/cstruct/types/flag.py,sha256=BQMmpoO_ey-CRf1cP4Nrf7L_U4zvhIZoVrM3ZkyWFRk
15
15
  dissect/cstruct/types/instance.py,sha256=3KceA9k1Cxo5HKa5wH7O48vtzvNMTsjsO917hgOQk4U,1997
16
16
  dissect/cstruct/types/packedtype.py,sha256=93D8Rcn1SDeY0oOYA73DwgFIbwuNhOffR-NL0_Z6nqg,1997
17
17
  dissect/cstruct/types/pointer.py,sha256=ghfZ9y638KCzem0rXgYeeTPXbYhacHfWx8uD003GkWo,4609
18
- dissect/cstruct/types/structure.py,sha256=D7VViVKJgeINknmgBw46vzariDo5NptOH3Pt477vx6o,13153
18
+ dissect/cstruct/types/structure.py,sha256=epjVmMUCxoMNCi5xMoMIyw9Ujp_g2cSEPcZl7eJN0bE,13442
19
19
  dissect/cstruct/types/voidtype.py,sha256=JaKEIjOsGTARn8g30vv7WCH_OAdEkKt4Mw6Oneo_3Mw,301
20
20
  dissect/cstruct/types/wchartype.py,sha256=pVp_xlu4xHdxzQG6FB30IxNSwnKRC183jleeUG4nzQ4,1693
21
- dissect.cstruct-3.11.dev3.dist-info/COPYRIGHT,sha256=H-18RXfshdH9AdHwW2eO1Xa-5s6tY5eipHh5c0whDu4,316
22
- dissect.cstruct-3.11.dev3.dist-info/LICENSE,sha256=PhUqiw6jAh2KbBdVRPBq_hfAvfcTBin7nZ3CK7NQbTM,11341
23
- dissect.cstruct-3.11.dev3.dist-info/METADATA,sha256=A5Ossj_e6oxYdHZkG_x0k8jXAizE-vysW9ch99QFSMA,8303
24
- dissect.cstruct-3.11.dev3.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
25
- dissect.cstruct-3.11.dev3.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
26
- dissect.cstruct-3.11.dev3.dist-info/RECORD,,
21
+ dissect.cstruct-3.12.dev2.dist-info/COPYRIGHT,sha256=H-18RXfshdH9AdHwW2eO1Xa-5s6tY5eipHh5c0whDu4,316
22
+ dissect.cstruct-3.12.dev2.dist-info/LICENSE,sha256=PhUqiw6jAh2KbBdVRPBq_hfAvfcTBin7nZ3CK7NQbTM,11341
23
+ dissect.cstruct-3.12.dev2.dist-info/METADATA,sha256=9gnt1Q1FUNBId8jQbmOmMzzx72FFxt6Oc2IVnNHDIK0,8303
24
+ dissect.cstruct-3.12.dev2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
25
+ dissect.cstruct-3.12.dev2.dist-info/top_level.txt,sha256=Mn-CQzEYsAbkxrUI0TnplHuXnGVKzxpDw_po_sXpvv4,8
26
+ dissect.cstruct-3.12.dev2.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.3)
2
+ Generator: bdist_wheel (0.42.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5