Isn't it faster to create a lookuptable next to your array? The value in the array will be the key in the lookup table (hash) with the value 0 or 1.
"We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.