From ad4a6a884089a7dce55fefc8e0aaaa9985fd6b30 Mon Sep 17 00:00:00 2001 From: Sylvain Munaut Date: Sun, 20 Nov 2011 08:46:56 +0100 Subject: gsm/a5: Bit faster way to compute parity ... Signed-off-by: Sylvain Munaut --- src/gsm/a5.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gsm/a5.c b/src/gsm/a5.c index 36978c48..e330c759 100644 --- a/src/gsm/a5.c +++ b/src/gsm/a5.c @@ -104,9 +104,8 @@ _a5_12_parity(uint32_t x) x ^= x >> 16; x ^= x >> 8; x ^= x >> 4; - x ^= x >> 2; - x ^= x >> 1; - return x & 1; + x &= 0xf; + return (0x6996 >> x) & 1; } /*! \brief Compute majority bit from 3 taps -- cgit v1.2.3