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

pull/3937/head
Damien George 2018-07-09 12:22:40 +10:00
rodzic 4a1edd8382
commit 929d10acf7
1 zmienionych plików z 4 dodań i 2 usunięć

Wyświetl plik

@ -347,8 +347,10 @@ class RawCode:
n = struct.unpack('<I', struct.pack('<f', self.objs[i]))[0]
n = ((n & ~0x3) | 2) + 0x80800000
print(' (mp_rom_obj_t)(0x%08x),' % (n,))
print('#else')
print('#error "MICROPY_OBJ_REPR_D not supported with floats in frozen mpy files"')
print('#elif MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_D')
n = struct.unpack('<Q', struct.pack('<d', self.objs[i]))[0]
n += 0x8004000000000000
print(' (mp_rom_obj_t)(0x%016x),' % (n,))
print('#endif')
else:
print(' MP_ROM_PTR(&const_obj_%s_%u),' % (self.escaped_name, i))