Tweaked a few comments.

pull/62/head
Project Nayuki 5 years ago
parent b6aa563812
commit ee5e4ca121

@ -614,9 +614,9 @@ class QrCode(object):
return z return z
# Can only be called immediately after a white run is added, and
# returns either 0, 1, or 2. A helper function for _get_penalty_score().
def _finder_penalty_count_patterns(self, runhistory): def _finder_penalty_count_patterns(self, runhistory):
"""Can only be called immediately after a white run is added, and
returns either 0, 1, or 2. A helper function for _get_penalty_score()."""
n = runhistory[1] n = runhistory[1]
assert n <= self._size * 3 assert n <= self._size * 3
core = n > 0 and (runhistory[2] == runhistory[4] == runhistory[5] == n) and runhistory[3] == n * 3 core = n > 0 and (runhistory[2] == runhistory[4] == runhistory[5] == n) and runhistory[3] == n * 3
@ -624,8 +624,8 @@ class QrCode(object):
+ (1 if (core and runhistory[6] >= n * 4 and runhistory[0] >= n) else 0) + (1 if (core and runhistory[6] >= n * 4 and runhistory[0] >= n) else 0)
# Must be called at the end of a line (row or column) of modules. A helper function for _get_penalty_score().
def _finder_penalty_terminate_and_count(self, currentruncolor, currentrunlength, runhistory): def _finder_penalty_terminate_and_count(self, currentruncolor, currentrunlength, runhistory):
"""Must be called at the end of a line (row or column) of modules. A helper function for _get_penalty_score()."""
if currentruncolor: # Terminate black run if currentruncolor: # Terminate black run
runhistory.appendleft(currentrunlength) runhistory.appendleft(currentrunlength)
currentrunlength = 0 currentrunlength = 0

@ -814,8 +814,8 @@ impl QrCode {
} }
// Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result // Returns the product of the two given field elements modulo GF(2^8/0x11D).
// are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8. // All inputs are valid. This could be implemented as a 256*256 lookup table.
fn reed_solomon_multiply(x: u8, y: u8) -> u8 { fn reed_solomon_multiply(x: u8, y: u8) -> u8 {
// Russian peasant multiplication // Russian peasant multiplication
let mut z: u8 = 0; let mut z: u8 = 0;

Loading…
Cancel
Save