diff options
| author | Donald Sharp <donaldsharp72@gmail.com> | 2023-09-06 07:59:15 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-06 07:59:15 -0400 |
| commit | 58201b3d635f5d38975f5126473685c377c62c23 (patch) | |
| tree | fadda3fac2b3df42037d9d621b1446a31bf409ee /lib/printf/printfcommon.h | |
| parent | 0cca9707905352f6b1a7db3fba0f794c54ad4954 (diff) | |
| parent | f137bc89167cd9ed18f225ae4ff0c079ba4bd882 (diff) | |
Merge pull request #14344 from opensourcerouting/freebsd-printf-sync-20230903
lib/printf: sync with FreeBSD for ISO C23 enhancements
Diffstat (limited to 'lib/printf/printfcommon.h')
| -rw-r--r-- | lib/printf/printfcommon.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/printf/printfcommon.h b/lib/printf/printfcommon.h index 5c45520b4c..b3a7ca0c13 100644 --- a/lib/printf/printfcommon.h +++ b/lib/printf/printfcommon.h @@ -8,7 +8,7 @@ * Chris Torek. * * Copyright (c) 2011 The FreeBSD Foundation - * All rights reserved. + * * Portions of this software were developed by David Chisnall * under sponsorship from the FreeBSD Foundation. * @@ -35,8 +35,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ /* @@ -171,6 +169,13 @@ __ultoa(u_long val, CHAR *endp, int base, int octzero, const char *xdigs) } while (sval != 0); break; + case 2: + do { + *--cp = to_char(val & 1); + val >>= 1; + } while (val); + break; + case 8: do { *--cp = to_char(val & 7); @@ -221,6 +226,13 @@ __ujtoa(uintmax_t val, CHAR *endp, int base, int octzero, const char *xdigs) } while (sval != 0); break; + case 2: + do { + *--cp = to_char(val & 1); + val >>= 1; + } while (val); + break; + case 8: do { *--cp = to_char(val & 7); |
