aboutsummaryrefslogtreecommitdiff
path: root/forged/internal/bare/varint.go
blob: a185ac8eea552529c5c79be23692adf7803be003 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2025 Drew Devault <https://drewdevault.com>

package bare

import (
	"reflect"
)

// Int is a variable-length encoded signed integer.
type Int int64

// Uint is a variable-length encoded unsigned integer.
type Uint uint64

var (
	intType  = reflect.TypeOf(Int(0))
	uintType = reflect.TypeOf(Uint(0))
)

func getIntKind(t reflect.Type) reflect.Kind {
	switch t {
	case intType:
		return reflect.Int
	case uintType:
		return reflect.Uint
	default:
		return t.Kind()
	}
}