<commit_before>
#include "Type.h"

#include <llvm/IR/DerivedTypes.h>

#include "Runtime.h"

namespace dev
{
namespace eth
{
namespace jit
{

llvm::IntegerType* Type::i256;
llvm::PointerType* Type::WordPtr;
llvm::IntegerType* Type::lowPrecision;
llvm::IntegerType* Type::Size;
llvm::IntegerType* Type::Byte;
llvm::PointerType* Type::BytePtr;
llvm::Type* Type::Void;
llvm::IntegerType* Type::MainReturn;
llvm::PointerType* Type::RuntimePtr;

void Type::init(llvm::LLVMContext& _context)
{
	i256 = llvm::Type::getIntNTy(_context, 256);
	WordPtr = i256->getPointerTo();
	lowPrecision = llvm::Type::getInt64Ty(_context);
	// TODO: Size should be architecture-dependent
	Size = llvm::Type::getInt64Ty(_context);
	Byte = llvm::Type::getInt8Ty(_context);
	BytePtr = Byte->getPointerTo();
	Void = llvm::Type::getVoidTy(_context);
	MainReturn = llvm::Type::getInt32Ty(_context);
	RuntimePtr = RuntimeData::getType()->getPointerTo();
}

llvm::ConstantInt* Constant::get(uint64_t _n)
{
	return llvm::ConstantInt::get(Type::i256, _n);
}

llvm::ConstantInt* Constant::get(u256 _n)
{
	auto limbs = _n.backend().limbs();
	auto words = reinterpret_cast<uint64_t*>(limbs);
	llvm::APInt n(256, 4, words);
	return static_cast<llvm::ConstantInt*>(llvm::ConstantInt::get(Type::i256, n));
}

llvm::ConstantInt* Constant::get(ReturnCode _returnCode)
{
	return llvm::ConstantInt::get(Type::MainReturn, static_cast<uint64_t>(_returnCode));
}

}
}
}
<commit_msg>Fix u256 to APInt conversion<commit_after>
#include "Type.h"

#include <llvm/IR/DerivedTypes.h>

#include "Runtime.h"

namespace dev
{
namespace eth
{
namespace jit
{

llvm::IntegerType* Type::i256;
llvm::PointerType* Type::WordPtr;
llvm::IntegerType* Type::lowPrecision;
llvm::IntegerType* Type::Size;
llvm::IntegerType* Type::Byte;
llvm::PointerType* Type::BytePtr;
llvm::Type* Type::Void;
llvm::IntegerType* Type::MainReturn;
llvm::PointerType* Type::RuntimePtr;

void Type::init(llvm::LLVMContext& _context)
{
	i256 = llvm::Type::getIntNTy(_context, 256);
	WordPtr = i256->getPointerTo();
	lowPrecision = llvm::Type::getInt64Ty(_context);
	// TODO: Size should be architecture-dependent
	Size = llvm::Type::getInt64Ty(_context);
	Byte = llvm::Type::getInt8Ty(_context);
	BytePtr = Byte->getPointerTo();
	Void = llvm::Type::getVoidTy(_context);
	MainReturn = llvm::Type::getInt32Ty(_context);
	RuntimePtr = RuntimeData::getType()->getPointerTo();
}

llvm::ConstantInt* Constant::get(uint64_t _n)
{
	return llvm::ConstantInt::get(Type::i256, _n);
}

llvm::ConstantInt* Constant::get(u256 _n)
{
	auto& backend = _n.backend();
	auto words = reinterpret_cast<uint64_t*>(backend.limbs());
	auto nWords = backend.limb_bits == 64 ? backend.size() : (backend.size() + 1) / 2;
	llvm::APInt n(256, nWords, words);
	assert(n.toString(10, false) == _n.str());
	return static_cast<llvm::ConstantInt*>(llvm::ConstantInt::get(Type::i256, n));
}

llvm::ConstantInt* Constant::get(ReturnCode _returnCode)
{
	return llvm::ConstantInt::get(Type::MainReturn, static_cast<uint64_t>(_returnCode));
}

}
}
}

{'fraction_non_alphanumeric': 0.17598412173337744, 'fraction_numerical': 0.027786966589480648, 'mean_word_length': 8.13595166163142, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1259103', 'n_tokens_mistral': 1118, 'n_tokens_neox': 1088, 'n_words': 187}