CFix operator*(const Fix &x, const CFix &y)
{
  return CFix(x.get_re() * y.get_re(),
              x.get_re() * y.get_im(),
              x.get_shift() + y.get_shift(),
              0, 0);
}
CFix operator/(const CFix &x, const Fix &y)
{
  return CFix(x.get_re() / y.get_re(),
              x.get_im() / y.get_re(),
              x.get_shift() - y.get_shift(),
              0, 0);
}
CFix operator/(const Fix &x, const CFix &y)
{
  fixrep denominator = y.get_re() * y.get_re() + y.get_im() * y.get_im();
  return CFix(x.get_re() * y.get_re() / denominator,
              -x.get_re() * y.get_im() / denominator,
              x.get_shift() - y.get_shift(),
              0, 0);
}
Fix operator/(const Fix &x, const int y)
{
  return Fix(x.get_re() / y,
             x.get_shift(),
             0, 0);
}
Fix operator/(const int x, const Fix &y)
{
  return Fix(x / y.get_re(),
             -y.get_shift(),
             0, 0);
}
Fix operator*(const int x, const Fix &y)
{
  return Fix(x * y.get_re(),
             y.get_shift(),
             0, 0);
}