From e4ad86cafeb6d636ccf96e2deefedbc388612a6e Mon Sep 17 00:00:00 2001 From: Thomas Lively <7121787+tlively@users.noreply.github.com> Date: Wed, 12 Dec 2018 18:40:09 -0800 Subject: Create API for feature dependent picking in fuzzer (#1821) --- src/wasm.h | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'src/wasm.h') 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; -- cgit v1.2.3