blob: af942fbb27e2dde3f99d12dc58ad6cb40845aa90 [file] [log] [blame]
Ted Kremenek1a43e5f2007-10-26 21:50:10 +00001//===-- DeserializeAPInt.cpp - Deserialization 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 deserialization of APInts.
11//
12//===----------------------------------------------------------------------===//
13
14#include "llvm/ADT/APInt.h"
15#include "llvm/Bitcode/Deserialize.h"
16#include <cassert>
17
18using namespace llvm;
19
20void APInt::Read(Deserializer& D) {
21 BitWidth = D.ReadInt();
22
23 if (isSingleWord())
24 VAL = D.ReadInt();
25 else {
26 uint32_t NumWords = D.ReadInt();
27 assert (NumWords > 1);
28 pVal = new uint64_t[NumWords];
29 assert (pVal && "Allocation in deserialization of APInt failed.");
30 for (unsigned i = 0; i < NumWords; ++i)
31 pVal[i] = D.ReadInt();
32 }
33}