From b14413016d2c4e20b0ad8bcd3f40f5602d75a43a Mon Sep 17 00:00:00 2001 From: Aleksander Nowakowski Date: Wed, 11 Sep 2024 13:03:55 +0200 Subject: [PATCH] Code optimization --- .../ble/test/spec/HeaderBasedPacketMerger.kt | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/test/src/main/java/no/nordicsemi/andorid/ble/test/spec/HeaderBasedPacketMerger.kt b/test/src/main/java/no/nordicsemi/andorid/ble/test/spec/HeaderBasedPacketMerger.kt index f74272b0..993e363f 100644 --- a/test/src/main/java/no/nordicsemi/andorid/ble/test/spec/HeaderBasedPacketMerger.kt +++ b/test/src/main/java/no/nordicsemi/andorid/ble/test/spec/HeaderBasedPacketMerger.kt @@ -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 } } \ No newline at end of file