Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wine-mirror
GitHub Repository: wine-mirror/wine
Path: blob/master/libs/tomcrypt/src/encauth/ocb/ocb_ntz.c
5972 views
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 ocb_ntz.c
12
OCB implementation, internal function, by Tom St Denis
13
*/
14
15
#include "tomcrypt.h"
16
17
#ifdef LTC_OCB_MODE
18
19
/**
20
Returns the number of leading zero bits [from lsb up]
21
@param x The 32-bit value to observe
22
@return The number of bits [from the lsb up] that are zero
23
*/
24
int ocb_ntz(unsigned long x)
25
{
26
int c;
27
x &= 0xFFFFFFFFUL;
28
c = 0;
29
while ((x & 1) == 0) {
30
++c;
31
x >>= 1;
32
}
33
return c;
34
}
35
36
#endif
37
38