Pack 32 integers

@param in
source array
@param inpos
position in source array
@param out
output array
@param outpos
position in output array
@param bit
number of bits to use per integer
966832
public static void fastpack(final int[] in, final int inpos,
                final int[] out, final int outpos, final int bit) {
                switch (bit) {
                case 0:
                        fastpack0(in, inpos, out, outpos);
                        break;
                case 1:
                        fastpack1(in, inpos, out, outpos);
                        break;
                case 2:
                        fastpack2(in, inpos, out, outpos);
                        break;
                case 3:
                        fastpack3(in, inpos, out, outpos);
                        break;
                case 4:
                        fastpack4(in, inpos, out, outpos);
                        break;
                case 5:
                        fastpack5(in, inpos, out, outpos);
                        break;
                case 6:
                        fastpack6(in, inpos, out, outpos);
                        break;
                case 7:
                        fastpack7(in, inpos, out, outpos);
                        break;
                case 8:
                        fastpack8(in, inpos, out, outpos);
                        break;
                case 9:
                        fastpack9(in, inpos, out, outpos);
                        break;
                case 10:
                        fastpack10(in, inpos, out, outpos);
                        break;
                case 11:
                        fastpack11(in, inpos, out, outpos);
                        break;
                case 12:
                        fastpack12(in, inpos, out, outpos);
                        break;
                case 13:
                        fastpack13(in, inpos, out, outpos);
                        break;
                case 14:
                        fastpack14(in, inpos, out, outpos);
                        break;
                case 15:
                        fastpack15(in, inpos, out, outpos);
                        break;
                case 16:
                        fastpack16(in, inpos, out, outpos);
                        break;
                case 17:
                        fastpack17(in, inpos, out, outpos);
                        break;
                case 18:
                        fastpack18(in, inpos, out, outpos);
                        break;
                case 19:
                        fastpack19(in, inpos, out, outpos);
                        break;
                case 20:
                        fastpack20(in, inpos, out, outpos);
                        break;
                case 21:
                        fastpack21(in, inpos, out, outpos);
                        break;
                case 22:
                        fastpack22(in, inpos, out, outpos);
                        break;
                case 23:
                        fastpack23(in, inpos, out, outpos);
                        break;
                case 24:
                        fastpack24(in, inpos, out, outpos);
                        break;
                case 25:
                        fastpack25(in, inpos, out, outpos);
                        break;
                case 26:
                        fastpack26(in, inpos, out, outpos);
                        break;
                case 27:
                        fastpack27(in, inpos, out, outpos);
                        break;
                case 28:
                        fastpack28(in, inpos, out, outpos);
                        break;
                case 29:
                        fastpack29(in, inpos, out, outpos);
                        break;
                case 30:
                        fastpack30(in, inpos, out, outpos);
                        break;
                case 31:
                        fastpack31(in, inpos, out, outpos);
                        break;
                case 32:
                        fastpack32(in, inpos, out, outpos);
                        break;
                default:
                        throw new IllegalArgumentException(
                                "Unsupported bit width.");
                }
        }
1284485
static void int2bin(
	 int value,             /* input : decimal value */
	 int no_of_bits,        /* input : number of bits to use */
	 short[] bitstream, int bitstreams       /* output: bitstream  */
	)
	{
	   int pt_bitstream;
	   short   i, bit;

	   pt_bitstream = bitstreams + no_of_bits;

	   for (i = 0; i < no_of_bits; i++)
	   {
	     bit = (short)(value & 0x0001);      /* get lsb */
	     if (bit == 0)
	         bitstream[--pt_bitstream] = LD8KConstants.BIT_0;
	     else
	         bitstream[--pt_bitstream] = LD8KConstants.BIT_1;
	     value >>= 1;
	   }
	}
