MCPcopy Create free account
hub / github.com/ElementsProject/lightning / count_trailing_zeroes

Function count_trailing_zeroes

wallet/wallet.c:1153–1166  ·  view source on GitHub ↗

TODO(cdecker) Stolen from shachain, move to some appropriate location */

Source from the content-addressed store, hash-verified

1151
1152/* TODO(cdecker) Stolen from shachain, move to some appropriate location */
1153static unsigned int count_trailing_zeroes(uint64_t index)
1154{
1155#if HAVE_BUILTIN_CTZLL
1156 return index ? (unsigned int)__builtin_ctzll(index) : SHACHAIN_BITS;
1157#else
1158 unsigned int i;
1159
1160 for (i = 0; i < SHACHAIN_BITS; i++) {
1161 if (index & (1ULL << i))
1162 break;
1163 }
1164 return i;
1165#endif
1166}
1167
1168static void wallet_stub_shachain_init(struct wallet *wallet,
1169 struct wallet_shachain *chain)

Callers 1

wallet_shachain_add_hashFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected