func putPinnedSlidingHipNoSv()

in cpc/utils.go [639:689]


func putPinnedSlidingHipNoSv(mem []byte, lgK int, fiCol int, numCoupons int, wLengthInts int, kxp float64, hipAccum float64, seedHash int16, wStream []int) error {
	// Set the format to PINNED_SLIDING_HIP_NOSV.
	format := CpcFormatPinnedSlidingHipNosv
	preInts := byte(getDefinedPreInts(format))
	flags := byte((int(format) << 2) | compressedFlagMask)

	// Check that the memory slice has enough capacity.
	if err := checkCapacity(len(mem), 4*(int(preInts)+wLengthInts)); err != nil {
		return err
	}

	// Write the low preamble fields.
	if err := putFirst8(mem, preInts, byte(lgK), byte(fiCol), flags, seedHash); err != nil {
		return err
	}

	// Write the high preamble fields.
	offset, err := getHiFieldOffset(format, hiFieldNumCoupons)
	if err != nil {
		return err
	}
	binary.LittleEndian.PutUint32(mem[offset:], uint32(numCoupons))

	offset, err = getHiFieldOffset(format, hiFieldWLengthInts)
	if err != nil {
		return err
	}
	binary.LittleEndian.PutUint32(mem[offset:], uint32(wLengthInts))

	offset, err = getHiFieldOffset(format, hiFieldKXP)
	if err != nil {
		return err
	}
	binary.LittleEndian.PutUint64(mem[offset:], math.Float64bits(kxp))

	offset, err = getHiFieldOffset(format, hiFieldHipAccum)
	if err != nil {
		return err
	}
	binary.LittleEndian.PutUint64(mem[offset:], math.Float64bits(hipAccum))

	// Write the window stream array.
	offset, err = getWStreamOffset(mem)
	if err != nil {
		return err
	}
	for i := 0; i < wLengthInts; i++ {
		binary.LittleEndian.PutUint32(mem[offset+4*i:], uint32(wStream[i]))
	}
	return nil
}