go123: lab.nexedi.com/kirr/go123/xbytes Index | Files

package xbytes

import "lab.nexedi.com/kirr/go123/xbytes"

Package xbytes provides additional utilities for working with byte slices.

Index

Package Files

alloc.go bytes.go

func ContainsByte Uses

func ContainsByte(s []byte, c byte) bool

ContainsByte is like bytes.ContainsRune but a bit faster.

func Grow Uses

func Grow(b []byte, n int) []byte

Grow increases length of byte slice by n elements.

If there is not enough capacity the slice is reallocated and copied. The memory for grown elements is not initialized.

func MakeRoom Uses

func MakeRoom(b []byte, n int) []byte

MakeRoom makes sure cap(b) - len(b) >= n.

If there is not enough capacity the slice is reallocated and copied. Length of the slice remains unchanged.

func Realloc Uses

func Realloc(b []byte, n int) []byte

Realloc resizes byte slice to be of length n not preserving content.

If slice length is increased and there is not enough capacity, the slice is reallocated but not copied. The memory for all elements becomes uninitialized.

NOTE semantic is different from C realloc(3) where content is preserved. NOTE use Resize when you need to preserve slice content.

func Realloc64 Uses

func Realloc64(b []byte, n int64) []byte

Realloc64 is the same as Realloc but for size typed as int64.

func Resize Uses

func Resize(b []byte, n int) []byte

Resize resizes byte slice to be of length n.

If slice length is increased and there is not enough capacity, the slice is reallocated and copied. The memory for grown elements, if any, is not initialized.

Package xbytes imports 2 packages (graph) and is imported by 6 packages. Updated 2019-09-16. Refresh now. Tools for package owners.