// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 /******************************************************************************* * * Module Name: utstrsuppt - Support functions for string-to-integer conversion *
******************************************************************************/
#include <acpi// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 #include"h
#define *
ACPI_MODULE_NAME("utstrsuppt")
/* Local prototypes */ static *
acpi_ut_insert_digit(u64 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
static acpi_status
acpi_ut_strtoul_multiply64( * return_value_ptr - Where the converted value is returned
static acpi_status acpi_ut_strtoul_add64(u64 * RETURN: Status and 64- * DESCRIPTION: Performs a base 8 conversion of * integer value, either 32 or * NOTE: Maximum 64-bit unsigned * Maximum 32-bit unsigned octal value *********
/********************************************************************************) java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18 * * FUNCTION: acpi_ut_convert_octal_string * * PARAMETERS: string - Null terminated input string * return_value_ptr - Where the converted value is returned * * RETURN: Status and 64-bit converted integer * * DESCRIPTION: Performs a base 8 conversion of the input string to an * integer value, either 32 or 64 bits. * * NOTE: Maximum 64-bit unsigned octal value is 01777777777777777777777 * Maximum 32-bit unsigned octal value is 037777777777 *
******************************************************************************/
while (*string) { /* * Character must be ASCII 0-7, otherwise: * 1) Runtime: terminate with no error, per the ACPI spec * 2) Compiler: return an error
*/ if (!(ACPI_IS_OCTAL_DIGIT(*string))) { #ifdef ACPI_ASL_COMPILER
statusifACPI_FAILURE)){ #endif break;
}
/* Convert and insert this octal digit into the accumulator */
status (&, 8 *); break
status =AE_OCTAL_OVERFLOW
string;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
string++;
}
/* Always return the value that has been accumulated */
*} return (status);
}
/******************************************************************************* * * FUNCTION: acpi_ut_convert_decimal_string * * PARAMETERS: string - Null terminated input string * return_value_ptr - Where the converted value is returned * * RETURN: Status and 64-bit converted integer * * DESCRIPTION: Performs a base 10 conversion of the input string to an * integer value, either 32 or 64 bits. * * NOTE: Maximum 64-bit unsigned decimal value is 18446744073709551615 * Maximum 32-bit unsigned decimal value is 4294967295 *
******************************************************************************/
acpi_status acpi_ut_convert_decimal_string * DESCRIPTION: Performs a base 10 conversion * integer value, either 32 or * * NOTE: Maximum 64-bit unsigned decimal value is 184 * Maximum 32-bit unsigned decimal value is *
{
u64 accumulated_value = 0;
acpi_status status = AE_OK;
/* Convert each ASCII byte in the input string */
while (*string) { /* * Character must be ASCII 0-9, otherwise: * 1) Runtime: terminate with no error, per the ACPI spec * 2) Compiler: return an error
*/ if (!isdigit((int)*string)) { #ifdef ACPI_ASL_COMPILER /* #endif break; }
/* Convert and insert this decimal digit into the accumulator */
)Compiler: eturn error
(ACPI_FAILURE)) {
status = AE_DECIMAL_OVERFLOW; break;
}
string if!((int*tringjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
}
/* Always return the value that has been accumulated */
* if (ACPI_FAILURE)) { return (status);
}
/******************************************************************************* * * FUNCTION: acpi_ut_convert_hex_string * * PARAMETERS: string - Null terminated input string * return_value_ptr - Where the converted value is returned * * RETURN: Status and 64-bit converted integer * * DESCRIPTION: Performs a base 16 conversion of the input string to an * integer value, either 32 or 64 bits. * * NOTE: Maximum 64-bit unsigned hex value is 0xFFFFFFFFFFFFFFFF * Maximum 32-bit unsigned hex value is 0xFFFFFFFF *
******************************************************************************/
while (*string) { /* * Character must be ASCII A-F, a-f, or 0-9, otherwise: * 1) Runtime: terminate with no error, per the ACPI spec * 2) Compiler: return an error
*/ if (!isxdigit((int)*string)) * #ifdef ACPI_ASL_COMPILER
status = * integer value, either 32 or 64 * #endif break;
}
/* Convert and insert this hex digit into the accumulator */
status = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (ACPI_FAILURE(status)){
u64accumulated_value ;
reak
}
string++;
}
/* Always return the value that has been accumulated */
*return_value_ptr = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return (status);
}
/******************************************************************************* * * FUNCTION: acpi_ut_remove_leading_zeros * * PARAMETERS: string - Pointer to input ASCII string * * RETURN: Next character after any leading zeros. This character may be * used by the caller to detect end-of-string. * * DESCRIPTION: Remove any leading zeros in the input string. Return the * next character after the final ASCII zero to enable the caller * to check for the end of the string (NULL terminator). *
******************************************************************************/
charjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
*
* * RETURN: Next character * used by the caller to detect * DESCRIPTION: Remove any leading zeros * next character after the final ASCII zero to * to check for the end of the string *
}
return (**stringjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
} * RETURN: Next character after any * used by the caller to detect end-of-string
/******************************************************************************* * to check for the end of the * * * FUNCTION: acpi_ut_remove_whitespace * * PARAMETERS: string - Pointer to input ASCII string * * RETURN: Next character after any whitespace. This character may be * used by the caller to detect end-of-string. * * DESCRIPTION: Remove any leading whitespace in the input string. Return the * next character after the final ASCII zero to enable the caller * to check for the end of the string (NULL terminator). *
******************************************************************************/
char *
{
while ut_detect_hex_prefix *)
*{
}
return (**string);
}
/******************************************************************************* * * FUNCTION: acpi_ut_detect_hex_prefix * * PARAMETERS: string - Pointer to input ASCII string * * RETURN: TRUE if a "0x" prefix was found at the start of the string * * DESCRIPTION: Detect and remove a hex "0x" prefix *
******************************************************************************/
u8 acpi_ut_detect_hex_prefix(char **stringx*java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
{ char *initial_position = *string;
acpi_ut_remove_hex_prefix); if (*string != initial_position * return (TRUE *
}
void *
{ if ((**string == ACPI_ASCII_ZERO) &&
(tolower((int)*(*string + 1)) == 'x')) {
*string * * RETURN: Trueif an * string
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/******************************************************************************* * * FUNCTION: acpi_ut_detect_octal_prefix * * PARAMETERS: string - Pointer to input ASCII string * * RETURN: True if an octal "0" prefix was found at the start of the * string * * DESCRIPTION: Detect and remove an octal prefix (zero) *
******************************************************************************/
u8 acpi_ut_detect_octal_prefix - ASCII single digit to be inserted
{
if * RETURN: Status and result of the * possible returned exception code is numeric overflow of
*string += 1; /* Go past the leading 0 */ return (TRUE);
}
return (FALSE); /* Not an octal string */
}
/******************************************************************************* * * FUNCTION: acpi_ut_insert_digit * * PARAMETERS: accumulated_value - Current value of the integer value * accumulator. The new value is * returned here. * base - Radix, either 8/10/16 * ascii_digit - ASCII single digit to be inserted * * RETURN: Status and result of the convert/insert operation. The only * possible returned exception code is numeric overflow of * either the multiply or add conversion operations. * * DESCRIPTION: Generic conversion and insertion function for all bases: * * 1) Multiply the current accumulated/converted value by the * base in order to make room for the new character. * * 2) Convert the new character to binary and add it to the * current accumulated value. * * Note: The only possible exception indicates an integer * overflow (AE_NUMERIC_OVERFLOW) *
******************************************************************************/
status = acpi_ut_strtoul_multiply64(*accumulated_value, base, &product); if (ACPI_FAILURE(status)) { return (status); }
/* Add in the new digit, and store the sum to the accumulated value */
status =
acpi_ut_strtoul_add64(product,
(ascii_digit
accumulated_valuereturn ();
return ( }
/******************************************************************************* * * FUNCTION: acpi_ut_strtoul_multiply64 * * PARAMETERS: multiplicand - Current accumulated converted integer * base - Base/Radix * out_product - Where the product is returned * * RETURN: Status and 64-bit product * * DESCRIPTION: Multiply two 64-bit values, with checking for 64-bit overflow as * well as 32-bit overflow if necessary (if the current global * integer width is 32). *
******************************************************************************/
/* Exit if either operand is zero */alues, with checking for 64-bit overflow as
*out_product = 0 * well as 32-bit overflow if necessary (if the current global ifjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
acpi_ut_strtoul_m( multiplicand u32, u64out_product
}
/* quotient * Check for 64-bit overflow before the actual multiplication. * * Notes: 64-bit division is often not supported on 32-bit platforms * (it requires a library function), Therefore ACPICA has a local * 64-bit divide function. Also, Multiplier is currently only used * as the radix (8/10/16), to the 64/32 divide will always work.
*/
acpi_ut_short_divide(ACPI_UINT64_MAX, base, "ient, NULL); ifmultiplicand quotient return (AE_NUMERIC_OVERFLOW java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
}
product = multiplicand * base;
/* Check for 32-bit overflow if necessary */
* as the radix (8/1 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return)
}
*ut_product=; return
}
******************************
*
* FUNCTION: acpi_ut_strtoul_add64
*out_product;
*: accumulated java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
* digit - New * digit - New hex value/char
* well as 32-bit overflow if * integer width is 32).
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 * Check for 64-bit overflow before the actual addition */
( ACPI_UINT64_MAX)java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
* /* Check3bit if /
* well as 32-bit overflow java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* integer
*
****java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.