Browse Source

Add support for Big Endian architectures [Delivers #79877740]

cl-refactor
Paweł Bylica 10 years ago
parent
commit
f28f8cc0a5
  1. 13
      libevmjit/Endianness.h

13
libevmjit/Endianness.h

@ -1,6 +1,8 @@
#pragma once
#include <boost/detail/endian.hpp>
#include <llvm/IR/IRBuilder.h>
namespace dev
@ -10,14 +12,19 @@ namespace eth
namespace jit
{
class Endianness
struct Endianness
{
public:
#if defined(BOOST_LITTLE_ENDIAN)
static llvm::Value* toBE(llvm::IRBuilder<>& _builder, llvm::Value* _word) { return bswap(_builder, _word); }
static llvm::Value* toNative(llvm::IRBuilder<>& _builder, llvm::Value* _word) { return bswap(_builder, _word); }
#elif defined(BOOST_BIG_ENDIAN)
static llvm::Value* toBE(llvm::IRBuilder<>&, llvm::Value* _word) { return _word; }
static llvm::Value* toNative(llvm::IRBuilder<>&, llvm::Value* _word) { return _word; }
#endif // Add support for PDP endianness if needed
private:
static llvm::Value* bswap(llvm::IRBuilder<>& _builder, llvm::Value* _word);
};

Loading…
Cancel
Save