sm: avoid invert id bits

Instead of using a 1 to indicate an ID is used and needing to invert
the bits to find the first 0 (unused bit), have avaiable IDs set to 1
and used IDs set to 0. Then we can avoid inverting the block to find
the first available bit.
sm: change put id to match previous commit