ReactOS  0.4.14-dev-999-g61c8d34
utstrtoul64.c File Reference
#include "acpi.h"
#include "accommon.h"
Include dependency graph for utstrtoul64.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_UTILITIES
 

Functions

ACPI_STATUS AcpiUtStrtoul64 (char *String, UINT64 *ReturnValue)
 
UINT64 AcpiUtImplicitStrtoul64 (char *String)
 
UINT64 AcpiUtExplicitStrtoul64 (char *String)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_UTILITIES

Definition at line 48 of file utstrtoul64.c.

Function Documentation

◆ AcpiUtExplicitStrtoul64()

UINT64 AcpiUtExplicitStrtoul64 ( char String)

Definition at line 347 of file utstrtoul64.c.

349 {
350  UINT64 ConvertedInteger = 0;
351  UINT32 Base = 10; /* Default is decimal */
352 
353 
354  ACPI_FUNCTION_TRACE_STR (UtExplicitStrtoul64, String);
355 
356 
358  {
359  return_VALUE (0);
360  }
361 
362  /*
363  * Only Hex and Decimal are supported, as per the ACPI specification.
364  * A "0x" prefix indicates hex; otherwise decimal is assumed.
365  */
367  {
368  Base = 16;
369  }
370 
372  {
373  return_VALUE (0);
374  }
375 
376  /*
377  * Ignore overflow as per the ACPI specification. This is implemented by
378  * ignoring the return status from the conversion functions called below.
379  * On overflow, the input string is simply truncated.
380  */
381  switch (Base)
382  {
383  case 10:
384  default:
385  AcpiUtConvertDecimalString (String, &ConvertedInteger);
386  break;
387 
388  case 16:
389  AcpiUtConvertHexString (String, &ConvertedInteger);
390  break;
391  }
392 
393  return_VALUE (ConvertedInteger);
394 }
#define return_VALUE(s)
Definition: acoutput.h:499
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2374
static WCHAR String[]
Definition: stringtable.c:55
unsigned int UINT32
ACPI_STATUS AcpiUtConvertHexString(char *String, UINT64 *ReturnValuePtr)
Definition: utstrsuppt.c:202
ACPI_STATUS AcpiUtConvertDecimalString(char *String, UINT64 *ReturnValuePtr)
Definition: utstrsuppt.c:146
char AcpiUtRemoveLeadingZeros(char **String)
Definition: utstrsuppt.c:256
char AcpiUtRemoveWhitespace(char **String)
Definition: utstrsuppt.c:285
#define ACPI_FUNCTION_TRACE_STR(a, b)
Definition: acoutput.h:483
BOOLEAN AcpiUtDetectHexPrefix(char **String)
Definition: utstrsuppt.c:311
unsigned long long UINT64

Referenced by AcpiExConvertToInteger().

◆ AcpiUtImplicitStrtoul64()

UINT64 AcpiUtImplicitStrtoul64 ( char String)

Definition at line 259 of file utstrtoul64.c.

261 {
262  UINT64 ConvertedInteger = 0;
263 
264 
265  ACPI_FUNCTION_TRACE_STR (UtImplicitStrtoul64, String);
266 
267 
269  {
270  return_VALUE (0);
271  }
272 
273  /*
274  * Per the ACPI specification, only hexadecimal is supported for
275  * implicit conversions, and the "0x" prefix is "not allowed".
276  * However, allow a "0x" prefix as an ACPI extension.
277  */
279 
281  {
282  return_VALUE (0);
283  }
284 
285  /*
286  * Ignore overflow as per the ACPI specification. This is implemented by
287  * ignoring the return status from the conversion function called below.
288  * On overflow, the input string is simply truncated.
289  */
290  AcpiUtConvertHexString (String, &ConvertedInteger);
291  return_VALUE (ConvertedInteger);
292 }
#define return_VALUE(s)
Definition: acoutput.h:499
static WCHAR String[]
Definition: stringtable.c:55
ACPI_STATUS AcpiUtConvertHexString(char *String, UINT64 *ReturnValuePtr)
Definition: utstrsuppt.c:202
char AcpiUtRemoveLeadingZeros(char **String)
Definition: utstrsuppt.c:256
void AcpiUtRemoveHexPrefix(char **String)
Definition: utstrsuppt.c:339
char AcpiUtRemoveWhitespace(char **String)
Definition: utstrsuppt.c:285
#define ACPI_FUNCTION_TRACE_STR(a, b)
Definition: acoutput.h:483
unsigned long long UINT64

