Esempio n. 1
0
void MLSignal::copy(const MLSignal& b)
{
	const bool kb = b.isConstant();
	if (kb)
	{
		setToConstant(b.mDataAligned[0]);
	}
	else 
	{
		const int n = min(mSize, b.getSize());
		std::copy(b.mDataAligned, b.mDataAligned + n, mDataAligned);
		setConstant(false);
	}
}
Esempio n. 2
0
// TODO SSE
void MLSignal::divide(const MLSignal& b)
{
	const bool ka = isConstant();
	const bool kb = b.isConstant();
	if (ka && kb)
	{
		setToConstant(mDataAligned[0] + b.mDataAligned[0]);
	}
	else 
	{
		const int n = min(mSize, b.getSize());
		if (ka && !kb)
		{
			MLSample fa = mDataAligned[0];
			for(int i = 0; i < n; ++i)
			{
				mDataAligned[i] = fa / b[i];
			}
		}
		else if (!ka && kb)
		{
			MLSample fb = b[0];
			for(int i = 0; i < n; ++i)
			{
				mDataAligned[i] /= fb;
			}
		}
		else
		{
			for(int i = 0; i < n; ++i)
			{
				mDataAligned[i] /= b.mDataAligned[i];
			}
		}
		setConstant(false);
	}
}