Package xbytes provides additional utilities for working with byte slices.
func ContainsByte ¶
ContainsByte is like bytes.ContainsRune but a bit faster.
func Grow ¶
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 ¶
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 ¶
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 ¶
Realloc64 is the same as Realloc but for size typed as int64.