<commit_before>#include "stdafx.h"
#include "GF256.h"
#include <vector>

using std::vector;

vector<unsigned int> _logTable(256, 0);
vector<unsigned int> _expTable(256, 0);

GF256elm::GF256elm(int x) {
	val = ((x % 256) + 256) % 256;
}

GF256elm& GF256elm::operator=(const GF256elm& other) {
	val = other.val;
	return *this;
}

GF256elm& GF256elm::operator+=(const GF256elm& other)	{
	val = (val ^ other.val);
	return *this;
}

GF256elm& GF256elm::operator-=(const GF256elm& other) {
	val = (val ^ other.val);
	return *this;
}

GF256elm& GF256elm::operator*=(const GF256elm& other) {
	int temp = (_logTable[val] + _logTable[other.val]) % 255;
	val = _expTable[temp];
	return *this;
}

GF256elm& GF256elm::operator/=(const GF256elm& other) {
	int t = _logTable[val] - _logTable[other.val];
	int temp =  ((t % 255) + 255) % 255;
	val = _expTable[temp];
	return *this;
}

bool GF256elm::operator==(const GF256elm& other) {<commit_msg>added checks for special cases such as division by zero. close #3<commit_after>#include "stdafx.h"
#include "GF256.h"
#include <vector>

using std::vector;

vector<unsigned int> _logTable(256, 0);
vector<unsigned int> _expTable(256, 0);

GF256elm::GF256elm(int x) {
	val = ((x % 256) + 256) % 256;
}

GF256elm& GF256elm::operator=(const GF256elm& other) {
	val = other.val;
	return *this;
}

GF256elm& GF256elm::operator+=(const GF256elm& other)	{
	val = (val ^ other.val);
	return *this;
}

GF256elm& GF256elm::operator-=(const GF256elm& other) {
	val = (val ^ other.val);
	return *this;
}

GF256elm& GF256elm::operator*=(const GF256elm& other) {
	if ((val == 0) || other.val == 0) {
		val = 0;
		return *this;
	}
	int temp = (_logTable[val] + _logTable[other.val]) % 255;
	val = _expTable[temp];
	return *this;
}

GF256elm& GF256elm::operator/=(const GF256elm& other) {
	if (val == 0) {
		val = 0;
		return *this;
	}
	if (other.val == 0 ) {
		throw; //divison by zero
	}
	int t = _logTable[val] - _logTable[other.val];
	int temp =  ((t % 255) + 255) % 255;
	val = _expTable[temp];
	return *this;
}

bool GF256elm::operator==(const GF256elm& other) {
{'fraction_non_alphanumeric': 0.17435158501440923, 'fraction_numerical': 0.0888568683957733, 'mean_word_length': 4.629729729729729, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '6153876', 'n_tokens_mistral': 981, 'n_tokens_neox': 835, 'n_words': 202}