mirror of
https://github.com/soypat/lneto.git
synced 2026-08-19 22:24:03 +00:00
Further reduce heap allocs (#56)
* work on tracking more heap allocations down * write own heapless IP AppendFormatAddr functions * remove potential Error method allocations * more logging
This commit is contained in:
@@ -3,6 +3,7 @@ package lneto
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type ValidateFlags uint64
|
||||
@@ -83,3 +84,12 @@ type BitPosErr struct {
|
||||
func (bpe *BitPosErr) Error() string {
|
||||
return fmt.Sprintf("%s at bits %d..%d", bpe.Err.Error(), bpe.BitStart, bpe.BitStart+bpe.BitLen)
|
||||
}
|
||||
|
||||
func (bpe *BitPosErr) AppendError(dst []byte) []byte {
|
||||
dst = append(dst, bpe.Err.Error()...)
|
||||
dst = append(dst, ": bits "...)
|
||||
dst = strconv.AppendUint(dst, uint64(bpe.BitStart), 10)
|
||||
dst = append(dst, '.', '.')
|
||||
dst = strconv.AppendUint(dst, uint64(bpe.BitStart+bpe.BitLen), 10)
|
||||
return dst
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user