xref: /llvm-project/llvm/lib/Support/DynamicAPInt.cpp (revision 76030dc157965498f22411aa863cfe8c76138880)
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 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
22 raw_ostream &DynamicAPInt::print(raw_ostream &OS) const {
23   if (isSmall())
24     return OS << ValSmall;
25   return OS << ValLarge;
26 }
27 
28 void DynamicAPInt::dump() const { print(dbgs()); }
29 #endif
30