summaryrefslogtreecommitdiff
path: root/vendor/github.com/tdewolff/parse/v2/strconv/int.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2022-05-02 14:05:18 +0100
committerLibravatar GitHub <noreply@github.com>2022-05-02 15:05:18 +0200
commitb56dae8120d43b9acd3d3ed4d40100ffab7b972a (patch)
treed55d30589d8a8499ed3d5eecba163abc9fa78c27 /vendor/github.com/tdewolff/parse/v2/strconv/int.go
parentadd extra indexes as a migration (#527) (diff)
downloadgotosocial-b56dae8120d43b9acd3d3ed4d40100ffab7b972a.tar.xz
[chore] Update all but bun libraries (#526)
* update all but bun libraries Signed-off-by: kim <grufwub@gmail.com> * remove my personal build script changes Signed-off-by: kim <grufwub@gmail.com>
Diffstat (limited to 'vendor/github.com/tdewolff/parse/v2/strconv/int.go')
-rw-r--r--vendor/github.com/tdewolff/parse/v2/strconv/int.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/vendor/github.com/tdewolff/parse/v2/strconv/int.go b/vendor/github.com/tdewolff/parse/v2/strconv/int.go
index d8df0fd68..e3483bd3a 100644
--- a/vendor/github.com/tdewolff/parse/v2/strconv/int.go
+++ b/vendor/github.com/tdewolff/parse/v2/strconv/int.go
@@ -38,6 +38,26 @@ func ParseInt(b []byte) (int64, int) {
return int64(n), i
}
+// ParseUint parses a byte-slice and returns the integer it represents.
+// If an invalid character is encountered, it will stop there.
+func ParseUint(b []byte) (uint64, int) {
+ i := 0
+ n := uint64(0)
+ for i < len(b) {
+ c := b[i]
+ if n > math.MaxUint64/10 {
+ return 0, 0
+ } else if c >= '0' && c <= '9' {
+ n *= 10
+ n += uint64(c - '0')
+ } else {
+ break
+ }
+ i++
+ }
+ return n, i
+}
+
// LenInt returns the written length of an integer.
func LenInt(i int64) int {
if i < 0 {