blob: 33cf7f4525ee3056755219e37357550f6e1e9371 [file] [log] [blame]
Ted Kremenek1a43e5f2007-10-26 21:50:10 +00001//===-- SerializeAPInt.cpp - Serialization for APInts ----------*- C++ -*--===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by Ted Kremenek and is distributed under the
6// University of Illinois Open Source License. See LICENSE.TXT for details.
7//
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}