mirror of
https://github.com/valyala/fasthttp.git
synced 2026-06-15 16:07:51 +03:00
Replace custom AppendUint with strconv.AppendUint (#1813)
* Use strconv.AppendInt * Replace AppendInt with AppendUint * Fix typo
This commit is contained in:
committed by
GitHub
parent
ed6a27a88e
commit
bb0c8dd79c
+2
-15
@@ -10,6 +10,7 @@ import (
|
||||
"io"
|
||||
"math"
|
||||
"net"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
@@ -127,21 +128,7 @@ func AppendUint(dst []byte, n int) []byte {
|
||||
panic("BUG: int must be positive")
|
||||
}
|
||||
|
||||
var b [20]byte
|
||||
buf := b[:]
|
||||
i := len(buf)
|
||||
var q int
|
||||
for n >= 10 {
|
||||
i--
|
||||
q = n / 10
|
||||
buf[i] = '0' + byte(n-q*10)
|
||||
n = q
|
||||
}
|
||||
i--
|
||||
buf[i] = '0' + byte(n)
|
||||
|
||||
dst = append(dst, buf[i:]...)
|
||||
return dst
|
||||
return strconv.AppendUint(dst, uint64(n), 10)
|
||||
}
|
||||
|
||||
// ParseUint parses uint from buf.
|
||||
|
||||
Reference in New Issue
Block a user