private static short asUnsignedUnit(int value) {
    if ((value & ~0xffff) != 0) {
      throw new IllegalArgumentException("bogus unsigned code unit");
    }

    return (short) value;
  }
Helper method that encodes any of the three-unit register-range formats.
android/android_framework/dex-maker/src/main/java/com/android/dx/io/instructions/InstructionCodec.java