mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 04:36:42 +00:00
Byte swap for constants
This commit is contained in:
parent
3df5a125fa
commit
5be8c59ff1
1 changed files with 3 additions and 0 deletions
|
|
@ -22,6 +22,9 @@ llvm::Value* Endianness::bswapIfLE(llvm::IRBuilder<>& _builder, llvm::Value* _wo
|
||||||
|
|
||||||
if (tester{1}.isLE)
|
if (tester{1}.isLE)
|
||||||
{
|
{
|
||||||
|
if (auto constant = llvm::dyn_cast<llvm::ConstantInt>(_word))
|
||||||
|
return _builder.getInt(constant->getValue().byteSwap());
|
||||||
|
|
||||||
// OPT: Cache func declaration?
|
// OPT: Cache func declaration?
|
||||||
auto bswapFunc = llvm::Intrinsic::getDeclaration(_builder.GetInsertBlock()->getParent()->getParent(), llvm::Intrinsic::bswap, Type::Word);
|
auto bswapFunc = llvm::Intrinsic::getDeclaration(_builder.GetInsertBlock()->getParent()->getParent(), llvm::Intrinsic::bswap, Type::Word);
|
||||||
return _builder.CreateCall(bswapFunc, _word);
|
return _builder.CreateCall(bswapFunc, _word);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue