Changeset 1391 for branches/GNU/src/gcc/libiberty/hex.c
- Timestamp:
- Apr 27, 2004, 8:39:34 PM (21 years ago)
- Location:
- branches/GNU/src/gcc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/gcc
- Property svn:ignore
-
old new 26 26 configure.vr 27 27 configure.vrs 28 dir.info 28 29 Makefile 29 dir.info30 30 lost+found 31 31 update.out
-
- Property svn:ignore
-
branches/GNU/src/gcc/libiberty/hex.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r1390 r1391 21 21 #include "libiberty.h" 22 22 23 /* Provided for ABI compatibility. */ 24 void 25 hex_init () 26 { 27 } 23 /* 24 25 @deftypefn Extension void hex_init (void) 26 27 Initializes the array mapping the current character set to 28 corresponding hex values. This function must be called before any 29 call to @code{hex_p} or @code{hex_value}. If you fail to call it, a 30 default ASCII-based table will normally be used on ASCII systems. 31 32 @end deftypefn 33 34 @deftypefn Extension int hex_p (int @var{c}) 35 36 Evaluates to non-zero if the given character is a valid hex character, 37 or zero if it is not. Note that the value you pass will be cast to 38 @code{unsigned char} within the macro. 39 40 @end deftypefn 41 42 @deftypefn Extension int hex_value (int @var{c}) 43 44 Returns the numeric equivalent of the given character when interpreted 45 as a hexidecimal digit. The result is undefined if you pass an 46 invalid hex digit. Note that the value you pass will be cast to 47 @code{unsigned char} within the macro. 48 49 @end deftypefn 50 51 @undocumented _hex_array_size 52 @undocumented _hex_bad 53 @undocumented _hex_value 54 55 */ 56 28 57 29 58 /* Are we ASCII? */ … … 107 136 _hex_bad, _hex_bad, _hex_bad, _hex_bad, 108 137 }; 138 #define HEX_TABLE_INITIALIZED 139 109 140 #else 110 #error "Unsupported host character set" 141 142 char _hex_value[_hex_array_size]; 143 111 144 #endif /* not ASCII */ 145 146 void 147 hex_init () 148 { 149 #ifndef HEX_TABLE_INITIALIZED 150 int i; 151 152 for (i=0; i<_hex_array_size; i++) 153 { 154 switch (i) 155 { 156 case '0': _hex_value[i] = 0; break; 157 case '1': _hex_value[i] = 1; break; 158 case '2': _hex_value[i] = 2; break; 159 case '3': _hex_value[i] = 3; break; 160 case '4': _hex_value[i] = 4; break; 161 case '5': _hex_value[i] = 5; break; 162 case '6': _hex_value[i] = 6; break; 163 case '7': _hex_value[i] = 7; break; 164 case '8': _hex_value[i] = 8; break; 165 case '9': _hex_value[i] = 9; break; 166 167 case 'a': case 'A': _hex_value[i] = 10; break; 168 case 'b': case 'B': _hex_value[i] = 11; break; 169 case 'c': case 'C': _hex_value[i] = 12; break; 170 case 'd': case 'D': _hex_value[i] = 13; break; 171 case 'e': case 'E': _hex_value[i] = 14; break; 172 case 'f': case 'F': _hex_value[i] = 15; break; 173 174 default: 175 _hex_value[i] = _hex_bad; 176 break; 177 } 178 } 179 #endif 180 } -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.