Commit e5518eb5 authored by Julius Nehring-Wirxel's avatar Julius Nehring-Wirxel
Browse files

Only generate useful multiplications (i.e. don't generate i64 * i64 = i192)

parent d9c8fbd1
......@@ -252,8 +252,9 @@ void generate_mul_file()
file << "template <int w_res, class T0, class T1>\n";
file << "fixed_uint<w_res> mul(T0 const& lhs, T1 const& rhs);\n\n";
for (auto r = 2; r <= 4; ++r)
for (auto j = 1; j <= 4; ++j)
for (auto i = 1; i <= 4; ++i)
for (auto j = 1; j <= r; ++j)
for (auto i = 1; i <= r; ++i)
if (i + j >= r)
{
file << generate_mul(r, i, j);
file << "\n";
......@@ -282,8 +283,9 @@ void generate_imul_file()
file << "fixed_int<w_res> imul(T0 const& lhs, T1 const& rhs);\n\n";
for (auto r = 2; r <= 4; ++r)
for (auto j = 1; j <= 4; ++j)
for (auto i = 1; i <= 4; ++i)
for (auto j = 1; j <= r; ++j)
for (auto i = 1; i <= r; ++i)
if (i + j >= r)
{
file << generate_imul(r, i, j);
file << "\n";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment