Hi, I have a function which implements a decision tree with if-else statements involving unsigned 16-bit variables and constants.
However, when I disassemble the compiled file, each 16-bit constant seems to occupy 32 bits in ROM.
Is my understanding correct (spending 32 bits for 16-bit constants)?
Is there a way to use only 16 bits for each literal to save space?
Thanks in advance.
Compile 16-bit literals for ESP32S3
Re: Compile 16-bit literals for ESP32S3
That's probably an optimization for space and speed as iirc Xtensa doesn't have an instruction to load a literal smaller than 32 bit, so it'd have to string multiple instructions together to do the same thing if you saved them as actual 16-bit values. (And note that that'd mean the savings in data space would be smaller than the extra space the added instructions would take up.)
If you want to do this anyway, you could create a const array of 16-bit values and use the indices of that, rather than literals.
If you want to do this anyway, you could create a const array of 16-bit values and use the indices of that, rather than literals.
Who is online
Users browsing this forum: Amazon [Bot], Baidu [Spider], Bing [Bot], Qwantbot and 3 guests
