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)
| 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. |
| 132 | func 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. |