Path: blob/master/libs/tomcrypt/src/encauth/ocb/ocb_ntz.c
5972 views
/* LibTomCrypt, modular cryptographic library -- Tom St Denis1*2* LibTomCrypt is a library that provides various cryptographic3* algorithms in a highly modular and flexible manner.4*5* The library is free for all purposes without any express6* guarantee it works.7*/89/**10@file ocb_ntz.c11OCB implementation, internal function, by Tom St Denis12*/1314#include "tomcrypt.h"1516#ifdef LTC_OCB_MODE1718/**19Returns the number of leading zero bits [from lsb up]20@param x The 32-bit value to observe21@return The number of bits [from the lsb up] that are zero22*/23int ocb_ntz(unsigned long x)24{25int c;26x &= 0xFFFFFFFFUL;27c = 0;28while ((x & 1) == 0) {29++c;30x >>= 1;31}32return c;33}3435#endif363738