managarm / frigg

Lightweight C++ utilities and algorithms for system programming
MIT License
56 stars 20 forks source link

formatting: Fix '+', ' ', '#' and 'X' #6

Closed 64 closed 3 years ago

64 commented 3 years ago

This PR fixes a number of issues:

  1. Adds support for '+' and ' ' flags when printing signed integers. This fixes managarm/mlibc#229.
  2. When '#' is used with 'o', only print a leading zero if the number is non-zero.
  3. When 'X' is used, use uppercase letters for hexadecimal digits.
  4. When '#' is used with 'x' or 'X', prepend "0x" or "0X" respectively.

The relevant tests are added in managarm/mlibc#248.