Write a function to count the number of set bits (1s) in an integer. Optimize it for execution speed.