Skip to content
Snippets Groups Projects
Commit 929d10ac authored by Damien George's avatar Damien George
Browse files

tools/mpy-tool.py: Support freezing of floats in obj representation D.

parent 4a1edd83
No related branches found
No related tags found
No related merge requests found
...@@ -347,8 +347,10 @@ class RawCode: ...@@ -347,8 +347,10 @@ class RawCode:
n = struct.unpack('<I', struct.pack('<f', self.objs[i]))[0] n = struct.unpack('<I', struct.pack('<f', self.objs[i]))[0]
n = ((n & ~0x3) | 2) + 0x80800000 n = ((n & ~0x3) | 2) + 0x80800000
print(' (mp_rom_obj_t)(0x%08x),' % (n,)) print(' (mp_rom_obj_t)(0x%08x),' % (n,))
print('#else') print('#elif MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_D')
print('#error "MICROPY_OBJ_REPR_D not supported with floats in frozen mpy files"') n = struct.unpack('<Q', struct.pack('<d', self.objs[i]))[0]
n += 0x8004000000000000
print(' (mp_rom_obj_t)(0x%016x),' % (n,))
print('#endif') print('#endif')
else: else:
print(' MP_ROM_PTR(&const_obj_%s_%u),' % (self.escaped_name, i)) print(' MP_ROM_PTR(&const_obj_%s_%u),' % (self.escaped_name, i))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment