comparison libtomcrypt/src/encauth/ocb3/ocb3_int_ntz.c @ 1471:6dba84798cd5

Update to libtomcrypt 1.18.1, merged with Dropbear changes
author Matt Johnston <matt@ucc.asn.au>
date Fri, 09 Feb 2018 21:44:05 +0800
parents
children
comparison
equal deleted inserted replaced
1470:8bba51a55704 1471:6dba84798cd5
1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
2 *
3 * LibTomCrypt is a library that provides various cryptographic
4 * algorithms in a highly modular and flexible manner.
5 *
6 * The library is free for all purposes without any express
7 * guarantee it works.
8 */
9
10 /**
11 @file ocb3_int_ntz.c
12 OCB implementation, INTERNAL ONLY helper, by Tom St Denis
13 */
14 #include "tomcrypt.h"
15
16 #ifdef LTC_OCB3_MODE
17
18 /**
19 Returns the number of leading zero bits [from lsb up] (internal function)
20 @param x The 32-bit value to observe
21 @return The number of bits [from the lsb up] that are zero
22 */
23 int ocb3_int_ntz(unsigned long x)
24 {
25 int c;
26 x &= 0xFFFFFFFFUL;
27 c = 0;
28 while ((x & 1) == 0) {
29 ++c;
30 x >>= 1;
31 }
32 return c;
33 }
34
35 #endif
36
37 /* ref: $Format:%D$ */
38 /* git commit: $Format:%H$ */
39 /* commit time: $Format:%ai$ */