Beispiel #1
0
    def final(self):
        """ Return final CRC value.

            Return:
                int: final CRC value
        """
        crc = self._value
        if self._reflect_output:
            crc = reflectbitorder(self._width, crc)
        crc ^= self._xor_output
        return crc
Beispiel #2
0
def test_2():
    assert reflectbitorder(16, 0x8000) == 0x0001
Beispiel #3
0
def expect(w, v, e):
    assert reflectbitorder(w, v) == e
Beispiel #4
0
def test_8():
    assert reflectbitorder(0, 0) == 0
Beispiel #5
0
def test_1():
    assert reflectbitorder(8, 0x80) == 0x01
Beispiel #6
0
def test_7():
    assert reflectbitorder(3, 0b110) == 0b011
Beispiel #7
0
def test_5():
    assert reflectbitorder(65, 0x1) == (1 << 64)
Beispiel #8
0
def test_4():
    assert reflectbitorder(80, (1 << 79)) == 0x01
Beispiel #9
0
def test_3():
    assert reflectbitorder(8, 0x81) == 0x81