Compares & pops top 2 operands out of the stack, and checks
        if the 1st operand <= 2nd operand (top of the stack).
        Pushes 0 if False, 1 if True.

        8 bit unsigned version
252
def _leu8(ins):
    
    output = _8bit_oper(ins.quad[2], ins.quad[3], reversed_=True)
    output.append('sub h')  # Carry if H > A
    output.append('ccf')  # Negates => Carry if H <= A
    output.append('sbc a, a')
    output.append('push af')

    return output
498402
function (a, b) {
    if (sjcl.bitArray.bitLength(a) !== sjcl.bitArray.bitLength(b)) {
      return false;
    }
    var x = 0, i;
    for (i=0; i<a.length; i++) {
      x |= a[i]^b[i];
    }
    return (x === 0);
  }
1166321
def _not16(ins):
    ''' 
    '''
    output = _16bit_oper(ins.quad[2])
    output.append('ld a, h')
    output.append('or l')
    output.append('sub 1')
    output.append('sbc a, a')
    output.append('push af')
    return output
384437
def count_overlap( bits1, bits2 ):
    
    b = BitSet( bits1.size )
    b |= bits1
    b &= bits2
    return b.count_range( 0, b.size )
898745
def un_priority(op,val):
  ""
  if isinstance(val,BinX) and val.op < op: return bin_priority(val.op,UnX(op,val.left),val.right)
  else: return UnX(op,val)
662315
public boolean pushWithLimit(E d, int maxSize) {
        StackNode<E> oldTop, newTop;

        newTop = new StackNode<E>(d);

        while (true) {
            oldTop = top.get();

            newTop.next = oldTop;
            if (oldTop != null) {
                newTop.index = oldTop.index + 1;
                if (newTop.index >= maxSize)
                    return false;
            } else {
                if (maxSize == 0)
                    return false;
                newTop.index = 0;
            }

            if (top.compareAndSet(oldTop, newTop))
                return true;
        }
    }
109473
def _neg8(ins):
    
    output = _8bit_oper(ins.quad[2])
    output.append('neg')
    output.append('push af')

    return output
915898
public static boolean checkSubtract(INDArray first, INDArray second, double maxRelativeDifference,
                    double minAbsDifference) {
        RealMatrix rmFirst = convertToApacheMatrix(first);
        RealMatrix rmSecond = convertToApacheMatrix(second);

        INDArray result = first.sub(second);
        RealMatrix rmResult = rmFirst.subtract(rmSecond);

        if (!checkShape(rmResult, result))
            return false;
        boolean ok = checkEntries(rmResult, result, maxRelativeDifference, minAbsDifference);
        if (!ok) {
            INDArray onCopies = Shape.toOffsetZeroCopy(first).sub(Shape.toOffsetZeroCopy(second));
            printFailureDetails(first, second, rmResult, result, onCopies, "sub");
        }
        return ok;
    }
380405
public int first()
    {
        for (int ii=0;ii<array.length;ii++)
        {
            if (array[ii] != 0)
            {
                for (int jj=ii*8;jj<bits;jj++)
                {
                    if (isSet(jj))
                    {
                        return jj;
                    }
                }
            }
        }
        return -1;
    }
811846
def assemble(io)
      operand = 0
      raise "invalid operand argument #{inspect}" unless (@first.is_a?(Array))
      @first.each do |r|
        raise "nil register in push, index #{r}- #{inspect}" if r.nil?
        operand = operand | (1 << reg_code(r))
      end
      val = operand
      val = val | (reg_code(@rn) <<             16)
      val = val | (is_pop <<              16 + 4) #20
      val = val | (1          <<          16 + 4 + 1)
      val = val | (@attributes[:update_status] <<  16 + 4 + 1 + 1)
      val = val | (up_down <<             16 + 4 + 1 + 1 + 1)
      val = val | (pre_post_index <<      16 + 4 + 1 + 1 + 1 + 1)#24
      val = val | instruction_code
      val = val | (cond <<                16 + 4 + 1 + 1 + 1 + 1 + 2 + 2)
      io.write_unsigned_int_32 val
    end
