Addition of two binary arrays
491245
function binadd(bin1, bin2){
  var i1 = bin1.length;
  var i2 = bin2.length;
  var i3 = (i1 > i2) ? (i1 + 1) : (i2 + 1);
  var result = new Array(i3);
  var c = 0;
  // Add the two arrays as long as there exist elements in the arrays
  while((i1 > 0) && (i2 > 0)){
    i1--;
    i2--;
    i3--;
    if(bin1[i1]){c++;}
    if(bin2[i2]){c++;}
    result[i3] = (c%2) ? true : false;
    c >>= 1;
  }
  // copy the remaining elements
  if(i1){
    for(var i=0; i<i1; i++){result[i+1] = bin1[i];}
  }else{
    for(var i=0; i<i2; i++){result[i+1] = bin2[i];}
  }
  // add the remaining carry
  var carry = c ? true : false;
  while(c && (i3 > 1)){
    i3--;
    result[i3] = !result[i3];
    c = !result[i3];
  }
  // Return result with carry if necessary
  if (c==1){
    result[0] = true;
    return result;
  }else{
    return result.slice(1);
  }
}
1007072
function pow (a, b, c) {
		binary_arithmetic.call(this, a, b, c, '__pow', Math.pow);
	}
1331655
public void put(byte[] array, int offset, int length) {
		if(curr == null || curr.remaining()==0) {
			curr = ringGet();
			bbs.add(curr);
		}
		
		int len;
		while(length>0) {
			if((len=curr.remaining())>length) {
				curr.put(array,offset,length);
				length=0;
			} else {
//				System.out.println(new String(array));
				curr.put(array,offset,len);
				length-=len;
				offset+=len;
				curr = ringGet();
				bbs.add(curr);
			}
		}
	}
1191713
def mix(color1, color2, pos=0.5):
    
    opp_pos = 1 - pos

    red = color1[0] * pos + color2[0] * opp_pos
    green = color1[1] * pos + color2[1] * opp_pos
    blue = color1[2] * pos + color2[2] * opp_pos
    return int(red), int(green), int(blue)
1109191
public FDBigInt
    add( FDBigInt other ){
        int i;
        int a[], b[];
        int n, m;
        long c = 0L;
        // arrange such that a.nWords >= b.nWords;
        // n = a.nWords, m = b.nWords
        if ( this.nWords >= other.nWords ){
            a = this.data;
            n = this.nWords;
            b = other.data;
            m = other.nWords;
        } else {
            a = other.data;
            n = other.nWords;
            b = this.data;
            m = this.nWords;
        }
        int r[] = new int[ n ];
        for ( i = 0; i < n; i++ ){
            c += (long)a[i] & 0xffffffffL;
            if ( i < m ){
                c += (long)b[i] & 0xffffffffL;
            }
            r[i] = (int) c;
            c >>= 32; // signed shift.
        }
        if ( c != 0L ){
            // oops -- carry out -- need longer result.
            int s[] = new int[ r.length+1 ];
            System.arraycopy( r, 0, s, 0, r.length );
            s[i++] = (int)c;
            return new FDBigInt( s, i );
        }
        return new FDBigInt( r, i );
    }
46429
public static void addEquals( DMatrix2 a , DMatrix2 b ) {
        a.a1 += b.a1;
        a.a2 += b.a2;
    }
799320
synchronized int decodevs_add(float[] a, int offset, Buffer b, int n) {
        int step = n / dim;
        int entry;
        int i, j, o;

        if (t.length < step) {
            t = new int[step];
        }

        for (i = 0; i < step; i++) {
            entry = decode(b);
            if (entry == -1) {
                return (-1);
            }
            t[i] = entry * dim;
        }
        for (i = 0, o = 0; i < dim; i++, o += step) {
            for (j = 0; j < step; j++) {
                a[offset + o + j] += valuelist[t[j] + i];
            }
        }

        return (0);
    }
1329187
protected void fillArray(final short[] array) {
    int pos = 0;
    int base = 0;
    for (int k = 0; k < bitmap.length; ++k) {
      long bitset = bitmap[k];
      while (bitset != 0) {
        array[pos++] = (short) (base + numberOfTrailingZeros(bitset));
        bitset &= (bitset - 1);
      }
      base += 64;
    }
  }
