Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
821 B

  1. //=======================================================================
  2. //
  3. // Copyright (C) Microsoft Corporation, 1998 - 1999 All Rights Reserved.
  4. //
  5. // File: cruntime.cpp
  6. //
  7. // This file contains most commonly used string operation. ALl the setup project should link here
  8. // or add the common utility here to avoid duplicating code everywhere or using CRT runtime.
  9. //
  10. //=======================================================================
  11. #include "stdafx.h"
  12. #include "cruntime.h"
  13. #define ISHEXDIGIT(c) ((c >= '0' && c <= '9') || ((c&0xDF) >= 'A' && ((c&0xDF) <= 'F')))
  14. #define GETHEXDIGIT(c) ((c<'A') ? (c-0x30) : ((c&0xDF)-0x37))
  15. int atoh(const TCHAR *string)
  16. {
  17. int iValue = 0;
  18. while( ISHEXDIGIT(*string) )
  19. {
  20. iValue = (iValue << 4) + GETHEXDIGIT(*string);
  21. string++;
  22. }
  23. return iValue;
  24. }