FreeBSD/contrib/gcc/cp/mangle.c
/* Write out an integral CST in decimal. Most numbers are small, and
   representable in a HOST_WIDE_INT. Occasionally we'll have numbers
   bigger than that, which we must deal with.  */
Write out an integral CST in decimal. Most numbers are small, and
representable in a HOST_WIDE_INT. Occasionally we'll have numbers
bigger than that, which we must deal with.
Write out an integral CST in decimal . Most numbers are small and representable in a HOST_WIDE_INT . Occasionally we ' ll have numbers bigger than that which we must deal with .
static inline void
write_integer_cst (const tree cst)
{
  int sign = tree_int_cst_sgn (cst);
  if (TREE_INT_CST_HIGH (cst) + (sign < 0))
    {
      char buffer[sizeof (HOST_WIDE_INT) * 8 * 2];
      unsigned HOST_WIDE_INT chunk;
      unsigned chunk_digits;
      char *ptr = buffer + sizeof (buffer);
      unsigned count = 0;
      tree n, base, type;
      int done;
      chunk = 1000000000;
      chunk_digits = 9;
      if (sizeof (HOST_WIDE_INT) >= 8)
	{
	  chunk_digits = 18;
	  chunk *= chunk;
	}
      type = c_common_signed_or_unsigned_type (1, TREE_TYPE (cst));
      base = build_int_cstu (type, chunk);
      n = build_int_cst_wide (type,
			      TREE_INT_CST_LOW (cst), TREE_INT_CST_HIGH (cst));
      if (sign < 0)
	{
	  write_char ('n');
	  n = fold_build1 (NEGATE_EXPR, type, n);
	}
      do
	{
	  tree d = fold_build2 (FLOOR_DIV_EXPR, type, n, base);
	  tree tmp = fold_build2 (MULT_EXPR, type, d, base);
	  unsigned c;
	  done = integer_zerop (d);
	  tmp = fold_build2 (MINUS_EXPR, type, n, tmp);
	  c = hwint_to_ascii (TREE_INT_CST_LOW (tmp), 10, ptr,
			      done ? 1 : chunk_digits);
	  ptr -= c;
	  count += c;
	  n = d;
	}
      while (!done);
      write_chars (ptr, count);
    }
  else
    {
      unsigned HOST_WIDE_INT low = TREE_INT_CST_LOW (cst);
      if (sign < 0)
	{
	  write_char ('n');
	  low = -low;
	}
      write_unsigned_number (low);
    }
}
static inline void write_integer_cst ( const tree cst ) { int sign = tree_int_cst_sgn ( cst ) ; if ( TREE_INT_CST_HIGH ( cst ) + ( sign < 0 ) ) { char buffer [ sizeof ( HOST_WIDE_INT ) * 8 * 2 ] ; unsigned HOST_WIDE_INT chunk ; unsigned chunk_digits ; char * ptr = buffer + sizeof ( buffer ) ; unsigned count = 0 ; tree n , base , type ; int done ; chunk = 1000000000 ; chunk_digits = 9 ; if ( sizeof ( HOST_WIDE_INT ) >= 8 ) { chunk_digits = 18 ; chunk *= chunk ; } type = c_common_signed_or_unsigned_type ( 1 , TREE_TYPE ( cst ) ) ; base = build_int_cstu ( type , chunk ) ; n = build_int_cst_wide ( type , TREE_INT_CST_LOW ( cst ) , TREE_INT_CST_HIGH ( cst ) ) ; if ( sign < 0 ) { write_char ( ' ' ) ; n = fold_build1 ( NEGATE_EXPR , type , n ) ; } do { tree d = fold_build2 ( FLOOR_DIV_EXPR , type , n , base ) ; tree tmp = fold_build2 ( MULT_EXPR , type , d , base ) ; unsigned c ; done = integer_zerop ( d ) ; tmp = fold_build2 ( MINUS_EXPR , type , n , tmp ) ; c = hwint_to_ascii ( TREE_INT_CST_LOW ( tmp ) , 10 , ptr , done ? 1 : chunk_digits ) ; ptr -= c ; count += c ; n = d ; } while ( ! done ) ; write_chars ( ptr , count ) ; } else { unsigned HOST_WIDE_INT low = TREE_INT_CST_LOW ( cst ) ; if ( sign < 0 ) { write_char ( ' ' ) ; low = - low ; } write_unsigned_number ( low ) ; } }
Write out an integral CST in decimal.
Write out an integral CST in decimal .
/* A bignum. We do this in chunks, each of which fits in a
	 HOST_WIDE_INT.  */ /* HOST_WIDE_INT must be at least 32 bits, so 10^9 is
	 representable.  */ /* It is at least 64 bits, so 10^18 is representable.  */ /* A small num.  */