sv_grow has this comment: * If the new size is a big power of two, don't bother: we assume the * caller wanted a nice 2^N sized block and will be annoyed at getting * 2^N+1 */ if (newlen & 0xff) newlen++; But 'newlen & 0xff' checks that it is not a multiple of 256, not that it is not a power of 2, so the chances of skipping COW are greater than they ought to be. Is there any easy and efficient way to check for powers of 2 in C? The only way I can think of offhand is to loop and shift, checking whether 'foo>>n == 1 && foo>>n<<n == foo'. Is it worth that?Thread Next