windows-nt/Source/XPSP1/NT/enduser/windows.com/winupd/wupdinfo/cruntime.cpp

30 lines
821 B
C++
Raw Normal View History

2020-09-26 03:20:57 -05:00
//=======================================================================
//
// Copyright (C) Microsoft Corporation, 1998 - 1999 All Rights Reserved.
//
// File: cruntime.cpp
//
// This file contains most commonly used string operation. ALl the setup project should link here
// or add the common utility here to avoid duplicating code everywhere or using CRT runtime.
//
//=======================================================================
#include "stdafx.h"
#include "cruntime.h"
#define ISHEXDIGIT(c) ((c >= '0' && c <= '9') || ((c&0xDF) >= 'A' && ((c&0xDF) <= 'F')))
#define GETHEXDIGIT(c) ((c<'A') ? (c-0x30) : ((c&0xDF)-0x37))
int atoh(const TCHAR *string)
{
int iValue = 0;
while( ISHEXDIGIT(*string) )
{
iValue = (iValue << 4) + GETHEXDIGIT(*string);
string++;
}
return iValue;
}