Stephen said:
I am trying to figure out how to convert a BCD number to its decimal
equivilant.
One way (not necesarily optimal) is this:
using System;
class Test
{
public static void Main()
{
byte[] bcdNumber = { 0x12, 0x34, 0x56, 0x78 };
long result=0;
foreach (byte b in bcdNumber)
{
int digit1 = b >> 4;
int digit2 = b & 0x0f;
result = (result * 100) + digit1 * 10 + digit2;
}
Console.WriteLine("{0}", result); //12345678
}
}