Files
dusk/tools/mapcompile/helper.py

5 lines
219 B
Python

def floatToFixed248(value):
# Converts a float to the fixed248_t used internally.
high24 = int(value) & 0xFFFFFF
low8 = int((value * 256.0 - high24) * 256.0) & 0xFF
return f'((fixed248_t){(high24 << 8) | low8})'