| 749 | } |
| 750 | |
| 751 | int poptBitsChk(poptBits bits, const char * s) |
| 752 | { |
| 753 | size_t ns = (s ? strlen(s) : 0); |
| 754 | uint32_t h0 = 0; |
| 755 | uint32_t h1 = 0; |
| 756 | int rc = 1; |
| 757 | |
| 758 | if (bits == NULL || ns == 0) |
| 759 | return POPT_ERROR_NULLARG; |
| 760 | |
| 761 | poptJlu32lpair(s, ns, &h0, &h1); |
| 762 | |
| 763 | for (ns = 0; ns < (size_t)_poptBitsK; ns++) { |
| 764 | uint32_t h = h0 + ns * h1; |
| 765 | uint32_t ix = (h % _poptBitsM); |
| 766 | if (PBM_ISSET(ix, bits)) |
| 767 | continue; |
| 768 | rc = 0; |
| 769 | break; |
| 770 | } |
| 771 | return rc; |
| 772 | } |
| 773 | |
| 774 | int poptBitsClr(poptBits bits) |
| 775 | { |