MCPcopy Create free account
hub / github.com/OpenSN-Library/OpenSN-Library / ByteArrayAdd

Function ByteArrayAdd

daemon/utils/covertor.go:59–71  ·  view source on GitHub ↗
(origin []byte, delta uint32)

Source from the content-addressed store, hash-verified

57}
58
59func ByteArrayAdd(origin []byte, delta uint32) []byte {
60 array := make([]byte, len(origin))
61 copy(array, origin)
62 for i := len(array) - 1; i >= 0; i-- {
63 sum := uint32(array[i]) + delta
64 array[i] = byte(sum % 256)
65 delta = uint32(sum) / 256
66 if delta == 0 {
67 break
68 }
69 }
70 return array
71}
72
73func ParseBinNumber(s string) (int64, error) {
74 parts := NumberRegex.FindStringSubmatch(s)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected