// sizeLessThan returns true if the node is less than a given size.
// This is an optimization to avoid calculating a large node when we only need
// to know if it fits inside a certain page size.
323255
func (n *node) sizeLessThan(v int) bool {
	sz, elsz := pageHeaderSize, n.pageElementSize()
	for i := 0; i < len(n.inodes); i++ {
		item := &n.inodes[i]
		sz += elsz + len(item.key) + len(item.value)
		if sz >= v {
			return false
		}
	}
	return true
}
113652
func (p *printer) nodeSize(n ast.Node, maxSize int) (size int) {
	// nodeSize invokes the printer, which may invoke nodeSize
	// recursively. For deep composite literal nests, this can
	// lead to an exponential algorithm. Remember previous
	// results to prune the recursion (was issue 1628).
	if size, found := p.nodeSizes[n]; found {
		return size
	}

	size = maxSize + 1 // assume n doesn't fit
	p.nodeSizes[n] = size

	// nodeSize computation must be independent of particular
	// style so that we always get the same decision; print
	// in RawFormat
	cfg := Config{Mode: RawFormat}
	var buf bytes.Buffer
	if _, err := cfg.fprint(&buf, p.fset, n, p.nodeSizes); err != nil {
		return
	}
	if buf.Len() <= maxSize {
		for _, ch := range buf.Bytes() {
			if ch < ' ' {
				return
			}
		}
		size = buf.Len() // n fits
		p.nodeSizes[n] = size
	}
	return
}
1137108
func (v Value) LessThanEq(w Value) bool {
	if v == w {
		return true
	}
	return v.LessThan(w)
}
587804
func (h *BindHandle) Size() int {
	size := 0
	for _, bindRecords := range h.bindInfo.Load().(cache) {
		size += len(bindRecords)
	}
	return size
}
1034259
func (bc *BlockChanges) SizeEstimate() uint64 {
	if bc.sizeEstimate == 0 {
		for _, op := range bc.Ops {
			numPtrs := len(op.Refs()) + len(op.Unrefs()) +
				2*len(op.allUpdates())
			bc.sizeEstimate +=
				uint64(numPtrs)*data.BPSize + op.SizeExceptUpdates()
		}
	}
	return bc.sizeEstimate
}
257824
func (s *ScrollService) Size(size int) *ScrollService {
	s.size = &size
	return s
}
1276052
func (b Box) IsBiggerThan(other Box) bool {
	return b.Top < other.Top ||
		b.Bottom > other.Bottom ||
		b.Left < other.Left ||
		b.Right > other.Right
}
856721
func (m memoizedMeasurable) Size() int {
	if m.size <= 0 {
		m.size = m.m.Size()
	}
	return m.size
}
753937
func (t *ImmutableTree) Size() int64 {
	if t.root == nil {
		return 0
	}
	return t.root.size
}
203093
func (t *ImmutableTree) nodeSize() int {
	size := 0
	t.root.traverse(t, true, func(n *Node) bool {
		size++
		return false
	})
	return size
}
1001365
func (p McGroupStatusAnsPayload) Size() int {
	var ansGroupMaskCount int
	for _, mask := range p.Status.AnsGroupMask {
		if mask {
			ansGroupMaskCount++
		}
	}

	return 1 + (5 * ansGroupMaskCount)
}
710009
func (c *Client) size(path string) (int64, error) {
	pconn, err := c.getIdleConn()
	if err != nil {
		return -1, err
	}

	defer c.returnConn(pconn)

	if !pconn.hasFeature("SIZE") {
		pconn.debug("server doesn't support SIZE")
		return -1, nil
	}

	if err = pconn.setType("I"); err != nil {
		return 0, err
	}

	code, msg, err := pconn.sendCommand("SIZE %s", path)
	if err != nil {
		return -1, err
	}

	if code != replyFileStatus {
		pconn.debug("unexpected SIZE response: %d (%s)", code, msg)
		return -1, nil
	}

	size, err := strconv.ParseInt(msg, 10, 64)
	if err != nil {
		pconn.debug(`failed parsing SIZE response "%s": %s`, msg, err)
		return -1, nil
	}

	return size, nil
}
619009
func opcodeLessThan(op *parsedOpcode, vm *Engine) error {
	v0, err := vm.dstack.PopInt()
	if err != nil {
		return err
	}

	v1, err := vm.dstack.PopInt()
	if err != nil {
		return err
	}

	if v1 < v0 {
		vm.dstack.PushInt(scriptNum(1))
	} else {
		vm.dstack.PushInt(scriptNum(0))
	}

	return nil
}
413948
func (tx *Tx) Size() int64 {
	return int64(tx.meta.pgid) * int64(tx.db.pageSize)
}
834886
func (c *ResTableConfig) IsBetterThan(o *ResTableConfig, r *ResTableConfig) bool {
	if r == nil {
		return c.IsMoreSpecificThan(o)
	}

	// nil ResTableConfig is never better than any ResTableConfig
	if c == nil {
		return false
	}
	if o == nil {
		return false
	}

	// imsi
	if c.Mcc != 0 || c.Mnc != 0 || o.Mcc != 0 || o.Mnc != 0 {
		if c.Mcc != o.Mcc && r.Mcc != 0 {
			return c.Mcc != 0
		}
		if c.Mnc != o.Mnc && r.Mnc != 0 {
			return c.Mnc != 0
		}
	}

	// locale
	if c.IsLocaleBetterThan(o, r) {
		return true
	}

	// screen layout
	if c.ScreenLayout != 0 || o.ScreenLayout != 0 {
		myLayoutdir := c.ScreenLayout & MaskLayoutDir
		oLayoutdir := o.ScreenLayout & MaskLayoutDir
		if (myLayoutdir^oLayoutdir) != 0 && (r.ScreenLayout&MaskLayoutDir) != 0 {
			return myLayoutdir > oLayoutdir
		}
	}

	// smallest screen width dp
	if c.SmallestScreenWidthDp != 0 || o.SmallestScreenWidthDp != 0 {
		if c.SmallestScreenWidthDp != o.SmallestScreenWidthDp {
			return c.SmallestScreenWidthDp > o.SmallestScreenWidthDp
		}
	}

	// screen size dp
	if c.ScreenWidthDp != 0 || c.ScreenHeightDp != 0 || o.ScreenWidthDp != 0 || o.ScreenHeightDp != 0 {
		myDelta := 0
		otherDelta := 0
		if r.ScreenWidthDp != 0 {
			myDelta += int(r.ScreenWidthDp) - int(c.ScreenWidthDp)
			otherDelta += int(r.ScreenWidthDp) - int(o.ScreenWidthDp)
		}
		if r.ScreenHeightDp != 0 {
			myDelta += int(r.ScreenHeightDp) - int(c.ScreenHeightDp)
			otherDelta += int(r.ScreenHeightDp) - int(o.ScreenHeightDp)
		}
		if myDelta != otherDelta {
			return myDelta < otherDelta
		}
	}

	// screen layout
	if c.ScreenLayout != 0 || o.ScreenLayout != 0 {
		mySL := c.ScreenLayout & MaskScreenSize
		oSL := o.ScreenLayout & MaskScreenSize
		if (mySL^oSL) != 0 && (r.ScreenLayout&MaskScreenSize) != 0 {
			fixedMySL := mySL
			fixedOSL := oSL
			if (r.ScreenLayout & MaskScreenSize) >= ScreenSizeNormal {
				if fixedMySL == 0 {
					fixedMySL = ScreenSizeNormal
				}
				if fixedOSL == 0 {
					fixedOSL = ScreenSizeNormal
				}
			}
			if fixedMySL == fixedOSL {
				return mySL != 0
			}
			return fixedMySL > fixedOSL
		}

		if ((c.ScreenLayout^o.ScreenLayout)&MaskScreenLong) != 0 &&
			(r.ScreenLayout&MaskScreenLong) != 0 {
			return (c.ScreenLayout & MaskScreenLong) != 0
		}
	}

	// orientation
	if c.Orientation != o.Orientation && r.Orientation != 0 {
		return c.Orientation != 0
	}

	// uimode
	if c.UIMode != 0 || o.UIMode != 0 {
		diff := c.UIMode ^ o.UIMode
		if (diff&MaskUIModeType) != 0 && (r.UIMode&MaskUIModeType) != 0 {
			return (c.UIMode & MaskUIModeType) != 0
		}
		if (diff&MaskUIModeNight) != 0 && (r.UIMode&MaskUIModeNight) != 0 {
			return (c.UIMode & MaskUIModeNight) != 0
		}
	}

	// screen type
	if c.Density != o.Density {
		h := int(c.Density)
		if h == 0 {
			h = 160
		}
		l := int(o.Density)
		if l == 0 {
			l = 160
		}
		blmBigger := true
		if l > h {
			h, l = l, h
			blmBigger = false
		}

		reqValue := int(r.Density)
		if reqValue == 0 {
			reqValue = 160
		}
		if reqValue >= h {
			return blmBigger
		}
		if l >= reqValue {
			return !blmBigger
		}
		if (2*l-reqValue)*h > reqValue*reqValue {
			return !blmBigger
		}
		return blmBigger
	}
	if c.Touchscreen != o.Touchscreen && r.Touchscreen != 0 {
		return c.Touchscreen != 0
	}

	// input
	if c.InputFlags != 0 || o.InputFlags != 0 {
		myKeysHidden := c.InputFlags & MaskKeysHidden
		oKeysHidden := o.InputFlags & MaskKeysHidden
		reqKeysHidden := r.InputFlags & MaskKeysHidden
		if myKeysHidden != oKeysHidden && reqKeysHidden != 0 {
			switch {
			case myKeysHidden == 0:
				return false
			case oKeysHidden == 0:
				return true
			case reqKeysHidden == myKeysHidden:
				return true
			case reqKeysHidden == oKeysHidden:
				return false
			}
		}
		myNavHidden := c.InputFlags & MaskNavHidden
		oNavHidden := o.InputFlags & MaskNavHidden
		reqNavHidden := r.InputFlags & MaskNavHidden
		if myNavHidden != oNavHidden && reqNavHidden != 0 {
			switch {
			case myNavHidden == 0:
				return false
			case oNavHidden == 0:
				return true
			}
		}
	}
	if c.Keyboard != o.Keyboard && r.Keyboard != 0 {
		return c.Keyboard != 0
	}
	if c.Navigation != o.Navigation && r.Navigation != 0 {
		return c.Navigation != 0
	}

	// screen size
	if c.ScreenWidth != 0 || c.ScreenHeight != 0 || o.ScreenWidth != 0 || o.ScreenHeight != 0 {
		myDelta := 0
		otherDelta := 0
		if r.ScreenWidth != 0 {
			myDelta += int(r.ScreenWidth) - int(c.ScreenWidth)
			otherDelta += int(r.ScreenWidth) - int(o.ScreenWidth)
		}
		if r.ScreenHeight != 0 {
			myDelta += int(r.ScreenHeight) - int(c.ScreenHeight)
			otherDelta += int(r.ScreenHeight) - int(o.ScreenHeight)
		}
		if myDelta != otherDelta {
			return myDelta < otherDelta
		}
	}

	// version
	if c.SDKVersion != 0 || o.MinorVersion != 0 {
		if c.SDKVersion != o.SDKVersion && r.SDKVersion != 0 {
			return c.SDKVersion > o.SDKVersion
		}
		if c.MinorVersion != o.MinorVersion && r.MinorVersion != 0 {
			return c.MinorVersion != 0
		}
	}

	return false
}
501569
func (b *SearchRequestBuilder) Size(size int) *SearchRequestBuilder {
	b.size = size
	return b
}
621317
func GreaterThan(param int, comparativeVal int, paramName string) Checker {

	return func() (isGreaterThan bool, errMsg string) {
		if isGreaterThan = param > comparativeVal; !isGreaterThan {
			errMsg = fmt.Sprintf(
				"Parameter's length was not greater than:  %s(%d) < %d",
				paramName,
				param,
				comparativeVal)
		}

		return isGreaterThan, errMsg
	}
}