<commit_before>#include "stdafx.h"
#include "Rational.h"
#include <algorithm>


CRational::CRational(int numerator, int denominator)
	: m_numerator(numerator)
	, m_denominator(denominator)
{
	if (denominator < 0)
	{
		m_numerator = -m_numerator;
		m_denominator = -m_denominator;
	}
}

int CRational::GetNumerator() const
{
	return m_numerator;
}

int CRational::GetDenominator() const
{
	return m_denominator;
}

unsigned GCD(unsigned a, unsigned b)
{
	unsigned curA = a, curB = b;
	while (curA != 0 && curB != 0)
	{
		unsigned newA = curB % curA;
		unsigned newB = curA;
		curA = newA;
		curB = newB;
	}

	const unsigned maxVal = std::max(curA, curB);
	return (maxVal == 0) ? 1 : maxVal;
}<commit_msg>GCD computation function made more efficient<commit_after>#include "stdafx.h"
#include "Rational.h"


CRational::CRational(int numerator, int denominator)
	: m_numerator(numerator)
	, m_denominator(denominator)
{
	if (denominator < 0)
	{
		m_numerator = -m_numerator;
		m_denominator = -m_denominator;
	}
}

int CRational::GetNumerator() const
{
	return m_numerator;
}

int CRational::GetDenominator() const
{
	return m_denominator;
}

unsigned GCD(unsigned a, unsigned b)
{
	if (a == 0 && b == 0)
	{
		return 1;
	}

	while (b != 0)
	{
		unsigned oldB = b;
		b = a % b;
		a = oldB;
	}
	return a;
}
{'fraction_non_alphanumeric': 0.13307692307692306, 'fraction_numerical': 0.007692307692307693, 'mean_word_length': 4.204, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 4, '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': '4191345', 'n_tokens_mistral': 564, 'n_tokens_neox': 532, 'n_words': 122}