Rhino.Kit.XDigitToInt C# (CSharp) Method

XDigitToInt() public static method

If character c is a hexadecimal digit, return accumulator * 16 plus corresponding number.
If character c is a hexadecimal digit, return accumulator * 16 plus corresponding number. Otherise return -1.
public static XDigitToInt ( int c, int accumulator ) : int
c int
accumulator int
return int
		public static int XDigitToInt(int c, int accumulator)
		{
			// Use 0..9 < A..Z < a..z
			if (c <= '9')
			{
				c -= '0';
				if (0 <= c)
				{
					goto check_break;
				}
			}
			else
			{
				if (c <= 'F')
				{
					if ('A' <= c)
					{
						c -= ('A' - 10);
						goto check_break;
					}
				}
				else
				{
					if (c <= 'f')
					{
						if ('a' <= c)
						{
							c -= ('a' - 10);
							goto check_break;
						}
					}
				}
			}
			return -1;
check_break: ;
			return (accumulator << 4) | c;
		}