Skip to content

Avoid double precision floats in time.monotonic() computation to further increase flash space #342

Closed
@dhalbert

Description

@dhalbert

time.monotonic() was dividing a 64-bit uint by 1000.0f. This caused the compiled code toinclude _aeabi_u2lf(), which converts long long to float. In the process ul2f calls double-precision routines. I thought I had gotten rid of these by #325, but not completely.

I changed the arithmetic to break the 64-bit int into two pieces: multiply the top part by 2.0^32f and add it to the bottom part, then divide by 1000.0f. This avoids ul2f and there are no more double routines left in the image except the tiny _aeabi_d2f()`.

This gains back 3044 bytes!!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions