xref: /llvm-project/llvm/lib/Support/DynamicAPInt.cpp (revision 1a0e67d73023e7ad9e7e79f66afb43a6f2561d04)
1 //===- DynamicAPInt.cpp - DynamicAPInt Implementation -----------*- C++ -*-===//
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 #include "llvm/ADT/DynamicAPInt.h"
9 #include "llvm/ADT/Hashing.h"
10 #include "llvm/Support/Debug.h"
11 #include "llvm/Support/raw_ostream.h"
12 
13 using namespace llvm;
14 
15 hash_code llvm::hash_value(const DynamicAPInt &X) {
16   if (X.isSmall())
17     return llvm::hash_value(X.getSmall());
18   return detail::hash_value(X.getLarge());
19 }
20 
21 raw_ostream &DynamicAPInt::print(raw_ostream &OS) const {
22   if (isSmall())
23     return OS << ValSmall;
24   return OS << ValLarge;
25 }
26 
27 void DynamicAPInt::dump() const { print(dbgs()); }
28