mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-20 11:46:44 +00:00
Improve stack binary interface
This commit is contained in:
parent
8cd4326db8
commit
9ba6a7c6d4
1 changed files with 16 additions and 24 deletions
|
|
@ -120,42 +120,34 @@ EXPORT void* evmccrt_stack_create()
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT void evmccrt_stack_push(void* _stack, void* _pWord)
|
EXPORT void evmccrt_stack_push(StackImpl* _stack, i256* _word)
|
||||||
{
|
{
|
||||||
auto stack = static_cast<StackImpl*>(_stack);
|
debugStack("push", *_word);
|
||||||
auto word = static_cast<i256*>(_pWord);
|
_stack->push_back(*_word);
|
||||||
debugStack("push", *word);
|
|
||||||
stack->push_back(*word);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT void evmccrt_stack_pop(void* _stack, void* _pWord)
|
EXPORT void evmccrt_stack_pop(StackImpl* _stack, i256* _outWord)
|
||||||
{
|
{
|
||||||
auto stack = static_cast<StackImpl*>(_stack);
|
assert(!_stack->empty());
|
||||||
assert(!stack->empty());
|
auto word = &_stack->back();
|
||||||
auto word = &stack->back();
|
|
||||||
debugStack("pop", *word);
|
debugStack("pop", *word);
|
||||||
auto outWord = static_cast<i256*>(_pWord);
|
_stack->pop_back();
|
||||||
stack->pop_back();
|
*_outWord = *word;
|
||||||
*outWord = *word;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT void evmccrt_stack_get(void* _stack, uint32_t _index, void* _pWord)
|
EXPORT void evmccrt_stack_get(StackImpl* _stack, uint32_t _index, i256* _outWord)
|
||||||
{
|
{
|
||||||
auto stack = static_cast<StackImpl*>(_stack);
|
assert(_index < _stack->size());
|
||||||
assert(_index < stack->size());
|
auto word = _stack->rbegin() + _index;
|
||||||
auto word = stack->rbegin() + _index;
|
|
||||||
debugStack("get", *word, _index);
|
debugStack("get", *word, _index);
|
||||||
auto outWord = static_cast<i256*>(_pWord);
|
*_outWord = *word;
|
||||||
*outWord = *word;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT void evmccrt_stack_set(void* _stack, uint32_t _index, void* _pWord)
|
EXPORT void evmccrt_stack_set(StackImpl* _stack, uint32_t _index, i256* _word)
|
||||||
{
|
{
|
||||||
auto stack = static_cast<StackImpl*>(_stack);
|
assert(_index < _stack->size());
|
||||||
auto word = static_cast<i256*>(_pWord);
|
*(_stack->rbegin() + _index) = *_word;
|
||||||
assert(_index < stack->size());
|
debugStack("set", *_word, _index);
|
||||||
*(stack->rbegin() + _index) = *word;
|
|
||||||
debugStack("set", *word, _index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue