Path: blob/master/libs/tomcrypt/src/encauth/ocb3/ocb3_int_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 ocb3_int_ntz.c11OCB implementation, INTERNAL ONLY helper, by Tom St Denis12*/13#include "tomcrypt.h"1415#ifdef LTC_OCB3_MODE1617/**18Returns the number of leading zero bits [from lsb up] (internal function)19@param x The 32-bit value to observe20@return The number of bits [from the lsb up] that are zero21*/22int ocb3_int_ntz(unsigned long x)23{24int c;25x &= 0xFFFFFFFFUL;26c = 0;27while ((x & 1) == 0) {28++c;29x >>= 1;30}31return c;32}3334#endif353637