532099
static public void packInt(DataOutput out, int value) throws IOException {
       // Optimize for the common case where value is small. This is particular important where our caller
       // is SerializerBase.SER_STRING.serialize because most chars will be ASCII characters and hence in this range.
       // credit Max Bolingbroke https://github.com/jankotek/MapDB/pull/489

        int shift = (value & ~0x7F); //reuse variable
        if (shift != 0) {
            //$DELAY$
            shift = 31-Integer.numberOfLeadingZeros(value);
            shift -= shift%7; // round down to nearest multiple of 7
            while(shift!=0){
                out.writeByte((byte) ((value>>>shift) & 0x7F));
                //$DELAY$
                shift-=7;
            }
        }
        //$DELAY$
        out.writeByte((byte) ((value & 0x7F)|0x80));
    }
92451
private static void encode(final byte[] input, int inOffset, final int inLen,
            final byte[] output, int outOffset)
    {
        byte b0, b1, b2;
        final int remaining = inLen % 3, stop = inOffset + (inLen - remaining);
        while (inOffset < stop)
        {
            b0 = input[inOffset++];
            b1 = input[inOffset++];
            b2 = input[inOffset++];
            output[outOffset++] = nibble2code[(b0 >>> 2) & 0x3f];
            output[outOffset++] = nibble2code[(b0 << 4) & 0x3f | (b1 >>> 4) & 0x0f];
            output[outOffset++] = nibble2code[(b1 << 2) & 0x3f | (b2 >>> 6) & 0x03];
            output[outOffset++] = nibble2code[b2 & 077];
        }

        switch (remaining)
        {
            case 0:
                break;
            case 1:
                b0 = input[inOffset++];
                output[outOffset++] = nibble2code[(b0 >>> 2) & 0x3f];
                output[outOffset++] = nibble2code[(b0 << 4) & 0x3f];
                output[outOffset++] = pad;
                output[outOffset++] = pad;
                break;
            case 2:
                b0 = input[inOffset++];
                b1 = input[inOffset++];
                output[outOffset++] = nibble2code[(b0 >>> 2) & 0x3f];
                output[outOffset++] = nibble2code[(b0 << 4) & 0x3f | (b1 >>> 4) & 0x0f];
                output[outOffset++] = nibble2code[(b1 << 2) & 0x3f];
                output[outOffset++] = pad;
                break;

            default:
                throw new IllegalStateException("should not happen");
        }
    }
1368737
public static void encodeSingle(final byte[] input, final int inoff,
                                    final byte[] output, final int outoff) {

        if (input == null) {
            throw new NullPointerException("input");
        }

        if (inoff < 0) {
            throw new IllegalArgumentException("inoff(" + inoff + ") < 0");
        }

        if (inoff >= input.length) {
            throw new IllegalArgumentException(
                "inoff(" + inoff + ") >= input.length(" + input.length + ")");
        }

        encodeSingle(input[inoff], output, outoff);
    }
1367136
public static int decodeTo(final byte[] output, int outOffset,
            final byte[] input, int inOffset, final int inLen)
    {
        if (inLen == 0)
            return 0;

        if (inLen % 4 != 0)
            throw new IllegalArgumentException("Input block size is not 4");

        int withoutPaddingLen = inLen, limit = inOffset + inLen;
        while (input[--limit] == pad)
            withoutPaddingLen--;

        // Create result array of exact required size.
        final int outLen = ((withoutPaddingLen) * 3) / 4;
        assert (output.length - outOffset) >= outLen;

        decode(input, inOffset, inLen, output, outOffset, outLen);

        return outLen;
    }
1024300
private static final void cpy(long10 out, long10 in) {
		out._0=in._0;	out._1=in._1;
		out._2=in._2;	out._3=in._3;
		out._4=in._4;	out._5=in._5;
		out._6=in._6;	out._7=in._7;
		out._8=in._8;	out._9=in._9;		
	}