760565
function mergeArray(a, b) {
  var adds = [];
  var ai = 0;

  for (var i = 0; i < b.length; i++) {
    if (('object' === type(a[i]) && 'object' === type(b[i]))
    ||  ('array' === type(a[i]) && 'array' === type(b[i]))) {
      a[i] = merge(a[i], b[i]);
    } else if ('object' === type(b[i])) {
      adds.push(merge({}, b[i]));
    } else if ('array' === type(b[i])) {
      adds.push(merge([], b[i]));
    } else if (!~a.indexOf(b[i])) {
      adds.push(b[i]);
    }
  }

  for (; ai < adds.length; ai++) {
    a.push(adds[ai]);
  }

  return a;
}
533367
public static void mult( double a[] , int offsetA ,
                             DMatrixSparseCSC B ,
                             double c[] , int offsetC )
    {
        if( a.length-offsetA < B.numRows)
            throw new IllegalArgumentException("Length of 'a' isn't long enough");
        if( c.length-offsetC < B.numCols)
            throw new IllegalArgumentException("Length of 'c' isn't long enough");

        for (int k = 0; k < B.numCols; k++) {
            int idx0 = B.col_idx[k  ];
            int idx1 = B.col_idx[k+1];

            double sum = 0;
            for (int indexB = idx0; indexB < idx1; indexB++) {
                sum += a[offsetA+B.nz_rows[indexB]]*B.nz_values[indexB];
            }
            c[offsetC+k] = sum;
        }
    }
1154384
function concatUint8Array(arrays) {
  if (arrays.length === 1) return arrays[0];

  let totalLength = 0;
  for (let i = 0; i < arrays.length; i++) {
    if (!isUint8Array(arrays[i])) {
      throw new Error('concatUint8Array: Data must be in the form of a Uint8Array');
    }

    totalLength += arrays[i].length;
  }

  const result = new Uint8Array(totalLength);
  let pos = 0;
  arrays.forEach(function (element) {
    result.set(element, pos);
    pos += element.length;
  });

  return result;
}
137653
public static byte[] append(byte[] a, byte[] b) {
        byte[] z = new byte[a.length + b.length];
        System.arraycopy(a, 0, z, 0, a.length);
        System.arraycopy(b, 0, z, a.length, b.length);
        return z;
    }
200812
function ADD64AA(v, a, b) {
    var o0 = v[a] + v[b];
    var o1 = v[a + 1] + v[b + 1];
    if (o0 >= 0x100000000) {
        o1++;
    }
    v[a] = o0;
    v[a + 1] = o1;
}
1124559
public int addValue(boolean[] array) {
        int val = hashCode();
        for (boolean b : array) {
            val = addValue(b);
        }
        return val;
    }
474607
def add(v1, v2):
    '''
    '''
    return tuple(a + b for a, b in zip(v1, v2))
538488
def add(self, b):
        
        new_bits = max(self.bits, b.bits)

        # TODO: Some improvements can be made here regarding the following case
        # TODO: SI<16>0xff[0x0, 0xff] + 3
        # TODO: In current implementation, it overflows, but it doesn't have to

        # optimization
        # case: SI<16>0xff[0x0, 0xff] + 3
        """
        if self.is_top and b.is_integer:
            si = self.copy()
            si.lower_bound = b.lower_bound
            return si
        elif b.is_top and self.is_integer:
            si = b.copy()
            si.lower_bound = self.lower_bound
            return si
        """
        #FIXME

        overflow = self._wrapped_overflow_add(self, b)
        if overflow:
            return StridedInterval.top(self.bits)

        lb = self._modular_add(self.lower_bound, b.lower_bound, new_bits)
        ub = self._modular_add(self.upper_bound, b.upper_bound, new_bits)

        # Is it initialized?
        uninitialized = self.uninitialized or b.uninitialized

        # Take the GCD of two operands' strides
        stride = fractions.gcd(self.stride, b.stride)

        return StridedInterval(bits=new_bits, stride=stride, lower_bound=lb, upper_bound=ub,
                               uninitialized=uninitialized).normalize()
341575
protected static void binaryToDef(GrayU8 binary , short[] desc ) {
		for (int i = 0; i < binary.data.length; i+=16) {
			int value = 0;
			for (int j = 0; j < 16; j++) {
				value |= binary.data[i+j] << j;
			}
			desc[i/16] = (short)value;
		}
	}