MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / get_next_bit

Function get_next_bit

extra/replace.c:788–807  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

786 /* Get next set bit from set. */
787
788static int get_next_bit(REP_SET *set,uint lastpos)
789{
790 uint pos,*start,*end,bits;
791
792 start=set->bits+ ((lastpos+1) / WORD_BIT);
793 end=set->bits + set->size_of_bits;
794 bits=start[0] & ~((1 << ((lastpos+1) % WORD_BIT)) -1);
795
796 while (! bits && ++start < end)
797 bits=start[0];
798 if (!bits)
799 return 0;
800 pos=(uint) (start-set->bits)*WORD_BIT;
801 while (! (bits & 1))
802 {
803 bits>>=1;
804 pos++;
805 }
806 return pos;
807}
808
809 /* find if there is a same set in sets. If there is, use it and
810 free given set, else put in given set in sets and return it's

Callers 1

init_replaceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected