Ted Kremenek | 1a43e5f | 2007-10-26 21:50:10 +0000 | [diff] [blame] | 1 | //===-- 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 | |
| 18 | using namespace llvm; |
| 19 | |
| 20 | void 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 | } |