blob: 47792c7d089430dbf9b950d30b9fd737afcc6df7 [file] [log] [blame]
Ted Kremenek1a43e5f2007-10-26 21:50:10 +00001//===-- SerializeAPInt.cpp - Serialization for APInts ----------*- C++ -*--===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Ted Kremenek1a43e5f2007-10-26 21:50:10 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This file implements serialization of APInts.
11//
12//===----------------------------------------------------------------------===//
13
14#include "llvm/ADT/APInt.h"
15#include "llvm/Bitcode/Serialize.h"
16#include <cassert>
17
18using namespace llvm;
19
20void APInt::Emit(Serializer& S) const {
21 S.EmitInt(BitWidth);
22
23 if (isSingleWord())
24 S.EmitInt(VAL);
25 else {
26 uint32_t NumWords = getNumWords();
27 S.EmitInt(NumWords);
28 for (unsigned i = 0; i < NumWords; ++i)
29 S.EmitInt(pVal[i]);
30 }
31}