Skip to content

Commit

Permalink
Fix off by one error in right justified data
Browse files Browse the repository at this point in the history
I was off by one in my starting index calculation, which
caused the index to be very huge when the slot size and
the data size were the same (unsigned int that was set to
a negative number when slot size == data size).
This also caused the parsed data to be off by one as well, so
this fixed an error in interpreting the right justified data
too.  I think I ran into this bug during development, but I
couldn't get the debugger to work (They have since improved the
documentation) and just decided to move on at the time since I couldn't
easily track down the root cause of the error.  Now that I was
able to get the debugger to work, it was pretty easy to see
what was going wrong and fix it.
  • Loading branch information
bitswype authored Oct 2, 2023
1 parent 17a0a69 commit 50c92a9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/TdmAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ void TdmAnalyzer::AnalyzeTdmSlot()
{
if( mSettings->mDataAlignment == TdmDataAlignment::RIGHT_ALIGNED )
{
starting_index = mSettings->mBitsPerSlot - mSettings->mDataBitsPerSlot - 1;
starting_index = mSettings->mBitsPerSlot - mSettings->mDataBitsPerSlot;
}
else // mSettings->mDataAlignment == TdmDataAlignment::LEFT_ALIGNED
{
Expand Down

0 comments on commit 50c92a9

Please sign in to comment.