Roberto Bagnara <bagnara@cs.unipr.it> writes: > > unsigned long r = mpz_scan1(vec, ++position); > return (r == ULONG_MAX) ? -1 : r; > > However, last time I checked this was significantly slower. > I will re-check though. Might be due to function call overhead. Let us know if there's anything particularly poor coming out in scan1.c.