code: public void setRegister(final long registerIndex, final long value) {
          final long bitIndex = registerIndex * registerWidth;
          final int firstWordIndex = (int)(bitIndex >>> LOG2_BITS_PER_WORD)/*aka (bitIndex / BITS_PER_WORD)*/;
          final int secondWordIndex = (int)((bitIndex + registerWidth - 1) >>> LOG2_BITS_PER_WORD)/*see above*/;
          final int bitRemainder = (int)(bitIndex & BITS_PER_WORD_MASK)/*aka (bitIndex % BITS_PER_WORD)*/;
  
          final long words[] = this.words/*for convenience/performance*/;
          if(firstWordIndex == secondWordIndex) {
              // clear then set
              words[firstWordIndex] &= ~(registerMask << bitRemainder);
              words[firstWordIndex] |= (value << bitRemainder);
          } else {/*register spans words*/
              // clear then set each partial word
              words[firstWordIndex] &= (1L << bitRemainder) - 1;
              words[firstWordIndex] |= (value << bitRemainder);
  
              words[secondWordIndex] &= ~(registerMask >>> (BITS_PER_WORD - bitRemainder));
              words[secondWordIndex] |= (value >>> (BITS_PER_WORD - bitRemainder));
          }
      }
docs: NOTE:  if this changes then setMaxRegister() must change