commit | ad4a6a884089a7dce55fefc8e0aaaa9985fd6b30 | [log] [tgz] |
---|---|---|
author | Sylvain Munaut <tnt@246tNt.com> | Sun Nov 20 08:46:56 2011 +0100 |
committer | Sylvain Munaut <tnt@246tNt.com> | Sun Nov 20 08:46:56 2011 +0100 |
tree | 9ec1cad6ae8fdde93c504d009f74dc196a3eee25 | |
parent | 17af41d9cddee9ba5f0b2edc4288e83470f8e3d7 [diff] [blame] |
gsm/a5: Bit faster way to compute parity ... Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
diff --git a/src/gsm/a5.c b/src/gsm/a5.c index 36978c4..e330c75 100644 --- a/src/gsm/a5.c +++ b/src/gsm/a5.c
@@ -104,9 +104,8 @@ 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