<commit_before>#ifndef __LIBSCCMN_FRAME_H__
#define __LIBSCCMN_FRAME_H__

struct frame_dvec
{
	struct frame * frame;

	// 0 <= position <= limit <= capacity

	// The position is the index of the next byte to be read or written.
	// The position is never negative and is never greater than its limit.
	size_t position;

	// The limit is the index of the first byte that should not be read or written.
	// The limit is never negative and is never greater than its capacity.
	size_t limit;

	// The capacity is the number of bytes it contains.
	// The capacity is never negative and never changes.
	size_t capacity;
};

static inline void frame_dvec_position_add(struct frame_dvec * this, size_t position_delta)
{
	assert((this->position + position_delta) > 0);
	assert((this->position + position_delta) < this->limit);
	assert((this->position + position_delta) < this->capacity);

	this->position += position_delta;
}

static inline void frame_dvec_set_position(struct frame_dvec * this, size_t position)
{
	this->position = position;
}

static inline void frame_dvec_flip(struct frame_dvec * this)
{
	this->limit = this->position;<commit_msg>Improving frame data vector function that sets position.<commit_after>#ifndef __LIBSCCMN_FRAME_H__
#define __LIBSCCMN_FRAME_H__

struct frame_dvec
{
	struct frame * frame;

	// 0 <= position <= limit <= capacity

	// The position is the index of the next byte to be read or written.
	// The position is never negative and is never greater than its limit.
	size_t position;

	// The limit is the index of the first byte that should not be read or written.
	// The limit is never negative and is never greater than its capacity.
	size_t limit;

	// The capacity is the number of bytes it contains.
	// The capacity is never negative and never changes.
	size_t capacity;
};

static inline void frame_dvec_position_add(struct frame_dvec * this, size_t position_delta)
{
	assert((this->position + position_delta) > 0);
	assert((this->position + position_delta) < this->limit);
	assert((this->position + position_delta) < this->capacity);

	this->position += position_delta;
}

static inline bool frame_dvec_set_position(struct frame_dvec * this, size_t position)
{
	if (position > this->limit) return false;
	this->position = position;
	return true;
}

static inline void frame_dvec_flip(struct frame_dvec * this)
{
	this->limit = this->position;
{'fraction_non_alphanumeric': 0.08816120906801007, 'fraction_numerical': 0.0016792611251049538, 'mean_word_length': 4.391402714932127, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 25, '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': '6477493', 'n_tokens_mistral': 724, 'n_tokens_neox': 705, 'n_words': 267}