File: bitfield.go

package info (click to toggle)
golang-github-gopacket-gopacket 1.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,004 kB
  • sloc: sh: 301; python: 76; makefile: 10
file content (18 lines) | stat: -rw-r--r-- 483 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Copyright 2021 The GoPacket Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file in the root of the source tree.

package layers

type bitfield [1024]uint64

// set sets bit i in bitfield b to 1.
func (b *bitfield) set(i uint16) {
	b[i>>6] |= (1 << (i & 0x3f))
}

// has reports whether bit i is set to 1 in bitfield b.
func (b *bitfield) has(i uint16) bool {
	return b[i>>6]&(1<<(i&0x3f)) != 0
}