gdbtypes: return value from get_unsigned_type_max

Changes the signature of get_unsigned_type_max to return the computed
value rather than returning void and writing the value into a pointer
passed by the caller.

gdb/ChangeLog:

2021-07-30  George Barrett  <bob@bob131.so>

	* gdbtypes.h (get_unsigned_type_max): Change signature to
	return the result instead of accepting a pointer argument in
	which to store the result.
	* gdbtypes.c (get_unsigned_type_max): Likewise.
	* guile/scm-math.c (vlscm_convert_typed_number): Update caller
	of get_unsigned_type_max.
	(vlscm_integer_fits_p): Likewise.

Change-Id: Ibb1bf0c0fa181fac7853147dfde082a7d1ae2323
This commit is contained in:
George Barrett
2021-07-30 01:12:03 +10:00
committed by Simon Marchi
parent cd026728f3
commit c3c1e6459f
3 changed files with 8 additions and 12 deletions

View File

@ -1891,11 +1891,10 @@ lookup_struct_elt_type (struct type *type, const char *name, int noerr)
return NULL;
}
/* Store in *MAX the largest number representable by unsigned integer type
TYPE. */
/* Return the largest number representable by unsigned integer type TYPE. */
void
get_unsigned_type_max (struct type *type, ULONGEST *max)
ULONGEST
get_unsigned_type_max (struct type *type)
{
unsigned int n;
@ -1905,7 +1904,7 @@ get_unsigned_type_max (struct type *type, ULONGEST *max)
/* Written this way to avoid overflow. */
n = TYPE_LENGTH (type) * TARGET_CHAR_BIT;
*max = ((((ULONGEST) 1 << (n - 1)) - 1) << 1) | 1;
return ((((ULONGEST) 1 << (n - 1)) - 1) << 1) | 1;
}
/* Store in *MIN, *MAX the smallest and largest numbers representable by