Path: blob/main/contrib/llvm-project/llvm/lib/Support/DynamicAPInt.cpp
35232 views
//===- DynamicAPInt.cpp - DynamicAPInt Implementation -----------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7#include "llvm/ADT/DynamicAPInt.h"8#include "llvm/ADT/Hashing.h"9#include "llvm/Support/Debug.h"10#include "llvm/Support/raw_ostream.h"1112using namespace llvm;1314hash_code llvm::hash_value(const DynamicAPInt &X) {15if (X.isSmall())16return llvm::hash_value(X.getSmall());17return detail::hash_value(X.getLarge());18}1920void DynamicAPInt::static_assert_layout() {21constexpr size_t ValLargeOffset =22offsetof(DynamicAPInt, ValLarge.Val.BitWidth);23constexpr size_t ValSmallOffset = offsetof(DynamicAPInt, ValSmall);24constexpr size_t ValSmallSize = sizeof(ValSmall);25static_assert(ValLargeOffset >= ValSmallOffset + ValSmallSize);26}2728raw_ostream &DynamicAPInt::print(raw_ostream &OS) const {29if (isSmall())30return OS << ValSmall;31return OS << ValLarge;32}3334void DynamicAPInt::dump() const { print(dbgs()); }353637