// Ring4 returns the value of ((a*a *b) - (a*b*b)).
13264
func (u *Ugen) Ring4(val Input) Input {
	return binOpRing4(u.Rate, u, val, u.NumOutputs)
}
1320647
func (mat *T) TransformVec4(v *vec4.T) {
	// Use intermediate variables to not alter further computations.
	x := mat[0][0]*v[0] + mat[1][0]*v[1] + mat[2][0]*v[2] + mat[3][0]*v[3]
	y := mat[0][1]*v[0] + mat[1][1]*v[1] + mat[2][1]*v[2] + mat[3][1]*v[3]
	z := mat[0][2]*v[0] + mat[1][2]*v[1] + mat[2][2]*v[2] + mat[3][2]*v[3]
	v[3] = mat[0][3]*v[0] + mat[1][3]*v[1] + mat[2][3]*v[2] + mat[3][3]*v[3]
	v[0] = x
	v[1] = y
	v[2] = z
}
480127
func sb4Inv(r0, r1, r2, r3 *uint32) {
	r4 := *r2
	*r2 &= *r3
	*r2 ^= *r1
	*r1 |= *r3
	*r1 &= *r0
	r4 ^= *r2
	r4 ^= *r1
	*r1 &= *r2
	*r0 = ^*r0
	*r3 ^= r4
	*r1 ^= *r3
	*r3 &= *r0
	*r3 ^= *r2
	*r0 ^= *r1
	*r2 &= *r0
	*r3 ^= *r0
	*r2 ^= r4
	*r2 |= *r3
	*r3 ^= *r0
	*r2 ^= *r1
	//return *r0, *r3, *r2, r4
	*r1 = *r3
	*r3 = r4
}
808115
func (rb *RingBuffer) Get() (interface{}, error) {
	var n *node
	pos := atomic.LoadUint64(&rb.dequeue)
	i := 0
L:
	for {
		if atomic.LoadUint64(&rb.disposed) == 1 {
			return nil, ErrDisposed
		}

		n = rb.nodes[pos&rb.mask]
		seq := atomic.LoadUint64(&n.position)
		switch dif := seq - (pos + 1); {
		case dif == 0:
			if atomic.CompareAndSwapUint64(&rb.dequeue, pos, pos+1) {
				break L
			}
		case dif < 0:
			panic(`Ring buffer in compromised state during a get operation.`)
		default:
			pos = atomic.LoadUint64(&rb.dequeue)
		}

		if i == 10000 {
			runtime.Gosched() // free up the cpu before the next iteration
			i = 0
		} else {
			i++
		}
	}
	data := n.data
	n.data = nil
	atomic.StoreUint64(&n.position, pos+rb.mask+1)
	return data, nil
}
832029
func dct4(data *[4]float32) {
	var even, odd [2]float32
	for i := 0; i < 2; i++ {
		even[i] = data[i] + data[3-i]
		odd[i] = (data[i] - data[3-i]) * dct4c[i]
	}

	dct2(&even)
	dct2(&odd)

	odd[0] += odd[1]

	for i := 0; i < 2; i++ {
		data[2*i] = even[i]
		data[2*i+1] = odd[i]
	}
}
1270698
func imdct4(in *[2]float32, out *[4]float32) {
	tmp0 := in[0]*imdct4c0 + in[1]*imdct4c1
	tmp1 := in[0]*imdct4c1 - in[1]*imdct4c0

	out[0] = tmp0
	out[1] = -tmp0
	out[2] = tmp1
	out[3] = tmp1
}
853306
func (r *ring) write(key []byte, values Values) (bool, error) {
	return r.getPartition(key).write(key, values)
}
880693
func (v Vec2) Vec4(z, w float64) Vec4 {
	return Vec4{v[0], v[1], z, w}
}
364560
func (v Vec2) Vec4(z, w float32) Vec4 {
	return Vec4{v[0], v[1], z, w}
}
420375
func (c C) Ring2(val Input) Input {
	if v, ok := val.(C); ok {
		return C((c * v) + c + v)
	}
	return val.Ring2(c)
}
1280793
func Cross(a, b Vect) Float {
	return (a.X * b.Y) - (a.Y * b.X)
}
1323743
func (v1 Vec4) LenSqr() float32 {
	return v1[0]*v1[0] + v1[1]*v1[1] + v1[2]*v1[2] + v1[3]*v1[3]
}
926524
func Polygon(p orb.Polygon, proj orb.Projection) orb.Polygon {
	for i := range p {
		p[i] = Ring(p[i], proj)
	}

	return p
}
883548
func (c C) Ring3(val Input) Input {
	if v, ok := val.(C); ok {
		return C((c * v) * v)
	}
	return val.Ring3(c)
}
452846
func (s *Server) replicateRing(r ring.Ring, rb, bb *[]byte) error {
	failcount := 0
	for _, slave := range s.slaves {
		ctx, _ := context.WithTimeout(context.Background(), time.Duration(_SYN_REGISTER_TIMEOUT)*time.Second)
		i := &pb.RingMsg{
			Version:  r.Version(),
			Ring:     *rb,
			Builder:  *bb,
			Deadline: time.Now().Add(60 * time.Second).Unix(),
			Rollback: s.r.Version(),
		}
		res, err := slave.client.Store(ctx, i)
		if err != nil {
			log.Println(err)
			failcount++
			continue
		}
		if res.Version != r.Version() {
			log.Printf("Version or master on remote node %+v did not match local entries. Got %+v.", slave, res)
			failcount++
			continue
		}
		if !res.Ring || !res.Builder {
			log.Printf("res is: %#v\n", res)
			log.Printf("Slave failed to store ring or builder: %s", res.ErrMsg)
			failcount++
			continue
		}
		log.Printf("<-- Slave response: %+v", res)
		slave.version = res.Version
		slave.last = time.Now()
		slave.status = true
	}
	if failcount > (len(s.slaves) / 2) {
		return fmt.Errorf("Failed to get replication majority")
	}
	return nil
}
400072
func V4() (UUID, error) {
	u := UUID{}

	_, err := rand.Read(u[:])
	if err != nil {
		return u, err
	}

	u[8] = (u[8] | 0x80) & 0xBF
	u[6] = (u[6] | 0x40) & 0x4F

	return u, nil
}
732955
func (s *DouglasPeuckerSimplifier) Ring(r orb.Ring) orb.Ring {
	return ring(s, r)
}