tools/mpy-tool.py: Support freezing of floats in obj representation D.
This commit is contained in:
parent
4a1edd8382
commit
929d10acf7
|
@ -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))
|
||||||
|
|
Loading…
Reference in New Issue