Re: avr-gcc generating really dumb code

2015-04-30 Thread Georg-Johann Lay
Ralph Doncaster schrieb: I wrote a small function to convert u8 to hex: // converts 4-bit nibble to ascii hex uint8_t nibbletohex(uint8_t value) { if ( value > 9 ) value += 'A' - '0'; return value + '0'; } // returns value as 2 ascii characters in a 16-bit int uint16_t u8tohex(uint8_t va

avr-gcc generating really dumb code

2015-04-28 Thread Ralph Doncaster
I wrote a small function to convert u8 to hex: // converts 4-bit nibble to ascii hex uint8_t nibbletohex(uint8_t value) { if ( value > 9 ) value += 'A' - '0'; return value + '0'; } // returns value as 2 ascii characters in a 16-bit int uint16_t u8tohex(uint8_t value) { uint16_t hexdigi