MCPcopy
hub / github.com/OffchainLabs/prysm / PadTo

Function PadTo

encoding/bytesutil/bytes.go:132–137  ·  view source on GitHub ↗

PadTo pads a byte slice to the given size. If the byte slice is larger than the given size, the original slice is returned.

(b []byte, size int)

Source from the content-addressed store, hash-verified

130// PadTo pads a byte slice to the given size. If the byte slice is larger than the given size, the
131// original slice is returned.
132func PadTo(b []byte, size int) []byte {
133 if len(b) >= size {
134 return b
135 }
136 return append(b, make([]byte, size-len(b))...)
137}
138
139// ReverseByteOrder Switch the endianness of a byte slice by reversing its order.
140// This function does not modify the actual input bytes.

Callers 15

TestSafeCopyRootAtIndexFunction · 0.92
TestJsonMarshalUnmarshalFunction · 0.92
UnmarshalJSONMethod · 0.92
UnmarshalJSONMethod · 0.92
UnmarshalJSONMethod · 0.92
UnmarshalJSONMethod · 0.92
UnmarshalJSONMethod · 0.92
UnmarshalJSONMethod · 0.92
UnmarshalJSONMethod · 0.92

Calls 1

lenStruct · 0.85

Tested by 15

TestSafeCopyRootAtIndexFunction · 0.74
TestJsonMarshalUnmarshalFunction · 0.74
TestUnmarshalItems_OKFunction · 0.74
TestMarshalItems_OKFunction · 0.74
TestJWTAuthTransportFunction · 0.74
TestJWTWithIdFunction · 0.74
TestJWTWithoutIdFunction · 0.74