pokitto / PokittoLib

Library for making programs on Pokitto hardware
22 stars 16 forks source link

Consider removing 'pokItoa', 'pokUtoa' and 'pokLtoa' #103

Open Pharap opened 4 years ago

Pharap commented 4 years ago

Now that we're using C++17, std::to_chars can be used instead.

If they aren't going to be removed, we can at least improve the implementation. In particular C++ already has a std::reverse. It could be used as std::reverse(&str[0], &str[i]);.

Besides which, some things are just plain incorrect.

For example, pokItoa states: https://github.com/pokitto/PokittoLib/blob/1324c7c58d24eca9e102752f6e17fc22117baf4b/Pokitto/POKITTO_CORE/PokittoItoa.cpp#L75-L76 Which would be correct for a 10-bit value, but certainly not a 16-bit value.