char[] to hex string exercise

前端 未结 16 749
感情败类
感情败类 2021-01-12 19:14

Below is my current char* to hex string function. I wrote it as an exercise in bit manipulation. It takes ~7ms on a AMD Athlon MP 2800+ to hexify a 10 million byte array. Is

16条回答
  •  星月不相逢
    2021-01-12 19:50

    Consistently getting ~4ms on my Athlon 64 4200+ (~7ms with original code)

    for( const unsigned char* pChar = _pArray; pChar != pEnd; pChar++) {
        const char* pchars = _hex2asciiU_value[*pChar];
        *pszHex++ = *pchars++;
        *pszHex++ = *pchars;
    }
    

提交回复
热议问题