blob: 7d54acf07e70c2d05f2950c742032ffeacaf7f71 [file] [log] [blame]
Naveen Sampath04696f72022-06-13 15:19:14 +05301// Copyright 2021 The GoPacket Authors. All rights reserved.
2//
3// Use of this source code is governed by a BSD-style license that can be found
4// in the LICENSE file in the root of the source tree.
5
6package layers
7
8type bitfield [1024]uint64
9
10// set sets bit i in bitfield b to 1.
11func (b *bitfield) set(i uint16) {
12 b[i>>6] |= (1 << (i & 0x3f))
13}
14
15// has reports whether bit i is set to 1 in bitfield b.
16func (b *bitfield) has(i uint16) bool {
17 return b[i>>6]&(1<<(i&0x3f)) != 0
18}