Little-endian byte access
346605
function B2B_GET32(arr, i) {
    return (arr[i] ^
        (arr[i + 1] << 8) ^
        (arr[i + 2] << 16) ^
        (arr[i + 3] << 24));
}
148338
def intToBin(i):
    
    # devide in two parts (bytes)
    i1 = i % 256
    i2 = int(i / 256)
    # make string (little endian)
    return chr(i1) + chr(i2)
1025527
def append_little_endian32(self, unsigned_value):
        
        if not 0 <= unsigned_value <= wire_format.UINT32_MAX:
            raise errors.EncodeError(
                'Unsigned 32-bit out of range: %d' % unsigned_value)
        self.append_raw_bytes(struct.pack(
            wire_format.FORMAT_UINT32_LITTLE_ENDIAN, unsigned_value))
1247791
private int readIntLittleEndianPaddedOnBitWidth() throws IOException {
    switch (bytesWidth) {
      case 0:
        return 0;
      case 1:
        return in.read();
      case 2: {
        int ch2 = in.read();
        int ch1 = in.read();
        return (ch1 << 8) + ch2;
      }
      case 3: {
        int ch3 = in.read();
        int ch2 = in.read();
        int ch1 = in.read();
        return (ch1 << 16) + (ch2 << 8) + (ch3 << 0);
      }
      case 4: {
        return readIntLittleEndian();
      }
    }
    throw new RuntimeException("Unreachable");
  }
794431
public static void writeUnsignedShortLittleEndian(byte[] buffer, int offset, int value) {
		buffer[offset++] = (byte)(value & 0xFF);
		buffer[offset] = (byte)((value >> 8) & 0xFF);
	}
999467
def get_byte(self, index):
        
        pos = self.size() // 8 - 1 - index
        return self[pos * 8 + 7 : pos * 8]
807915
public static void writeUnsignedIntegerLittleEndian(byte[] buffer, int offset, long value) {
		buffer[offset++] = (byte)(value & 0xFF);
		buffer[offset++] = (byte)((value >> 8) & 0xFF);
		buffer[offset++] = (byte)((value >> 16) & 0xFF);
		buffer[offset] = (byte)((value >> 24) & 0xFF);
	}
209177
def parse_byte_range(byte_range, min_byte=0, max_byte=sys.maxint):
    

    if not byte_range:
        return min_byte, max_byte

    begin = byte_range[0] or min_byte
    end = byte_range[1] or max_byte

    if end < begin:
        raise ValueError("End before begin")

    if begin < min_byte:
        raise ValueError("Begin smaller than min")

    if end > max_byte:
        raise ValueError("End larger than max")

    return begin, end
274148
public final int strByteLengthNull(byte[]bytes, int p, int end) {
        int p_, start;
        p_ = start = 0;

        while (true) {
            if (bytes[p_] == 0) {
                int len = minLength();
                if (len == 1) return p_ - start;
                int q = p_ + 1;
                while (len > 1) {
                    if (q >= bytes.length) return p_ - start;
                    if (bytes[q] != 0) break;
                    q++;
                    len--;
                }
                if (len == 1) return p_ - start;
            }
            p_ += length(bytes, p_, end);
        }
    }
539954
public static long readLongLittleEndian(byte[] buffer, int offset) {
		long value;
		value = (buffer[offset] & 0xFF);
		value |= (buffer[offset + 1] & 0xFF) << 8;
		value |= (buffer[offset + 2] & 0xFF) << 16;
		value |= ((long)(buffer[offset + 3] & 0xFF)) << 24;
		value |= ((long)(buffer[offset + 4] & 0xFF)) << 32;
		value |= ((long)(buffer[offset + 5] & 0xFF)) << 40;
		value |= ((long)(buffer[offset + 6] & 0xFF)) << 48;
		value |= ((long)(buffer[offset + 7] & 0xFF)) << 56;
		return value;
	}
1153937
def endianSwapU16(bytes):
    """"""
    for b in range(0, len(bytes), 2):
        bytes[b], bytes[b + 1] = bytes[b + 1], bytes[b]
    return bytes
1046996
private long convertToLong(byte[] bin){
        ByteBuffer bb = ByteBuffer.wrap(bin);
        bb.order(ByteOrder.BIG_ENDIAN);
        return bb.getInt();
    }
1087224
function amf3decUI29(buf) {
    var val = 0;
    var len = 1;
    var b;

    do {
        b = buf.readUInt8(len++);
        val = (val << 7) + (b & 0x7F);
    } while (len < 5 || b > 0x7F);

    if (len == 5) val = val | b; // Preserve the major bit of the last byte

    return { len: len, value: val }
}
330734
private static final int mula_small(byte[] p,byte[] q,int m,byte[] x,int n,int z) {
		int v=0;
		for (int i=0;i<n;++i) {
			v+=(q[i+m] & 0xFF)+z*(x[i] & 0xFF);
			p[i+m]=(byte)v;
			v>>=8;
		}
		return v;		
	}
1146170
def intToBin(i):
    
    # divide in two parts (bytes)
    i1 = i % 256
    i2 = int(i / 256)
    # make string (little endian)
    return i.to_bytes(2, byteorder='little')
1259055
function writeInt32W(buffer, value, offset, isBigEndian, noAssert) {
  if (!noAssert) {
    assert.ok(value !== undefined && value !== null,
        'missing value');

    assert.ok(typeof (isBigEndian) === 'boolean',
        'missing or invalid endian');

    assert.ok(offset !== undefined && offset !== null,
        'missing offset');

    assert.ok(offset + 3 < buffer.length,
        'Trying to write beyond buffer length');

    verifsint(value, 0x7fffffff, -0x80000000);
  }

  if (value >= 0) {
    writeUInt32W(buffer, value, offset, isBigEndian, noAssert);
  } else {
    writeUInt32W(buffer, 0xffffffff + value + 1, offset, isBigEndian, noAssert);
  }
}
295521
public static void writeShortLittleEndian(byte[] buffer, int offset, short value) {
		buffer[offset++] = (byte)(value & 0xFF);
		buffer[offset] = (byte)((value >> 8) & 0xFF);
	}