Skip to content

Commit 37c299b

Browse files
authored
Merge pull request #19 from saxbophone/josh/improve-efm-decoder-lookup
Improve tastefulness of EFM decoder byte lookup
2 parents be6b131 + 9a9f47b commit 37c299b

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

dengr/eight_to_fourteen.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,10 @@ namespace {
8383
* When called with out-of-bounds indexes, it returns a 'null'
8484
* PresentByte
8585
*/
86-
const PresentByte& operator[](std::size_t i) const {
87-
/*
88-
* in this case, element #0 is our 'null' element since we know it's
89-
* empty, as EFM bit pattern 0 is not valid
90-
*/
86+
const PresentByte operator[](std::size_t i) const {
87+
// return indexed byte if not out of bounds, else 'null' byte
9188
return i < this->lookup_table.size() ? this->lookup_table[i]
92-
: this->lookup_table[0];
89+
: PresentByte(); // 'null'
9390
}
9491

9592
private:

0 commit comments

Comments
 (0)