Eliminar CopyPaste.py
This commit is contained in:
parent
a4bc042b2c
commit
615bfbf5bd
19
CopyPaste.py
19
CopyPaste.py
|
@ -1,19 +0,0 @@
|
|||
def calculate_offsets(db_struct, current_offset=0, parent=None):
|
||||
"""
|
||||
Recursively calculate byte offsets for each field in the DB structure considering special types.
|
||||
"""
|
||||
last_key_was_bool = False
|
||||
last_bit_offset = 0 # To track bit offsets within a byte
|
||||
if isinstance(db_struct, dict):
|
||||
for key, value in list(db_struct.items()):
|
||||
if isinstance(value, dict):
|
||||
if "type" in value and not "offset" in value:
|
||||
|
||||
current_offset = calculate_offsets(
|
||||
value, current_offset, value
|
||||
) # Recurse into nested structs
|
||||
|
||||
elif isinstance(db_struct, list):
|
||||
for item in db_struct:
|
||||
current_offset = calculate_offsets(item, current_offset, parent)
|
||||
return current_offset
|
Loading…
Reference in New Issue