none
WHAT DOES THIS ALGORITHM MEAN ? RRS feed

  • Question

  • what does the following code means ? 

    i will appreciate you help. Thanks

    uint8_t gf_log(uint8_t x) 
    {
        uint8_t atb = 1, i = 0, z;
    
        do {
            if (atb == x) break;
            z = atb; atb <<= 1; if (z & 0x80) atb^= 0x1b; atb ^= z;
        } while (++i > 0);
    
        return i;
    }


    • Edited by Dr. Bean Wednesday, May 11, 2016 7:24 PM
    Wednesday, May 11, 2016 7:24 PM

Answers

  • It's an operation to determine the log over a gf(256) field. Galois fields (hence the fg) are the bread and butter of error correction math. Logs in discreet fields have mathematical properties similar to logs of real numbers but the operations are somewhat different and can seem strange. For instance 0x3+0x5 == 0x6 in gf(256), "addition" really being xor'ing.

    http://www.pclviewer.com/rs2/galois.html

    • Edited by vcangel Wednesday, May 11, 2016 10:43 PM
    • Proposed as answer by Baron Bi Thursday, May 12, 2016 8:06 AM
    • Marked as answer by Baron Bi Monday, May 23, 2016 8:35 AM
    Wednesday, May 11, 2016 10:42 PM