fast %in% for integers
bit_in(x, table, retFUN = as.bit)a boolean vector coerced to retFUN
determines the range of the integers and checks if the density justifies use
of a bit vector; if yes, maps x or table – whatever is smaller
– into a bit vector and searches the other of table or x in
the it vector; if no, falls back to %in%
bit_in(1:2, 2:3)
#> bit length=2 occupying only 1 int32
#> 1 2
#> FALSE TRUE
bit_in(1:2, 2:3, retFUN=as.logical)
#> [1] FALSE TRUE