409457
public static int unpackInt(final byte[] array, final JBBPIntCounter position) {
    final int code = array[position.getAndIncrement()] & 0xFF;
    if (code < 0x80) {
      return code;
    }

    final int result;
    switch (code) {
      case 0x80: {
        result = ((array[position.getAndIncrement()] & 0xFF) << 8) | (array[position.getAndIncrement()] & 0xFF);
      }
      break;
      case 0x81: {
        result = ((array[position.getAndIncrement()] & 0xFF) << 24)
            | ((array[position.getAndIncrement()] & 0xFF) << 16)
            | ((array[position.getAndIncrement()] & 0xFF) << 8)
            | (array[position.getAndIncrement()] & 0xFF);
      }
      break;
      default:
        throw new IllegalArgumentException("Unsupported packed integer prefix [0x" + Integer.toHexString(code).toUpperCase(Locale.ENGLISH) + ']');
    }
    return result;
  }
459527
private void writeInts(int[] bytes, OutputStream outStream) throws IOException
   {
      for (int i = 0; i < bytes.length; i++)
      {
         byte curByte = (byte)bytes[i];
         outStream.write(curByte);
      }
   }
816484
public MessagePacker packInt(int r)
            throws IOException
    {
        if (r < -(1 << 5)) {
            if (r < -(1 << 15)) {
                writeByteAndInt(INT32, r);
            }
            else if (r < -(1 << 7)) {
                writeByteAndShort(INT16, (short) r);
            }
            else {
                writeByteAndByte(INT8, (byte) r);
            }
        }
        else if (r < (1 << 7)) {
            writeByte((byte) r);
        }
        else {
            if (r < (1 << 8)) {
                writeByteAndByte(UINT8, (byte) r);
            }
            else if (r < (1 << 16)) {
                writeByteAndShort(UINT16, (short) r);
            }
            else {
                // unsigned 32
                writeByteAndInt(UINT32, r);
            }
        }
        return this;
    }
1340319
private static void encodeInteger(ByteBuf out, int mask, int n, int i) {
        encodeInteger(out, mask, n, (long) i);
    }
18209
private int overlayBytes(byte[] data, int inOffset, int inLength, int inIndex) {
        int length = inLength;
        int offset = inOffset;
        int index = inIndex;
        WsByteBuffer buffer = this.parseBuffers[index];
        if (-1 == length) {
            length = data.length;
        }
        while (index <= this.parseIndex) {
            int remaining = buffer.remaining();
            if (remaining >= length) {
                // it all fits now
                buffer.put(data, offset, length);
                return index;
            }
            // put what we can, loop through the next buffer
            buffer.put(data, offset, remaining);
            offset += remaining;
            length -= remaining;
            buffer = this.parseBuffers[++index];
            buffer.position(0);
        }
        return index;
    }
781454
def _in(ins):
    
    output = _16bit_oper(ins.quad[1])
    output.append('ld b, h')
    output.append('ld c, l')
    output.append('in a, (c)')
    output.append('push af')

    return output
1083098
public static int estimatecompress(int[] in, int currentPos, int inlength) {
		int tmpoutpos = 0;
		int finalpos = currentPos + inlength;
		outer: while (currentPos < finalpos) {
			mainloop: for (int selector = 0; selector < 8; selector++) {

				int compressedNum = codeNum[selector];
				if (finalpos <= currentPos + compressedNum - 1)
					compressedNum = finalpos - currentPos;
				int b = bitLength[selector];
				int max = 1 << b;
				int i = 0;
				for (; i < compressedNum; i++)
					if (Util.smallerorequalthan(max , in[currentPos + i]))
						continue mainloop;
				currentPos += compressedNum;
				++tmpoutpos;
				continue outer;
			}
			final int selector = 8;
			if (in[currentPos] >= 1 << bitLength[selector])
				throw new RuntimeException("Too big a number");
			tmpoutpos++;
			currentPos++;

		}
		return tmpoutpos;
	}
