Timeline for Hex to binary, LED blinking
Current License: CC BY-SA 3.0
3 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 20, 2017 at 16:07 | comment | added | Edgar Bonet |
I just timed both solutions, both inside a function taking a uint8_t argument and returning an int . The OP's function takes from 14 to 86 cycles, depending on the number of set bits found. Yours takes 281 CPU cycles irrespective of its input.
|
|
Mar 20, 2017 at 15:40 | comment | added | Edgar Bonet | The OP already solved the problem of counting the bits set, and his solution looks more efficient than yours. | |
Mar 20, 2017 at 14:56 | history | answered | Code Gorilla | CC BY-SA 3.0 |