aboutsummaryrefslogtreecommitdiff
path: root/src/gnunet/util/array.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/gnunet/util/array.go')
-rw-r--r--src/gnunet/util/array.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gnunet/util/array.go b/src/gnunet/util/array.go
index 9076516..f6213bf 100644
--- a/src/gnunet/util/array.go
+++ b/src/gnunet/util/array.go
@@ -30,6 +30,16 @@ func Reverse(b []byte) []byte {
30 return r 30 return r
31} 31}
32 32
33// IsNull returns true if all bytes in an array are set to 0.
34func IsNull(b []byte) bool {
35 for _, v := range b {
36 if v != 0 {
37 return false
38 }
39 }
40 return true
41}
42
33// CopyBlock copies 'in' to 'out' so that 'out' is filled completely. 43// CopyBlock copies 'in' to 'out' so that 'out' is filled completely.
34// - If 'in' is larger than 'out', it is left-truncated before copy 44// - If 'in' is larger than 'out', it is left-truncated before copy
35// - If 'in' is smaller than 'out', it is left-padded with 0 before copy 45// - If 'in' is smaller than 'out', it is left-padded with 0 before copy