// copyOutGeneric copies ulint64s to a byte buffer.
554011
func copyOutGeneric(d *state, b []byte) {
	for i := 0; len(b) >= 8; i++ {
		binary.LittleEndian.PutUint64(b, d.a[i])
		b = b[8:]
	}
}
340714
func Copy(ie interface{}) error {
	if ie == nil {
		return nil
	}
	switch e := ie.(type) {
	case *Error:
		return e.Copy()
	case error:
		val := reflect.ValueOf(e)
		if types.AnySettableValue(val) {
			return types.Copy(val).Interface().(error)
		}
		return errors.New(e.Error())
	default:
		panic("type not supported")
	}
}
902820
func (mas MaterialAttributesSvn) GenerateGeneric() (ma map[string]interface{}) {
	ma = map[string]interface{}{
		"auto_update":        mas.AutoUpdate,
		"check_externals":    mas.CheckExternals,
		"destination":        mas.Destination,
		"encrypted_password": mas.EncryptedPassword,
		"invert_filter":      mas.InvertFilter,
		"name":               mas.Name,
		"password":           mas.Password,
		"url":                mas.URL,
		"username":           mas.Username,
	}

	if f := mas.Filter.GenerateGeneric(); f != nil {
		ma["filter"] = f
	}

	return
}
1264904
func NewGenericStorage(name string, options GenericStorageOptions) Storage {
	return &GenericStorage{
		name:         name,
		get:          options.GetFunc,
		getMulti:     options.GetMultiFunc,
		set:          options.SetFunc,
		setMulti:     options.SetMultiFunc,
		del:          options.DelFunc,
		delMulti:     options.DelMultiFunc,
		errorOnFlush: options.ErrorOnFlush,
		flush:        options.FlushFunc,
	}
}
1284469
func ParseGenericResources(value []string) ([]swarm.GenericResource, error) {
	if len(value) == 0 {
		return nil, nil
	}

	resources, err := genericresource.Parse(value)
	if err != nil {
		return nil, err
	}

	obj := convert.GenericResourcesFromGRPC(resources)
	return obj, nil
}
20001
func (renderer *Renderer) CopyEx(texture *Texture, src, dst *Rect, angle float64, center *Point, flip RendererFlip) error {
	return errorFromInt(int(
		C.SDL_RenderCopyEx(
			renderer.cptr(),
			texture.cptr(),
			src.cptr(),
			dst.cptr(),
			C.double(angle),
			center.cptr(),
			flip.c())))
}
706341
func (ed *eventData) writeInt64(value int64) {
	binary.Write(&ed.buffer, binary.LittleEndian, value)
}
511270
func (i *iNode) copyToGen(gen *generation, ctrie *Ctrie) *iNode {
	nin := &iNode{gen: gen}
	main := gcasRead(i, ctrie)
	atomic.StorePointer(
		(*unsafe.Pointer)(unsafe.Pointer(&nin.main)), unsafe.Pointer(main))
	return nin
}
173412
func (r *Encoder) EncodeInt64(x int64) error {
	_, err := r.w.Write([]byte{CHR_INT8})
	if err != nil {
		return err
	}
	return binary.Write(r.w, binary.BigEndian, x)
}
599733
func copyOutput(r io.Reader, doneCh chan<- struct{}) {
	defer close(doneCh)

	pr, err := prefixedio.NewReader(r)
	if err != nil {
		panic(err)
	}

	stderrR, err := pr.Prefix(ErrorPrefix)
	if err != nil {
		panic(err)
	}
	stdoutR, err := pr.Prefix(OutputPrefix)
	if err != nil {
		panic(err)
	}
	defaultR, err := pr.Prefix("")
	if err != nil {
		panic(err)
	}

	var stdout io.Writer = os.Stdout
	var stderr io.Writer = os.Stderr

	if runtime.GOOS == "windows" {
		stdout = colorable.NewColorableStdout()
		stderr = colorable.NewColorableStderr()

		// colorable is not concurrency-safe when stdout and stderr are the
		// same console, so we need to add some synchronization to ensure that
		// we can't be concurrently writing to both stderr and stdout at
		// once, or else we get intermingled writes that create gibberish
		// in the console.
		wrapped := synchronizedWriters(stdout, stderr)
		stdout = wrapped[0]
		stderr = wrapped[1]
	}

	var wg sync.WaitGroup
	wg.Add(3)
	go func() {
		defer wg.Done()
		io.Copy(stderr, stderrR)
	}()
	go func() {
		defer wg.Done()
		io.Copy(stdout, stdoutR)
	}()
	go func() {
		defer wg.Done()
		io.Copy(stdout, defaultR)
	}()

	wg.Wait()
}
1295923
func (db *DB) ZRangeByScoreGeneric(key []byte, min int64, max int64,
	offset int, count int, reverse bool) ([]ScorePair, error) {

	return db.zRange(key, min, max, offset, count, reverse)
}
989416
func (w *CompoundFileWriter) copyFileEntry(dataOut IndexOutput, fileEntry *FileEntry) (n int64, err error) {
	var is IndexInput
	is, err = fileEntry.dir.OpenInput(fileEntry.file, IO_CONTEXT_READONCE)
	if err != nil {
		return 0, err
	}
	var success = false
	defer func() {
		if success {
			err = util.Close(is)
			// copy successful - delete file
			if err == nil {
				fileEntry.dir.DeleteFile(fileEntry.file) // ignore error
			}
		} else {
			util.CloseWhileSuppressingError(is)
		}
	}()

	startPtr := dataOut.FilePointer()
	length := fileEntry.length
	err = dataOut.CopyBytes(is, length)
	if err != nil {
		return 0, err
	}
	// verify that the output length diff is equal to original file
	endPtr := dataOut.FilePointer()
	diff := endPtr - startPtr
	if diff != length {
		return 0, errors.New(fmt.Sprintf(
			"Difference in the output file offsets %v does not match the original file length %v",
			diff, length))
	}
	fileEntry.offset = startPtr
	success = true
	return length, nil
}
123922
func (mag MaterialAttributesGit) GenerateGeneric() (ma map[string]interface{}) {
	ma = map[string]interface{}{
		"name":             mag.Name,
		"url":              mag.URL,
		"auto_update":      mag.AutoUpdate,
		"branch":           mag.Branch,
		"submodule_folder": mag.SubmoduleFolder,
		"destination":      mag.Destination,
		"shallow_clone":    mag.ShallowClone,
		"invert_filter":    mag.InvertFilter,
	}
	if f := mag.Filter.GenerateGeneric(); f != nil {
		ma["filter"] = f
	}
	return
}
1070510
func newOutput(uri string) (o *outputWrapper, err error) {
	updateMutex.Lock()
	defer updateMutex.Unlock()
	return lockedNewOutput(uri)
}
1058543
func GenTablePrefix(tableID int64) kv.Key {
	buf := make([]byte, 0, len(tablePrefix)+8)
	buf = append(buf, tablePrefix...)
	buf = codec.EncodeInt(buf, tableID)
	return buf
}
517030
func encodeInt64(buf *bytes.Buffer, name string, val Int64) error {
	// type
	buf.WriteByte(_64BIT_INTEGER)

	// name
	if err := writeCstring(buf, name); err != nil {
		return err
	}

	// value
	binary.Write(buf, binary.LittleEndian, val)
	return nil
}
260962
func gen(filename, pkgName string, in io.ReadSeeker, typesets []map[string]string, out io.Writer) error {

	var output []byte
	var err error

	output, err = parse.Generics(filename, pkgName, in, typesets)
	if err != nil {
		return err
	}

	out.Write(output)
	return nil
}