From 265eb6469a80a7657e9f24cbf59e7e28bd49948c Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 21 Jun 2004 12:12:12 +0000 Subject: Make ConstantBool act like a 1 bit ConstantInt, in order to simplify client code. Patch contributed by Vladimir Prus. llvm-svn: 14280 --- llvm/lib/VMCore/Constants.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'llvm/lib') diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp index e18f9b2e543..9957327bfca 100644 --- a/llvm/lib/VMCore/Constants.cpp +++ b/llvm/lib/VMCore/Constants.cpp @@ -212,12 +212,15 @@ bool ConstantUInt::isAllOnesValue() const { //===----------------------------------------------------------------------===// // Normal Constructors -ConstantBool::ConstantBool(bool V) : ConstantIntegral(Type::BoolTy) { - Val = V; +ConstantIntegral::ConstantIntegral(const Type *Ty, uint64_t V) + : Constant(Ty) { + Val.Unsigned = V; +} + +ConstantBool::ConstantBool(bool V) : ConstantIntegral(Type::BoolTy, V) { } -ConstantInt::ConstantInt(const Type *Ty, uint64_t V) : ConstantIntegral(Ty) { - Val.Unsigned = V; +ConstantInt::ConstantInt(const Type *Ty, uint64_t V) : ConstantIntegral(Ty, V) { } ConstantSInt::ConstantSInt(const Type *Ty, int64_t V) : ConstantInt(Ty, V) { -- cgit v1.2.3