// SubI64x2 subtracts y from x
975575
func SubI64x2(x, y I64x2) I64x2 {
	val := I64x2{}
	for i := 0; i < 2; i++ {
		val[i] = x[i] - y[i]
	}
	return val
}
1140585
func SubdivideQuad(c, c1, c2 []float64) {
	// First point of c is the first point of c1
	c1[0], c1[1] = c[0], c[1]
	// Last point of c is the last point of c2
	c2[4], c2[5] = c[4], c[5]

	// Subdivide segment using midpoints
	c1[2] = (c[0] + c[2]) / 2
	c1[3] = (c[1] + c[3]) / 2
	c2[2] = (c[2] + c[4]) / 2
	c2[3] = (c[3] + c[5]) / 2
	c1[4] = (c1[2] + c2[2]) / 2
	c1[5] = (c1[3] + c2[3]) / 2
	c2[0], c2[1] = c1[4], c1[5]
	return
}
1084009
func uint64Log2(v uint64) uint {
	log := uint(0)
	for i, m := range paddingMasks {
		if v&m != 0 {
			shift := uint(1<<uint(len(paddingMasks)-2)) >> uint(i)
			v >>= shift
			log |= shift
		}
	}
	return log + 1
}
273729
func (p *Point) Subtract(p2 Point) *Point {
	p.X -= p2.X
	p.Y -= p2.Y
	return p
}
165823
func SubI16x8(x, y I16x8) I16x8 {
	val := I16x8{}
	for i := 0; i < 8; i++ {
		val[i] = x[i] - y[i]
	}
	return val
}
816946
func DivInt64(a int64, b int64) (int64, error) {
	if a == math.MinInt64 && b == -1 {
		return 0, errors.Trace(ErrArithOverflow)
	}

	return a / b, nil
}
748246
func LeastSquares(xs, ys []float64) (m, b float64, err error) {

	lx, ly := len(xs), len(ys)

	// If the arrays are not of equal length, we can't do anything
	if lx != ly {
		err = ErrUnequalArrays
		return
	}

	// If we don't have at least two points, we can't do anything
	if lx < 2 {
		err = ErrInsufficientData
		return
	}

	var (
		x, y, meanx, meany, sumxx, sumxy float64
		i                                int
	)

	// Since we're dealing with sums of squares, we'll need to shift the data
	// to be centered around the origin to prevent potential overflow or
	// numerical instability. We'll do this by subtracting the mean of x from
	// each x value, and the mean of y from each y value. This takes an extra
	// pass in each case, but will be much more accurate, since we won't
	// compound rounding errors produced by summing squares of large floats.
	meanx = Mean(xs)
	meany = Mean(ys)

	for i, x = range xs {
		y = ys[i] - meany
		x = x - meanx
		sumxx += x * x
		sumxy += x * y
	}

	// Least squares gets a lot simpler when you subtract the means, because
	// sum of x-values and sum of y-values are both zero.
	m = sumxy / sumxx

	// Shift our y-intercept back to account for our mean subtraction
	b = meany - (m * meanx)

	return
}
1052581
func (c RGBA) Sub(d RGBA) RGBA {
	return RGBA{
		R: c.R - d.R,
		G: c.G - d.G,
		B: c.B - d.B,
		A: c.A - d.A,
	}
}
428938
func SubU8x16(x, y U8x16) U8x16 {
	val := U8x16{}
	for i := 0; i < 16; i++ {
		val[i] = x[i] - y[i]
	}
	return val
}
1072823
func SafeSub(x, y uint64) (uint64, bool) {
	return x - y, x < y
}
888195
func (m1 Mat4x3) Sub(m2 Mat4x3) Mat4x3 {
	return Mat4x3{m1[0] - m2[0], m1[1] - m2[1], m1[2] - m2[2], m1[3] - m2[3], m1[4] - m2[4], m1[5] - m2[5], m1[6] - m2[6], m1[7] - m2[7], m1[8] - m2[8], m1[9] - m2[9], m1[10] - m2[10], m1[11] - m2[11]}
}
362194
func subw(w uint32) uint32 {
	return uint32(sbox0[w>>24])<<24 |
		uint32(sbox0[w>>16&0xff])<<16 |
		uint32(sbox0[w>>8&0xff])<<8 |
		uint32(sbox0[w&0xff])
}
186740
func nextNearestPow2uint64(v uint64) uint64 {
	v--
	v |= v >> 1
	v |= v >> 2
	v |= v >> 4
	v |= v >> 8
	v |= v >> 16
	v |= v >> 32
	v++
	return v
}
458086
func (z fermat) Sub(x, y fermat) fermat {
	if len(z) != len(x) {
		panic("Add: len(z) != len(x)")
	}
	n := len(y) - 1
	b := subVV(z[:n], x[:n], y[:n])
	b += y[n]
	// If b > 0, we need to subtract b<<n, which is the same as adding b.
	z[n] = x[n]
	if z[0] <= ^big.Word(0)-b {
		z[0] += b
	} else {
		addVW(z, z, b)
	}
	z.norm()
	return z
}
150580
func SubU32x4(x, y U32x4) U32x4 {
	val := U32x4{}
	for i := 0; i < 4; i++ {
		val[i] = x[i] - y[i]
	}
	return val
}
141347
func (m1 Mat2x4) Sub(m2 Mat2x4) Mat2x4 {
	return Mat2x4{m1[0] - m2[0], m1[1] - m2[1], m1[2] - m2[2], m1[3] - m2[3], m1[4] - m2[4], m1[5] - m2[5], m1[6] - m2[6], m1[7] - m2[7]}
}
1091220
func Sub(a, b *T) T {
	return T{a[0] - b[0], a[1] - b[1], a[2] - b[2]}
}