LCOV - code coverage report
Current view: top level - gcc - wide-int-print.h (source / functions) Coverage Total Hit
Test: gcc.info Lines: 100.0 % 19 19
Test Date: 2024-04-27 14:03:13 Functions: 100.0 % 2 2
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : /* Print wide integers.
       2                 :             :    Copyright (C) 2013-2024 Free Software Foundation, Inc.
       3                 :             : 
       4                 :             : This file is part of GCC.
       5                 :             : 
       6                 :             : GCC is free software; you can redistribute it and/or modify it
       7                 :             : under the terms of the GNU General Public License as published by the
       8                 :             : Free Software Foundation; either version 3, or (at your option) any
       9                 :             : later version.
      10                 :             : 
      11                 :             : GCC is distributed in the hope that it will be useful, but WITHOUT
      12                 :             : ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      13                 :             : FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      14                 :             : for more details.
      15                 :             : 
      16                 :             : You should have received a copy of the GNU General Public License
      17                 :             : along with GCC; see the file COPYING3.  If not see
      18                 :             : <http://www.gnu.org/licenses/>.  */
      19                 :             : 
      20                 :             : #ifndef WIDE_INT_PRINT_H
      21                 :             : #define WIDE_INT_PRINT_H
      22                 :             : 
      23                 :             : #include <stdio.h>
      24                 :             : 
      25                 :             : #define WIDE_INT_PRINT_BUFFER_SIZE (WIDE_INT_MAX_INL_PRECISION / 4 + 4)
      26                 :             : 
      27                 :             : /* Printing functions.  */
      28                 :             : 
      29                 :             : extern void print_dec (const wide_int_ref &wi, char *buf, signop sgn);
      30                 :             : extern void print_dec (const wide_int_ref &wi, FILE *file, signop sgn);
      31                 :             : extern void print_decs (const wide_int_ref &wi, char *buf);
      32                 :             : extern void print_decs (const wide_int_ref &wi, FILE *file);
      33                 :             : extern void print_decu (const wide_int_ref &wi, char *buf);
      34                 :             : extern void print_decu (const wide_int_ref &wi, FILE *file);
      35                 :             : extern void print_hex (const wide_int_ref &wi, char *buf);
      36                 :             : extern void print_hex (const wide_int_ref &wi, FILE *file);
      37                 :             : extern void pp_wide_int_large (pretty_printer *, const wide_int_ref &, signop);
      38                 :             : 
      39                 :             : inline bool
      40                 :      366186 : print_dec_buf_size (const wide_int_ref &wi, signop sgn, unsigned int *len)
      41                 :             : {
      42                 :      366186 :   unsigned int l = wi.get_len ();
      43                 :      366186 :   if ((l != 1 || sgn == UNSIGNED) && wi::neg_p (wi))
      44                 :         377 :     l = WIDE_INT_MAX_HWIS (wi.get_precision ());
      45                 :      366186 :   l = l * HOST_BITS_PER_WIDE_INT / 3 + 3;
      46                 :      366186 :   *len = l;
      47                 :      366186 :   return UNLIKELY (l > WIDE_INT_PRINT_BUFFER_SIZE);
      48                 :             : }
      49                 :             : 
      50                 :             : inline bool
      51                 :        3987 : print_decs_buf_size (const wide_int_ref &wi, unsigned int *len)
      52                 :             : {
      53                 :        3987 :   return print_dec_buf_size (wi, SIGNED, len);
      54                 :             : }
      55                 :             : 
      56                 :             : inline bool
      57                 :       96218 : print_decu_buf_size (const wide_int_ref &wi, unsigned int *len)
      58                 :             : {
      59                 :       96218 :   return print_dec_buf_size (wi, UNSIGNED, len);
      60                 :             : }
      61                 :             : 
      62                 :             : inline bool
      63                 :      180501 : print_hex_buf_size (const wide_int_ref &wi, unsigned int *len)
      64                 :             : {
      65                 :      180501 :   unsigned int l;
      66                 :      180501 :   if (wi::neg_p (wi))
      67                 :       30678 :     l = WIDE_INT_MAX_HWIS (wi.get_precision ());
      68                 :             :   else
      69                 :      149823 :     l = wi.get_len ();
      70                 :      180501 :   l = l * HOST_BITS_PER_WIDE_INT / 4 + 4;
      71                 :      180501 :   *len = l;
      72                 :      180501 :   return UNLIKELY (l > WIDE_INT_PRINT_BUFFER_SIZE);
      73                 :             : }
      74                 :             : 
      75                 :             : #endif /* WIDE_INT_PRINT_H */
        

Generated by: LCOV version 2.1-beta

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto,rust,m2 --enable-host-shared. GCC test suite is run with the built compiler.