<commit_before>package protodecode

import (
	"net"
)

type IPv6Packet struct {
	Version            uint8  `json:"version"`
	TrafficClass       uint8  `json:"trafficClass"`
	FlowLabel          uint32 `json:"flowLabel"`
	PayloadLength      uint16 `json:"payloadLength"`
	NextHeader         uint8  `json:"nextHeader"`
	HopLimit           uint8  `json:"hopLimit"`
	SourceAddress      net.IP `json:"sourceAddress"`
	DestinationAddress net.IP `json:"destinationAddress"`
	Payload            []byte `json:"payload"`
}

func DecodeIPv6(b []byte) IPv6Packet {
	packet := IPv6Packet{}

	i := 0

	packet.Version = b[i] >> 4
	packet.TrafficClass = uint8(b[i]&0xf)<<4 | uint8(b[i+1]>>4)
	i += 1

	packet.FlowLabel = uint32(b[i]&0xf)<<16 | uint32(b[i+1])<<8 | uint32(b[i+2])
	i += 3

	packet.PayloadLength = uint16(b[i])<<8 | uint16(b[i+1])
	i += 2

	packet.NextHeader = uint8(b[i])
	i++

	packet.HopLimit = uint8(b[i])
	i++
<commit_msg>nitpick<commit_after>package protodecode

import (
	"net"
)

type IPv6Packet struct {
	Version            uint8  `json:"version"`
	TrafficClass       uint8  `json:"trafficClass"`
	FlowLabel          uint32 `json:"flowLabel"`
	PayloadLength      uint16 `json:"payloadLength"`
	NextHeader         uint8  `json:"nextHeader"`
	HopLimit           uint8  `json:"hopLimit"`
	SourceAddress      net.IP `json:"sourceAddress"`
	DestinationAddress net.IP `json:"destinationAddress"`
	Payload            []byte `json:"payload"`
}

func DecodeIPv6(b []byte) IPv6Packet {
	packet := IPv6Packet{}

	i := 0

	packet.Version = b[i] >> 4
	packet.TrafficClass = uint8(b[i]&0xf)<<4 | uint8(b[i+1]>>4)
	i++

	packet.FlowLabel = uint32(b[i]&0xf)<<16 | uint32(b[i+1])<<8 | uint32(b[i+2])
	i += 3

	packet.PayloadLength = uint16(b[i])<<8 | uint16(b[i+1])
	i += 2

	packet.NextHeader = uint8(b[i])
	i++

	packet.HopLimit = uint8(b[i])
	i++

{'fraction_non_alphanumeric': 0.16421968461120173, 'fraction_numerical': 0.046220772158781946, 'mean_word_length': 3.681933842239186, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '148092', 'n_tokens_mistral': 746, 'n_tokens_neox': 700, 'n_words': 133}