make buffer size a power of 2 and optimize
Merge pull request #840 from metamx/powers-of-2-buffers

make buffer size a power of 2 and optimize buffer lookup