diff options
author | Sylvain Munaut <tnt@246tNt.com> | 2011-11-20 08:46:56 +0100 |
---|---|---|
committer | Sylvain Munaut <tnt@246tNt.com> | 2011-11-20 08:46:56 +0100 |
commit | ad4a6a884089a7dce55fefc8e0aaaa9985fd6b30 (patch) | |
tree | 9ec1cad6ae8fdde93c504d009f74dc196a3eee25 /src | |
parent | 17af41d9cddee9ba5f0b2edc4288e83470f8e3d7 (diff) |
gsm/a5: Bit faster way to compute parity ...
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gsm/a5.c | 5 |
1 files 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 |