Skip to content

Commit

Permalink
Merge pull request #587 from NordicSemiconductor/improvement/code
Browse files Browse the repository at this point in the history
Code optimization
  • Loading branch information
philips77 authored Sep 11, 2024
2 parents 090992e + b144130 commit 1eec99b
Showing 1 changed file with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,10 @@ class HeaderBasedPacketMerger: DataMerger {
if (index == 0) {
expectedSize = buffer.short.toInt()
}
if ((receivedDataSize-2) == expectedSize) {
ByteArray(buffer.remaining())
.apply { buffer.get(this) }
.also { output.write(it) }
.let { return true }
} else {
ByteArray(buffer.remaining())
.apply { buffer.get(this) }
.also { output.write(it) }
.let { return false }
}
ByteArray(buffer.remaining())
.apply { buffer.get(this) }
.also { output.write(it) }
return receivedDataSize - 2 == expectedSize
}

}

0 comments on commit 1eec99b

Please sign in to comment.