<top level>
[deliverable/binutils-gdb.git] / libiberty / hex.c
index 5f8229253494de21455e83b86766ca9e5002de11..f425509be75c0d510addeb7f3c9578c30a5800e1 100644 (file)
@@ -39,13 +39,19 @@ or zero if it is not.  Note that the value you pass will be cast to
 
 @end deftypefn
 
-@deftypefn Extension int hex_value (int @var{c})
+@deftypefn Extension unsigned int hex_value (int @var{c})
 
 Returns the numeric equivalent of the given character when interpreted
 as a hexidecimal digit.  The result is undefined if you pass an
 invalid hex digit.  Note that the value you pass will be cast to
 @code{unsigned char} within the macro.
 
+The @code{hex_value} macro returns @code{unsigned int}, rather than
+signed @code{int}, to make it easier to use in parsing addresses from
+hex dump files: a signed @code{int} would be sign-extended when
+converted to a wider unsigned type --- like @code{bfd_vma}, on some
+systems.
+
 @end deftypefn
 
 @undocumented _hex_array_size
@@ -60,7 +66,7 @@ invalid hex digit.  Note that the value you pass will be cast to
   && 'A' == 0x41 && 'a' == 0x61 && '!' == 0x21 \
   && EOF == -1
 
-const char _hex_value[_hex_array_size] =
+const unsigned char _hex_value[_hex_array_size] =
 {
   _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* NUL SOH STX ETX */
   _hex_bad, _hex_bad, _hex_bad, _hex_bad,   /* EOT ENQ ACK BEL */
@@ -139,7 +145,7 @@ const char _hex_value[_hex_array_size] =
 
 #else
 
-char _hex_value[_hex_array_size];
+unsigned char _hex_value[_hex_array_size];
 
 #endif /* not ASCII */
 
This page took 0.023538 seconds and 4 git commands to generate.