/* inttostr.h -- convert integers to printable strings12Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.34This program is free software; you can redistribute it and/or modify5it under the terms of the GNU General Public License as published by6the Free Software Foundation; either version 2, or (at your option)7any later version.89This program is distributed in the hope that it will be useful,10but WITHOUT ANY WARRANTY; without even the implied warranty of11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12GNU General Public License for more details.1314You should have received a copy of the GNU General Public License15along with this program; if not, write to the Free Software Foundation,16Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */1718/* Written by Paul Eggert */1920#if HAVE_CONFIG_H21# include <config.h>22#endif2324#if HAVE_INTTYPES_H25# include <inttypes.h>26#endif27#if HAVE_STDINT_H28# include <stdint.h>29#endif3031#include <limits.h>3233#if HAVE_SYS_TYPES_H34# include <sys/types.h>35#endif3637/* Upper bound on the string length of an integer converted to string.38302 / 1000 is ceil (log10 (2.0)). Subtract 1 for the sign bit;39add 1 for integer division truncation; add 1 more for a minus sign. */40#define INT_STRLEN_BOUND(t) ((sizeof (t) * CHAR_BIT - 1) * 302 / 1000 + 2)4142#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1)4344char *offtostr (off_t, char *);45char *imaxtostr (intmax_t, char *);46char *umaxtostr (uintmax_t, char *);474849