LLVM API Documentation

DeserializeAPInt.cpp

Go to the documentation of this file.
00001 //===-- DeserializeAPInt.cpp - Deserialization for APInts ------*- C++ -*--===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file implements deserialization of APInts.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #include "llvm/ADT/APInt.h"
00015 #include "llvm/Bitcode/Deserialize.h"
00016 #include <cassert>
00017 
00018 using namespace llvm;
00019 
00020 void APInt::Read(Deserializer& D) {
00021   BitWidth = D.ReadInt();
00022   
00023   if (isSingleWord())
00024     VAL = D.ReadInt();
00025   else {
00026     uint32_t NumWords = D.ReadInt();
00027     assert (NumWords > 1);
00028     pVal = new uint64_t[NumWords];
00029     assert (pVal && "Allocation in deserialization of APInt failed.");
00030     for (unsigned i = 0; i < NumWords; ++i)
00031       pVal[i] = D.ReadInt();    
00032   }
00033 }