All pastes #1064647 Raw Edit

hexstr

public cpp v1 · immutable
#1064647 ·published 2008-07-07 14:27 UTC
rendered paste body
/*----------------------------------------------------------------------------*-Function:	hexstrParams:	string[] - String to convert to a number.Return:	value of the passed hex string.Notes:	--*----------------------------------------------------------------------------*/stock hexstr(string[]){	new		ret,		val,		i;	if (string[0] == '0' && (string[1] == 'x' || string[1] == 'X')) i = 2;	while (string[i])	{		ret <<= 4;		val = string[i++] - '0';		if (val > 0x09) val -= 0x07;		if (val > 0x0F) val -= 0x20;		if (val < 0x01) continue;		if (val < 0x10) ret += val;	}	return ret;}