// IsOnCurve returns true if the given (x,y) lies on the BitCurve.
496640
func (BitCurve *BitCurve) IsOnCurve(x, y *big.Int) bool {
	// y² = x³ + b
	y2 := new(big.Int).Mul(y, y) //y²
	y2.Mod(y2, BitCurve.P)       //y²%P

	x3 := new(big.Int).Mul(x, x) //x²
	x3.Mul(x3, x)                //x³

	x3.Add(x3, BitCurve.B) //x³+B
	x3.Mod(x3, BitCurve.P) //(x³+B)%P

	return x3.Cmp(y2) == 0
}
111739
func (BitCurve *BitCurve) Double(x1, y1 *big.Int) (*big.Int, *big.Int) {
	z1 := new(big.Int).SetInt64(1)
	return BitCurve.affineFromJacobian(BitCurve.doubleJacobian(x1, y1, z1))
}
392572
func (b *BtcWallet) IsOurAddress(a btcutil.Address) bool {
	result, err := b.wallet.HaveAddress(a)
	return result && (err == nil)
}
1144305
func IsOnLine(layout geom.Layout, point geom.Coord, lineSegmentCoordinates []float64) bool {
	stride := layout.Stride()
	if len(lineSegmentCoordinates) < (2 * stride) {
		panic(fmt.Sprintf("At least two coordinates are required in the lineSegmentsCoordinates array in 'algorithms.IsOnLine', was: %v", lineSegmentCoordinates))
	}
	strategy := lineintersector.RobustLineIntersector{}

	for i := stride; i < len(lineSegmentCoordinates); i += stride {
		segmentStart := lineSegmentCoordinates[i-stride : i-stride+2]
		segmentEnd := lineSegmentCoordinates[i : i+2]

		if lineintersector.PointIntersectsLine(strategy, point, geom.Coord(segmentStart), geom.Coord(segmentEnd)) {
			return true
		}
	}
	return false
}
1356454
func GenericCurve(c elliptic.Curve) KeyExchange {
	if c == nil {
		panic("ecdh: curve is nil")
	}
	return genericCurve{curve: c}
}
205795
func (h *SetupHandler) isOnboarding(w http.ResponseWriter, r *http.Request) {
	ctx := r.Context()
	result, err := h.OnboardingService.IsOnboarding(ctx)
	if err != nil {
		EncodeError(ctx, err, w)
		return
	}
	if err := encodeResponse(ctx, w, http.StatusOK, isOnboardingResponse{result}); err != nil {
		logEncodingError(h.Logger, r, err)
		return
	}
}
1083325
func isOlderThan(t metav1.Time, d time.Duration) bool {
	return !t.IsZero() && t.Sub(time.Now()) < -1*d
}
1124924
func (tr TimeRange) IsOccurring(t time.Time) bool {
	return !(t.Before(tr.Start) || t.After(tr.End))
}
817405
func ComputeDistance(a *coordinate.Coordinate, b *coordinate.Coordinate) float64 {
	if a == nil || b == nil {
		return math.Inf(1.0)
	}

	return a.DistanceTo(b).Seconds()
}
148233
func (BitCurve *BitCurve) Unmarshal(data []byte) (x, y *big.Int) {
	byteLen := (BitCurve.BitSize + 7) >> 3
	if len(data) != 1+2*byteLen {
		return
	}
	if data[0] != 4 { // uncompressed form
		return
	}
	x = new(big.Int).SetBytes(data[1 : 1+byteLen])
	y = new(big.Int).SetBytes(data[1+byteLen:])
	return
}
132546
func (mp *TxPool) IsOrphanInPool(hash *chainhash.Hash) bool {
	// Protect concurrent access.
	mp.mtx.RLock()
	inPool := mp.isOrphanInPool(hash)
	mp.mtx.RUnlock()

	return inPool
}
686654
func isObject(raw interface{}) (map[string]interface{}, bool) {
	o, ok := raw.(map[string]interface{})
	return o, ok
}
458210
func (st *stateTracker) IsOn(c, n string) (*ChanPrivs, bool) {
	st.mu.Lock()
	defer st.mu.Unlock()
	nk, nok := st.nicks[n]
	ch, cok := st.chans[c]
	if nok && cok {
		return nk.isOn(ch)
	}
	return nil, false
}
890392
func HalveInplace(m image.Image) image.Image {
	b := m.Bounds()
	switch m := m.(type) {
	case *image.YCbCr:
		for y := b.Min.Y; y < b.Max.Y/2; y++ {
			for x := b.Min.X; x < b.Max.X/2; x++ {
				y00 := uint32(m.Y[m.YOffset(2*x, 2*y)])
				y10 := uint32(m.Y[m.YOffset(2*x+1, 2*y)])
				y01 := uint32(m.Y[m.YOffset(2*x, 2*y+1)])
				y11 := uint32(m.Y[m.YOffset(2*x+1, 2*y+1)])
				// Add before divide with uint32 or we get errors in the least
				// significant bits.
				m.Y[m.YOffset(x, y)] = uint8((y00 + y10 + y01 + y11) >> 2)

				cb00 := uint32(m.Cb[m.COffset(2*x, 2*y)])
				cb10 := uint32(m.Cb[m.COffset(2*x+1, 2*y)])
				cb01 := uint32(m.Cb[m.COffset(2*x, 2*y+1)])
				cb11 := uint32(m.Cb[m.COffset(2*x+1, 2*y+1)])
				m.Cb[m.COffset(x, y)] = uint8((cb00 + cb10 + cb01 + cb11) >> 2)

				cr00 := uint32(m.Cr[m.COffset(2*x, 2*y)])
				cr10 := uint32(m.Cr[m.COffset(2*x+1, 2*y)])
				cr01 := uint32(m.Cr[m.COffset(2*x, 2*y+1)])
				cr11 := uint32(m.Cr[m.COffset(2*x+1, 2*y+1)])
				m.Cr[m.COffset(x, y)] = uint8((cr00 + cr10 + cr01 + cr11) >> 2)
			}
		}
		b.Max = b.Min.Add(b.Size().Div(2))
		return subImage(m, b)
	case draw.Image:
		for y := b.Min.Y; y < b.Max.Y/2; y++ {
			for x := b.Min.X; x < b.Max.X/2; x++ {
				r00, g00, b00, a00 := m.At(2*x, 2*y).RGBA()
				r10, g10, b10, a10 := m.At(2*x+1, 2*y).RGBA()
				r01, g01, b01, a01 := m.At(2*x, 2*y+1).RGBA()
				r11, g11, b11, a11 := m.At(2*x+1, 2*y+1).RGBA()

				// Add before divide with uint32 or we get errors in the least
				// significant bits.
				r := (r00 + r10 + r01 + r11) >> 2
				g := (g00 + g10 + g01 + g11) >> 2
				b := (b00 + b10 + b01 + b11) >> 2
				a := (a00 + a10 + a01 + a11) >> 2

				m.Set(x, y, color.RGBA{
					R: uint8(r >> 8),
					G: uint8(g >> 8),
					B: uint8(b >> 8),
					A: uint8(a >> 8),
				})
			}
		}
		b.Max = b.Min.Add(b.Size().Div(2))
		return subImage(m, b)
	default:
		// TODO(wathiede): fallback to generic Resample somehow?
		panic("Unhandled image type")
	}
}
571078
func (a AnySchedule) IsOccurring(t time.Time) bool {
	return a.Schedule.IsOccurring(t)
}
279917
func (s *MockSweeperStore) IsOurTx(hash chainhash.Hash) (bool, error) {
	_, ok := s.ourTxes[hash]
	return ok, nil
}
776320
func (server *Socket) ServerAuthCurve(domain, secret_key string) error {
	err := server.SetCurveServer(1)
	if err == nil {
		err = server.SetCurveSecretkey(secret_key)
	}
	if err == nil {
		err = server.SetZapDomain(domain)
	}
	return err
}