568098
private static int pack7Oid(int input, byte[] out, int ooffset) {
        byte[] b = new byte[4];
        b[0] = (byte)(input >> 24);
        b[1] = (byte)(input >> 16);
        b[2] = (byte)(input >> 8);
        b[3] = (byte)(input);
        return pack7Oid(b, 0, 4, out, ooffset);
    }
431993
public static void fastpackwithoutmask(final int[] in, final int inpos,
                final int[] out, final int outpos, final int bit) {
                switch (bit) {
                case 0:
                        fastpackwithoutmask0(in, inpos, out, outpos);
                        break;
                case 1:
                        fastpackwithoutmask1(in, inpos, out, outpos);
                        break;
                case 2:
                        fastpackwithoutmask2(in, inpos, out, outpos);
                        break;
                case 3:
                        fastpackwithoutmask3(in, inpos, out, outpos);
                        break;
                case 4:
                        fastpackwithoutmask4(in, inpos, out, outpos);
                        break;
                case 5:
                        fastpackwithoutmask5(in, inpos, out, outpos);
                        break;
                case 6:
                        fastpackwithoutmask6(in, inpos, out, outpos);
                        break;
                case 7:
                        fastpackwithoutmask7(in, inpos, out, outpos);
                        break;
                case 8:
                        fastpackwithoutmask8(in, inpos, out, outpos);
                        break;
                case 9:
                        fastpackwithoutmask9(in, inpos, out, outpos);
                        break;
                case 10:
                        fastpackwithoutmask10(in, inpos, out, outpos);
                        break;
                case 11:
                        fastpackwithoutmask11(in, inpos, out, outpos);
                        break;
                case 12:
                        fastpackwithoutmask12(in, inpos, out, outpos);
                        break;
                case 13:
                        fastpackwithoutmask13(in, inpos, out, outpos);
                        break;
                case 14:
                        fastpackwithoutmask14(in, inpos, out, outpos);
                        break;
                case 15:
                        fastpackwithoutmask15(in, inpos, out, outpos);
                        break;
                case 16:
                        fastpackwithoutmask16(in, inpos, out, outpos);
                        break;
                case 17:
                        fastpackwithoutmask17(in, inpos, out, outpos);
                        break;
                case 18:
                        fastpackwithoutmask18(in, inpos, out, outpos);
                        break;
                case 19:
                        fastpackwithoutmask19(in, inpos, out, outpos);
                        break;
                case 20:
                        fastpackwithoutmask20(in, inpos, out, outpos);
                        break;
                case 21:
                        fastpackwithoutmask21(in, inpos, out, outpos);
                        break;
                case 22:
                        fastpackwithoutmask22(in, inpos, out, outpos);
                        break;
                case 23:
                        fastpackwithoutmask23(in, inpos, out, outpos);
                        break;
                case 24:
                        fastpackwithoutmask24(in, inpos, out, outpos);
                        break;
                case 25:
                        fastpackwithoutmask25(in, inpos, out, outpos);
                        break;
                case 26:
                        fastpackwithoutmask26(in, inpos, out, outpos);
                        break;
                case 27:
                        fastpackwithoutmask27(in, inpos, out, outpos);
                        break;
                case 28:
                        fastpackwithoutmask28(in, inpos, out, outpos);
                        break;
                case 29:
                        fastpackwithoutmask29(in, inpos, out, outpos);
                        break;
                case 30:
                        fastpackwithoutmask30(in, inpos, out, outpos);
                        break;
                case 31:
                        fastpackwithoutmask31(in, inpos, out, outpos);
                        break;
                case 32:
                        fastpackwithoutmask32(in, inpos, out, outpos);
                        break;
                default:
                        throw new IllegalArgumentException(
                                "Unsupported bit width.");
                }
        }
1238109
public void putByte(int pos, byte b) {
		adaptSize(pos + 1);
		ByteBuffer bb = getBuffer(pos);
		int i = pos % _bufferSize;
		bb.put(i, b);
	}