Re: [go-nuts] Hi, someone may help me converting this python code to GO

2016-07-10 Thread Michael Jones
Dan, i was guessing that the code was specifying a 16 bit integer for the running crc. That's why i am curious. On Jul 10, 2016 2:42 PM, "Jesper Louis Andersen" < jesper.louis.ander...@gmail.com> wrote: > > On Sun, Jul 10, 2016 at 5:07 AM, wrote: > >> def GetFormattedHex(intNum, lenOfHexString):

Re: [go-nuts] Hi, someone may help me converting this python code to GO

2016-07-10 Thread Jesper Louis Andersen
On Sun, Jul 10, 2016 at 5:07 AM, wrote: > def GetFormattedHex(intNum, lenOfHexString): > return format(intNum, "0" + str(lenOfHexString) + "x") > Where do you get stuck in the translation? It looks pretty straightforward. Build the table of constants, implement the loop in GetCrc16. Set up a tes

[go-nuts] Hi, someone may help me converting this python code to GO

2016-07-09 Thread eavinti
def GetCrc16(strHexData): crc16tab = ( 0x, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF, 0x8C48, 0x9DC1, 0xAF5A, 0xBED3, 0xCA6C, 0xDBE5, 0xE97E, 0xF8F7, 0x1081, 0x0108, 0x3393, 0x221A, 0x56A5, 0x472C, 0x75B7, 0x643E, 0x9CC9, 0x8D40, 0xBFDB, 0xAE52, 0xDAED, 0xCB64, 0xF9FF, 0xE876,