aboutsummaryrefslogtreecommitdiffstats
path: root/vala/sha3sum.vala
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-04-16 04:39:22 +0200
committerMattias Andrée <maandree@operamail.com>2013-04-16 04:39:22 +0200
commitb38b4250dde0cc761edc28508aeea35ffe0f03f9 (patch)
tree87650a24e61e8b927580ddd63c96050d1bde97aa /vala/sha3sum.vala
parentfix binary logarithm (diff)
downloadsha3sum-b38b4250dde0cc761edc28508aeea35ffe0f03f9.tar.gz
sha3sum-b38b4250dde0cc761edc28508aeea35ffe0f03f9.tar.bz2
sha3sum-b38b4250dde0cc761edc28508aeea35ffe0f03f9.tar.xz
forgot to fix lb for vala
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'vala/sha3sum.vala')
-rw-r--r--vala/sha3sum.vala10
1 files changed, 6 insertions, 4 deletions
diff --git a/vala/sha3sum.vala b/vala/sha3sum.vala
index 87ffc30..c42d6d5 100644
--- a/vala/sha3sum.vala
+++ b/vala/sha3sum.vala
@@ -184,10 +184,12 @@ class SHA3 : Object
*/
private int lb(int x)
{
- return (((x & 0xFF00) == 0 ? 0 : 8) +
- ((x & 0xF0F0) == 0 ? 0 : 4)) +
- (((x & 0xCCCC) == 0 ? 0 : 2) +
- ((x & 0xAAAA) == 0 ? 0 : 1));
+ int rc = 0;
+ if ((x & 0xFF00) != 0) { rc += 8; x >>= 8; }
+ if ((x & 0x00F0) != 0) { rc += 4; x >>= 4; }
+ if ((x & 0x000C) != 0) { rc += 2; x >>= 2; }
+ if ((x & 0x0002) != 0) rc += 1;
+ return rc;
}
/**