Referenced by AcpiExConvertToInteger().

◆ AcpiUtStrtoul64()

ACPI_STATUS AcpiUtStrtoul64 ( char String,
UINT64 ReturnValue 
)

Definition at line 121 of file utstrtoul64.c.

124 {
126  UINT8 OriginalBitWidth;
127  UINT32 Base = 10; /* Default is decimal */
128 
129 
130  ACPI_FUNCTION_TRACE_STR (UtStrtoul64, String);
131 
132 
133  *ReturnValue = 0;
134 
135  /* A NULL return string returns a value of zero */
136 
137  if (*String == 0)
138  {
140  }
141 
143  {
145  }
146 
147  /*
148  * 1) Check for a hex constant. A "0x" prefix indicates base 16.
149  */
151  {
152  Base = 16;
153  }
154 
155  /*
156  * 2) Check for an octal constant, defined to be a leading zero
157  * followed by sequence of octal digits (0-7)
158  */
159  else if (AcpiUtDetectOctalPrefix (&String))
160  {
161  Base = 8;
162  }
163 
165  {
166  return_ACPI_STATUS (AE_OK); /* Return value 0 */
167  }
168 
169  /*
170  * Force a full 64-bit conversion. The caller (usually iASL) must
171  * check for a 32-bit overflow later as necessary (If current mode
172  * is 32-bit, meaning a 32-bit DSDT).
173  */
174  OriginalBitWidth = AcpiGbl_IntegerBitWidth;
175  AcpiGbl_IntegerBitWidth = 64;
176 
177  /*
178  * Perform the base 8, 10, or 16 conversion. A 64-bit numeric overflow
179  * will return an exception (to allow iASL to flag the statement).
180  */
181  switch (Base)
182  {
183  case 8:
185  break;
186 
187  case 10:
189  break;
190 
191  case 16:
192  default:
194  break;
195  }
196 
197  /* Only possible exception from above is a 64-bit overflow */
198 
199  AcpiGbl_IntegerBitWidth = OriginalBitWidth;
201 }
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2374
static WCHAR String[]
Definition: stringtable.c:55
UINT32 ACPI_STATUS
Definition: actypes.h:460
ACPI_STATUS AcpiUtConvertOctalString(char *String, UINT64 *ReturnValue)
Definition: utstrsuppt.c:90
UINT32 void void ** ReturnValue
Definition: acevents.h:214
unsigned int UINT32
ACPI_STATUS AcpiUtConvertHexString(char *String, UINT64 *ReturnValuePtr)
Definition: utstrsuppt.c:202
ACPI_STATUS AcpiUtConvertDecimalString(char *String, UINT64 *ReturnValuePtr)
Definition: utstrsuppt.c:146
char AcpiUtRemoveLeadingZeros(char **String)
Definition: utstrsuppt.c:256
Status
Definition: gdiplustypes.h:24
BOOLEAN AcpiUtDetectOctalPrefix(char **String)
Definition: utstrsuppt.c:364
char AcpiUtRemoveWhitespace(char **String)
Definition: utstrsuppt.c:285
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE_STR(a, b)
Definition: acoutput.h:483
BOOLEAN AcpiUtDetectHexPrefix(char **String)
Definition: utstrsuppt.c:311
unsigned char UINT8
#define AE_OK
Definition: acexcep.h:97

Referenced by AcpiNsConvertToInteger().