1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:07:34 +00:00

LibWasm: Replace the numeric operation macros with templated functions

This should make debugging and profiling much better, at little to no
runtime cost.
Also moves off the operator definitions to a separate header, so it
should also improve the editing experience quite a bit.
This commit is contained in:
Ali Mohammad Pur 2021-08-09 02:55:01 +04:30 committed by Andreas Kling
parent 799471d16f
commit 563b402f04
5 changed files with 662 additions and 357 deletions

View file

@ -10,13 +10,13 @@
namespace Wasm {
Optional<Label> Configuration::nth_label(size_t i)
Optional<size_t> Configuration::nth_label_index(size_t i)
{
for (size_t index = m_stack.size(); index > 0; --index) {
auto& entry = m_stack.entries()[index - 1];
if (auto ptr = entry.get_pointer<Label>()) {
if (entry.has<Label>()) {
if (i == 0)
return *ptr;
return index - 1;
--i;
}
}