Skip to content

Use unordered_map instead of vector for primitives#384

Draft
MaartenS11 wants to merge 1 commit into
mainfrom
feat/primitive-map
Draft

Use unordered_map instead of vector for primitives#384
MaartenS11 wants to merge 1 commit into
mainfrom
feat/primitive-map

Conversation

@MaartenS11

Copy link
Copy Markdown
Member

Technically this should be faster than a linear search + it allows overwriting primitives that you already have. For example:

wac->interpreter->register_primitive("chip_digital_write", [](Module *m) -> bool {
    pop_args(2);
    printf("custom chip_digital_write behaviour!\n");
    return true;
}, &twoToNoneU32);

This overwriting is particularly useful for the concolic version of the interpreter so that it can have custom implementations that for example push symbolic variables.

Technically this should be faster than a linear search + it allows overwriting primitives that you already have. For example:
```cpp
wac->interpreter->register_primitive("chip_digital_write", [](Module *m) -> bool {
    pop_args(2);
    printf("chip_digital_write\n");
    return true;
}, &twoToNoneU32);
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant