LLVM API Documentation

SerializeAPInt.cpp

Go to the documentation of this file.
00001 //===-- SerializeAPInt.cpp - Serialization 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 serialization of APInts.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #include "llvm/ADT/APInt.h"
00015 #include "llvm/Bitcode/Serialize.h"
00016 #include <cassert>
00017 
00018 using namespace llvm;
00019 
00020 void APInt::Emit(Serializer& S) const {
00021   S.EmitInt(BitWidth);
00022 
00023   if (isSingleWord())
00024     S.EmitInt(VAL);
00025   else {
00026     uint32_t NumWords = getNumWords();
00027     S.EmitInt(NumWords);
00028     for (unsigned i = 0; i < NumWords; ++i)
00029       S.EmitInt(pVal[i]);
00030   }
00031 }