1//===- MPInt.cpp - MLIR MPInt Class ---------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "mlir/Analysis/Presburger/MPInt.h"
10#include "mlir/Analysis/Presburger/SlowMPInt.h"
11#include "llvm/ADT/Hashing.h"
12#include "llvm/Support/raw_ostream.h"
13
14using namespace mlir;
15using namespace presburger;
16
17llvm::hash_code mlir::presburger::hash_value(const MPInt &x) {
18 if (x.isSmall())
19 return llvm::hash_value(value: x.getSmall());
20 return detail::hash_value(x: x.getLarge());
21}
22
23/// ---------------------------------------------------------------------------
24/// Printing.
25/// ---------------------------------------------------------------------------
26llvm::raw_ostream &MPInt::print(llvm::raw_ostream &os) const {
27 if (isSmall())
28 return os << valSmall;
29 return os << valLarge;
30}
31
32void MPInt::dump() const { print(os&: llvm::errs()); }
33
34llvm::raw_ostream &mlir::presburger::operator<<(llvm::raw_ostream &os,
35 const MPInt &x) {
36 x.print(os);
37 return os;
38}
39

source code of mlir/lib/Analysis/Presburger/MPInt.cpp