1108891
private static int compareNumeric(BitVector a, BitVector b) {
		final int aSize = a.size();
		final int bSize = b.size();
		if (aSize != bSize && !b.isAllZerosAdj(b.finish - bSize + aSize, b.finish)) return -1;
		// more optimizations are possible but probably not worthwhile
		if (a.isAligned() && b.isAligned()) {
			int pos = aSize & ~ADDRESS_MASK;
			if (pos != aSize) {
				int bits = aSize - pos;
				long aBits = a.getBitsAdj(pos, bits);
				long bBits = b.getBitsAdj(pos, bits);
				if (aBits != bBits) {
					return aBits < bBits ? -1 : 1;
				}
			}
			final long[] aArr = a.bits;
			final long[] bArr = b.bits;
			for (int i = (pos >> ADDRESS_BITS) - 1; i >= 0; i--) {
				long aBits = aArr[i];
				long bBits = bArr[i];
				if (aBits == bBits) continue;
				boolean aNeg = aBits < 0L;
				boolean bNeg = bBits < 0L;
				if (bNeg && !aNeg) return -1;
				if (aNeg && !bNeg) return 1;
				return aBits < bBits ? -1 : 1;
			}
			return 0;
		} else {
			final int aStart = a.start;
			final int bStart = b.start;
			int offset;
			for (offset = aSize - ADDRESS_SIZE; offset >= 0; offset -= ADDRESS_SIZE) {
				long aBits = a.getBitsAdj(offset + aStart, ADDRESS_SIZE);
				long bBits = b.getBitsAdj(offset + bStart, ADDRESS_SIZE);
				if (aBits == bBits) continue;
				boolean aNeg = aBits < 0L;
				boolean bNeg = bBits < 0L;
				if (bNeg && !aNeg) return -1;
				if (aNeg && !bNeg) return 1;
				return aBits < bBits ? -1 : 1;
			}
			if (offset != 0) {
				long aBits = a.getBitsAdj(aStart, ADDRESS_SIZE + offset);
				long bBits = b.getBitsAdj(bStart, ADDRESS_SIZE + offset);
				if (aBits == bBits) return 0;
				return aBits < bBits ? -1 : 1;
			}
			return 0;
		}
	}
330531
private static int compareLexical(BitVector a, BitVector b) {
		final int aSize = a.size();
		final int bSize = b.size();
		if (aSize == bSize) return compareNumeric(a, b); // more efficient
		final int size = Math.min(aSize, bSize);
		final int aStart = a.finish - size;
		final int bStart = b.finish - size;
		for (int i = size - 1; i >= 0; i--) {
			boolean aBit = a.getBitAdj(aStart + i);
			boolean bBit = b.getBitAdj(bStart + i);
			if (aBit != bBit) return bBit ? -1 : 1;
		}
		return aSize < bSize ? -1 : 1;
	}
607291
public static int unsignedDifference(ShortIterator set1, ShortIterator set2,
      final short[] buffer) {
    int pos = 0;
    if (!set2.hasNext()) {
      while (set1.hasNext()) {
        buffer[pos++] = set1.next();
      }
      return pos;
    }
    if (!set1.hasNext()) {
      return 0;
    }
    short v1 = set1.next();
    short v2 = set2.next();
    while (true) {
      if (toIntUnsigned(v1) < toIntUnsigned(v2)) {
        buffer[pos++] = v1;
        if (!set1.hasNext()) {
          return pos;
        }
        v1 = set1.next();
      } else if (v1 == v2) {
        if (!set1.hasNext()) {
          break;
        }
        if (!set2.hasNext()) {
          while (set1.hasNext()) {
            buffer[pos++] = set1.next();
          }
          return pos;
        }
        v1 = set1.next();
        v2 = set2.next();
      } else {// if (val1>val2)
        if (!set2.hasNext()) {
          buffer[pos++] = v1;
          while (set1.hasNext()) {
            buffer[pos++] = set1.next();
          }
          return pos;
        }
        v2 = set2.next();
      }
    }
    return pos;
  }
1284716
def is_top(self):
        
        return (self.stride == 1 and
                self.lower_bound == self._modular_add(self.upper_bound, 1, self.bits)
                )
606293
private static final int compareInt64AsUnsigned(long a, long b) {
        a += 0x8000000000000000L;
        b += 0x8000000000000000L;
        if(a < b) {
            return -1;
        } else if(a > b) {
            return 1;
        } else {
            return 0;
        }
    }
983003
public static final int compare(MemorySegment seg1, MemorySegment seg2, int offset1, int offset2, int len) {
		final byte[] b1 = seg1.memory;
		final byte[] b2 = seg2.memory;
		
		int val = 0;
		for (int pos = 0; pos < len && (val = (b1[offset1 + pos] & 0xff) - (b2[offset2 + pos] & 0xff)) == 0; pos++);
		return val;
	}
1274044
def _divu16(ins):
    ''' 
    '''
    op1, op2 = tuple(ins.quad[2:])
    if is_int(op1) and int(op1) == 0:  # 0 / A = 0
        if op2[0] in ('_', '$'):
            output = []  # Optimization: Discard previous op if not from the stack
        else:
            output = _16bit_oper(op2)  # Normalize stack

        output.append('ld hl, 0')
        output.append('push hl')
        return output

    if is_int(op2):
        op = int16(op2)
        output = _16bit_oper(op1)

        if op2 == 0:  # A * 0 = 0 * A = 0
            if op1[0] in ('_', '$'):
                output = []  # Optimization: Discard previous op if not from the stack
            output.append('ld hl, 0')
            output.append('push hl')
            return output

        if op == 1:
            output.append('push hl')
            return output

        if op == 2:
            output.append('srl h')
            output.append('rr l')
            output.append('push hl')
            return output

        output.append('ld de, %i' % op)
    else:
        if op2[0] == '_':  # Optimization when 2nd operand is an id
            rev = True
            op1, op2 = op2, op1
        else:
            rev = False
        output = _16bit_oper(op1, op2, rev)

    output.append('call __DIVU16')
    output.append('push hl')
    REQUIRES.add('div16.asm')
    return output