Skip to content

First minor release

Choose a tag to compare

@Pharap Pharap released this 07 Apr 03:38
· 6 commits to master since this release
e5103ac

Technically some of the earlier patch releases should have been minor releases, but I wasn't expecting this library to get as popular as it has done. I'm now aiming to stick to semver as much as possible.

This release contains several new features and one bugfix.

Features include:

  • Operators for converting between SFixed and UFixed types.
    • This change was long overdue, but I am satisfied that the chosen implementation is better than what I might have come up with a few years ago.
  • Integer conversion operators
    • Ooperators for converting to all of the built-in integer types (char, short, int, long, long long and all signed and unsigned variations thereupon).
    • These are all explicit operators because conversion from fixed point to integer is an inherantly narrowing operation.
  • Postincrement and postdecrement operators.
    • They are provided for completeness, though I would advise against using them.
  • Bitwise shift operators.
    • These have been added purely to facilitate cheaper and faster multiplication and division by powers of two. Personally I'm not a fan of using bitshift operators for this purpose because I believe it harms readability, but since it's unlikely that a compiler would be able to perform such an optimisation on a user-defined type and I expect most users of this library are targetting microcontrollers, I've decided that the potential memory savings are worth the harmed readability.

Bugfixes include:

  • ++ and -- would cause a shift overflow for larger types because a lone 1 was being treated as int instead of a suitably large type. This was more of a problem for AVR CPUs, where int is only 16 bits wide.