prusa3d / Prusa-Firmware-MMU

Other
32 stars 15 forks source link

optimisation: set `enum` types explictly to `uint8_t` #328

Open gudnimg opened 1 month ago

gudnimg commented 1 month ago

This commit produces the same savings as the compiler option -fshort-enums. Except by setting the types manually we save also 2 bytes of SRAM.

By default, the enum type is 2 bytes, we can explicitly set it to one byte when applicable to reduce code size.

Almost all the savings come from enum Mode in leds.h.

Change in memory: Flash: -116 bytes SRAM: -2 bytes

github-actions[bot] commented 1 month ago

All values in bytes. Δ Delta to base

ΔFlash ΔSRAM Used Flash Used SRAM Free Flash Free SRAM
-116 -2 28254 1667 418 893