mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
Change Constant::get to support negative values
This commit is contained in:
parent
272c568bfc
commit
350b004e79
3 changed files with 4 additions and 4 deletions
|
|
@ -366,7 +366,7 @@ void Compiler::compileBasicBlock(BasicBlock& basicBlock, bytesConstRef bytecode,
|
|||
case Instruction::BNOT:
|
||||
{
|
||||
auto value = stack.pop();
|
||||
auto ret = m_builder.CreateXor(value, llvm::APInt(256, -1, true), "bnot");
|
||||
auto ret = m_builder.CreateXor(value, Constant::get(-1), "bnot");
|
||||
stack.push(ret);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,9 +36,9 @@ void Type::init(llvm::LLVMContext& _context)
|
|||
RuntimePtr = RuntimeData::getType()->getPointerTo();
|
||||
}
|
||||
|
||||
llvm::ConstantInt* Constant::get(uint64_t _n)
|
||||
llvm::ConstantInt* Constant::get(int64_t _n)
|
||||
{
|
||||
return llvm::ConstantInt::get(Type::i256, _n);
|
||||
return llvm::ConstantInt::getSigned(Type::i256, _n);
|
||||
}
|
||||
|
||||
llvm::ConstantInt* Constant::get(u256 _n)
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ enum class ReturnCode
|
|||
struct Constant
|
||||
{
|
||||
/// Returns word-size constant
|
||||
static llvm::ConstantInt* get(uint64_t _n);
|
||||
static llvm::ConstantInt* get(int64_t _n);
|
||||
static llvm::ConstantInt* get(u256 _n);
|
||||
|
||||
static llvm::ConstantInt* get(ReturnCode _returnCode);
|
||||
|
|
|
|||
Loading…
Reference in a new issue