Commit 5f3bad09 authored by Nathan/Eilisha Shiraini's avatar Nathan/Eilisha Shiraini
Browse files

Error corrections

parent 26c16f7d
......@@ -26,8 +26,8 @@ cdef class _GF(object):
self.__logtable[i] = 0
def __init__(self, wordsize, minlayers, maxlayers, polynomial):
if bool(minlayers == MODE_MESSAGE) != bool(maxlayers == MODE_MESSAGE):
raise ValueError("Cannot combine mode message and layer number bound")
if bool(minlayers < 0) or bool(maxlayers < 0) and minlayers != maxlayers:
raise ValueError("Cannot combine different special layer values: {} (min) and {} (max)".format(minlayers, maxlayers))
self.wordsize = wordsize
self.minlayers = minlayers
self.maxlayers = maxlayers
......@@ -152,7 +152,7 @@ cdef class _GF(object):
cpdef gen_rs_code(self, data, uint16_t n):
if len(data) + n > self.fieldsize:
raise ValueError("Message is too long (%i when max is 255)" % (len(data) + n))
raise ValueError("Message is too long (%i when max is %i)" % (len(data) + n, self.fieldsize - 1))
gen = self.generator(n)
_, code = self.poly_div(data + [0] * (len(gen)-1), gen)
return code
......
......@@ -3,7 +3,7 @@ from .reedsolomon import GalloisField
from . import positions
GALLOIS_FIELD_FOR_LAYERS = [GalloisField.getFieldForLayers(i).value for i in range(33)]
WORD_SIZE_FOR_LAYERS = [f.wordsize for f in GALLOIS_FIELDS_FOR_LAYERS]
WORD_SIZE_FOR_LAYERS = [f.wordsize for f in GALLOIS_FIELD_FOR_LAYERS]
COMPACT_TOTAL_BITS = [28] + [len(l) for l in positions.COMPACT_POS_LIST]
FULL_TOTAL_BITS = [40] + [len(l) for l in positions.FULL_POS_LIST]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment