formatting source-code for 2829b58c98

This commit is contained in:
github-actions 2020-05-29 20:25:52 +00:00
parent 2829b58c98
commit 6eeeaf3337
3 changed files with 13 additions and 12 deletions

View File

@ -5,12 +5,12 @@ uint32_t reverseBits(uint32_t n)
uint i;
for (i = 0; i < TotalBits; i++)
{
if ((n &
(UINT32_C(1)
<< i))) // if the bit on the ith position of 32 bit input is 1,
// then proceed Further note the use of UINT32_C to convert
// 1 to unsigned 32 bit int, since just 1 is treated as int
// which cannot be shifted left more than 30 times
if ((n & (UINT32_C(1)
<< i))) // if the bit on the ith position of 32 bit input is
// 1, then proceed Further note the use of UINT32_C to
// convert 1 to unsigned 32 bit int, since just 1 is
// treated as int which cannot be shifted left more
// than 30 times
reverse_int =
reverse_int |
(UINT32_C(1)

View File

@ -4,11 +4,12 @@ int hammingWeight(uint32_t n)
int i, weight = 0;
for (i = 0; i < TotalBits; i++)
{
if (n & (UINT32_C(1)
<< i)) // if the bit on the ith position of 32 bit input is 1,
// then proceed Further note the use of UINT32_C to
// convert 1 to unsigned 32 bit int, as just 1 is treated
// as int which cannot be shifted left more than 30 times
if (n &
(UINT32_C(1)
<< i)) // if the bit on the ith position of 32 bit input is 1,
// then proceed Further note the use of UINT32_C to
// convert 1 to unsigned 32 bit int, as just 1 is treated
// as int which cannot be shifted left more than 30 times
weight += 1;
}
return weight;

View File

@ -7,7 +7,7 @@ int findComplement(int num)
// standard size in memory, we cannot rely on size for that information.
TotalBits++; // increment TotalBits till temp becomes 0
temp >>= 1; // shift temp right by 1 bit every iteration; temp loses 1
// bit to underflow every iteration till it becomes 0
// bit to underflow every iteration till it becomes 0
}
int i,
flipNumber =