1 //------------------------------------------------------------------------------
2 // GB_code_string: convert a type code into a string
3 //------------------------------------------------------------------------------
4 
5 // SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
6 // SPDX-License-Identifier: Apache-2.0
7 
8 //------------------------------------------------------------------------------
9 
10 // Given GB_Type_code, return a string with the name of the type
11 
12 #include "GB.h"
13 
14 GB_PUBLIC   // accessed by the MATLAB tests in GraphBLAS/Test only
GB_code_string(const GB_Type_code code)15 char *GB_code_string            // return a static string for a type name
16 (
17     const GB_Type_code code     // code to convert to string
18 )
19 {
20 
21     switch (code)
22     {
23         case GB_BOOL_code   : return ("bool"        ) ;
24         case GB_INT8_code   : return ("int8_t"      ) ;
25         case GB_UINT8_code  : return ("uint8_t"     ) ;
26         case GB_INT16_code  : return ("int16_t"     ) ;
27         case GB_UINT16_code : return ("uint16_t"    ) ;
28         case GB_INT32_code  : return ("int32_t"     ) ;
29         case GB_UINT32_code : return ("uint32_t"    ) ;
30         case GB_INT64_code  : return ("int64_t"     ) ;
31         case GB_UINT64_code : return ("uint64_t"    ) ;
32         case GB_FP32_code   : return ("float"       ) ;
33         case GB_FP64_code   : return ("double"      ) ;
34         case GB_FC32_code   : return ("float complex" ) ;
35         case GB_FC64_code   : return ("double complex") ;
36         case GB_UDT_code    : return ("user-defined") ;
37         default             : return ("unknown!"    ) ;
38     }
39 }
40 
41