From fdf650abd52c14bd1ce96489d4560d68f6c00f6f Mon Sep 17 00:00:00 2001 From: Lukas Lihotzki Date: Mon, 26 Apr 2021 18:48:54 +0200 Subject: [PATCH] refactor: avoid if-condition based on bit value --- lib/encryption/utils/key_verification.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/encryption/utils/key_verification.dart b/lib/encryption/utils/key_verification.dart index 5082829b..2d0df30e 100644 --- a/lib/encryption/utils/key_verification.dart +++ b/lib/encryption/utils/key_verification.dart @@ -84,9 +84,7 @@ List _bytesToInt(Uint8List bytes, int totalBits) { for (final byte in bytes) { for (final bit in [7, 6, 5, 4, 3, 2, 1, 0]) { numBits++; - if ((byte & (1 << bit)) > 0) { - current += 1 << (totalBits - numBits); - } + current |= ((byte >> bit) & 1) << (totalBits - numBits); if (numBits >= totalBits) { ret.add(current); current = 0;