title: What does this expression calculate
body: <p>Suppose <strong>X</strong> and <strong>Y</strong> are two positive integers and <strong>Y</strong> is a power of two. Then what does this expression calculate?</p>
  
  <p><strong>(X+Y-1) &amp; ~(Y-1)</strong></p>
  
  <p>I found this expression appearing in certain c/c++ implementation of Memory Pool (<strong>X</strong> represents the object size in bytes and <strong>Y</strong> represents the alignment in bytes, the expression returns the block size in bytes fit for use in the Memory Pool).</p>