diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2018-12-12 18:40:09 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-12 18:40:09 -0800 |
commit | e4ad86cafeb6d636ccf96e2deefedbc388612a6e (patch) | |
tree | 93f836feca25e017279d54d2494aa40ce50c4822 /src/wasm.h | |
parent | 75b693434b5af75d105af4900b5d0c6048155421 (diff) | |
download | binaryen-e4ad86cafeb6d636ccf96e2deefedbc388612a6e.tar.gz binaryen-e4ad86cafeb6d636ccf96e2deefedbc388612a6e.tar.bz2 binaryen-e4ad86cafeb6d636ccf96e2deefedbc388612a6e.zip |
Create API for feature dependent picking in fuzzer (#1821)
Diffstat (limited to 'src/wasm.h')
-rw-r--r-- | src/wasm.h | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/wasm.h b/src/wasm.h index b7b835ebe..b09b4d7d3 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -50,24 +50,18 @@ struct FeatureSet { FeatureSet(uint32_t features) : features(features) {} bool isMVP() const { return features == MVP; } + bool has(Feature f) { return (features & f) == f; } bool hasAtomics() const { return features & Atomics; } bool hasMutableGlobals() const { return features & MutableGlobals; } bool hasTruncSat() const { return features & TruncSat; } bool hasAll() const { return features & (Atomics | MutableGlobals | TruncSat); } void makeMVP() { features = MVP; } - void setAtomics(bool v = true) { - features = v ? (features | Atomics) : (features & ~Atomics); - } - void setMutableGlobals(bool v = true) { - features = v ? (features | MutableGlobals) : (features & ~MutableGlobals); - } - void setTruncSat(bool v = true) { - features = v ? (features | TruncSat) : (features & ~TruncSat); - } - void setAll(bool v = true) { - features = v ? All : MVP; - } + void set(Feature f, bool v = true) { features = v ? (features | f) : (features & ~f); } + void setAtomics(bool v = true) { set(Atomics, v); } + void setMutableGlobals(bool v = true) { set(MutableGlobals, v); } + void setTruncSat(bool v = true) { set(TruncSat, v); } + void setAll(bool v = true) { features = v ? All : MVP; } private: uint32_t features; |