llvm/mlir/include/mlir/Analysis/Presburger/Fraction.h

//===- Fraction.h - MLIR Fraction Class -------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This is a simple class to represent fractions. It supports arithmetic,
// comparison, floor, and ceiling operations.
//
//===----------------------------------------------------------------------===//

#ifndef MLIR_ANALYSIS_PRESBURGER_FRACTION_H
#define MLIR_ANALYSIS_PRESBURGER_FRACTION_H

#include "llvm/ADT/DynamicAPInt.h"
#include "llvm/Support/raw_ostream.h"

namespace mlir {
namespace presburger {
DynamicAPInt;

/// A class to represent fractions. The sign of the fraction is represented
/// in the sign of the numerator; the denominator is always positive.
///
/// Note that overflows may occur if the numerator or denominator are not
/// representable by 64-bit integers.
struct Fraction {};

/// Three-way comparison between two fractions.
/// Returns +1, 0, and -1 if the first fraction is greater than, equal to, or
/// less than the second fraction, respectively.
inline int compare(const Fraction &x, const Fraction &y) {}

inline DynamicAPInt floor(const Fraction &f) {}

inline DynamicAPInt ceil(const Fraction &f) {}

inline Fraction operator-(const Fraction &x) {}

inline bool operator<(const Fraction &x, const Fraction &y) {}

inline bool operator<=(const Fraction &x, const Fraction &y) {}

inline bool operator==(const Fraction &x, const Fraction &y) {}

inline bool operator!=(const Fraction &x, const Fraction &y) {}

inline bool operator>(const Fraction &x, const Fraction &y) {}

inline bool operator>=(const Fraction &x, const Fraction &y) {}

inline Fraction abs(const Fraction &f) {}

inline Fraction reduce(const Fraction &f) {}

inline Fraction operator*(const Fraction &x, const Fraction &y) {}

inline Fraction operator/(const Fraction &x, const Fraction &y) {}

inline Fraction operator+(const Fraction &x, const Fraction &y) {}

inline Fraction operator-(const Fraction &x, const Fraction &y) {}

// Find the integer nearest to a given fraction.
inline DynamicAPInt round(const Fraction &f) {}

inline Fraction &operator+=(Fraction &x, const Fraction &y) {}

inline Fraction &operator-=(Fraction &x, const Fraction &y) {}

inline Fraction &operator/=(Fraction &x, const Fraction &y) {}

inline Fraction &operator*=(Fraction &x, const Fraction &y) {}

inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const Fraction &x) {}

} // namespace presburger
} // namespace mlir

#endif // MLIR_ANALYSIS_PRESBURGER_FRACTION_H