Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
philres committed Sep 13, 2016
2 parents a265c12 + f290525 commit d0d8b10
Show file tree
Hide file tree
Showing 3 changed files with 513 additions and 348 deletions.
43 changes: 33 additions & 10 deletions src/AlignmentMatrixFast.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,16 @@ class AlignmentMatrixFast {
MatrixElement * getElementEdit(int const x, int const y);


//FAST FUNCTIONS

//SAFE FUNCTIONS
inline MatrixElement * getElementUp(int const x, int const y)
{
//TODO: Make unnecessary w. loop unrolling
if (y < 0 || x < 0) {
/*if (y < 0 || x < 0) {
return &empty;
}*/

if (x < 0) {
return &empty;
}

if (x < lastCorridor.offset || x >= (lastCorridor.offset + lastCorridor.length)) {
return &empty;
}
Expand All @@ -104,31 +105,53 @@ class AlignmentMatrixFast {

inline MatrixElement * getElementCurr(int const x, int const y)
{
if (y < 0 || x < 0) {
/*if (y < 0 || x < 0) {
return &empty;
}
if (x < currentCorridor.offset || x >= (currentCorridor.offset + currentCorridor.length)) {
return &empty;
}*/
if (x < 0) {
return &empty;
}

return currentLine + (x - currentCorridor.offset);
}

inline MatrixElement * getElementEditCurr(int const x, int const y)
{
if (y < 0 || x < 0) {
/*if (y < 0 || x < 0) {
throw "";
}
if (x < currentCorridor.offset || x >= (currentCorridor.offset + currentCorridor.length)) {
throw "";
}
}*/

return currentLine + (x - currentCorridor.offset);
}

//END SAFE FUNCTIONS

//FAST FUNCTIONS
inline MatrixElement * getElementUpFast(int const x, int const y)
{
return lastLine + (x - lastCorridor.offset);
}

inline MatrixElement * getElementCurrFast(int const x, int const y)
{
return currentLine + (x - currentCorridor.offset);
}

inline MatrixElement * getElementEditCurrFast(int const x, int const y)
{
return currentLine + (x - currentCorridor.offset);
}

inline char * getDirectionCurr(int const x, int const y) {
inline char * getDirectionCurrFast(int const x, int const y) {
CorridorLine line = corridorLines[y];
return directionMatrix + line.offsetInMatrix + (x - line.offset);
}
Expand Down
Loading

0 comments on commit d0d8b10

Please sign in to comment.