Partial implementation of Ex.2-6 ("SetBits")