<commit_before>package capnp

import (
	"encoding/binary"
)

// Struct is a pointer to a struct.  Convert a Pointer into a Struct
// using the ToStruct method.
type Struct Pointer

// Segment returns the segment this pointer came from.
func (s Struct) Segment() *Segment {
	return s.seg
}

// Pointer returns the i'th pointer in the struct.
func (p Struct) Pointer(i uint16) Pointer {
	if i < p.size.PointerCount {
		return p.seg.readPtr(p.pointerAddress(i))
	} else {
		return Pointer{}
	}
}

// SetPointer sets the i'th pointer in the struct to src.
func (p Struct) SetPointer(i uint16, src Pointer) {
	if i < p.size.PointerCount {
		//replaceMe := p.seg.readPtr(p.off + p.datasz + i*8)
		//copyStructHandlingVersionSkew(replaceMe, src, nil, 0, 0, 0)
		p.seg.writePtr(p.pointerAddress(i), src, nil, 0)
	}
}<commit_msg>capnp: dedent happy path in Pointer/SetPointer<commit_after>package capnp

import (
	"encoding/binary"
)

// Struct is a pointer to a struct.  Convert a Pointer into a Struct
// using the ToStruct method.
type Struct Pointer

// Segment returns the segment this pointer came from.
func (s Struct) Segment() *Segment {
	return s.seg
}

// Pointer returns the i'th pointer in the struct.
func (p Struct) Pointer(i uint16) Pointer {
	if i >= p.size.PointerCount {
		return Pointer{}
	}
	return p.seg.readPtr(p.pointerAddress(i))
}

// SetPointer sets the i'th pointer in the struct to src.
func (p Struct) SetPointer(i uint16, src Pointer) {
	if i >= p.size.PointerCount {
		return
	}
	//replaceMe := p.seg.readPtr(p.off + p.datasz + i*8)
	//copyStructHandlingVersionSkew(replaceMe, src, nil, 0, 0, 0)
	p.seg.writePtr(p.pointerAddress(i), src, nil, 0)
}
{'fraction_non_alphanumeric': 0.11976047904191617, 'fraction_numerical': 0.010778443113772455, 'mean_word_length': 3.7203389830508473, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1134362', 'n_tokens_mistral': 595, 'n_tokens_neox': 574, 'n_words': 195}