summaryrefslogtreecommitdiff
path: root/lib/binstruct/binutil/binutil.go
blob: 684237ffd6ba50c621664de342126234d245686b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Copyright (C) 2022  Luke Shumaker <lukeshu@lukeshu.com>
//
// SPDX-License-Identifier: GPL-2.0-or-later

package binutil

import (
	"fmt"
)

func NeedNBytes(dat []byte, n int) error {
	if len(dat) < n {
		return fmt.Errorf("need at least %v bytes, only have %v", n, len(dat))
	}
	return nil
}