esp-hal icon indicating copy to clipboard operation
esp-hal copied to clipboard

Remove the usage of floats

Open bjoernQ opened this issue 3 years ago • 3 comments

Currently we use floats in one place: https://github.com/esp-rs/esp-hal/blob/907d43ed6f2bfde73763f9465b3e044c7777fee6/esp-hal-common/src/timer.rs#L226-L229

If possible we should remove that since it adds 2k of code (optimized) for ESP32-C3:

File  .text   Size                       Crate Name
0.0%  12.3% 1.2KiB           compiler_builtins compiler_builtins::float::div::__divdf3
0.0%   3.0%   292B           compiler_builtins __floatundidf
0.0%   1.6%   156B           compiler_builtins __floatunsidf
0.0%   1.4%   140B           compiler_builtins __gedf2
0.0%   1.4%   140B           compiler_builtins __gtdf2
0.0%   1.3%   130B           compiler_builtins __fixunsdfdi

bjoernQ avatar Jul 20 '22 10:07 bjoernQ

note: the upcoming LEDC implementation is currently also using floats

bjoernQ avatar Jul 26 '22 07:07 bjoernQ

I did say to @JurajSadel that we can not worry about the floats right now, just for the sake of getting things completed and merged. If you have a problem with this please feel free to say so though, doesn't really make a difference to me.

jessebraham avatar Jul 26 '22 13:07 jessebraham

No problem with that - we can replace the floats in one go later

bjoernQ avatar Jul 26 '22 14:07 bjoernQ