summaryrefslogtreecommitdiff
path: root/src/wasm-features.h
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2019-04-26 16:59:41 -0700
committerGitHub <noreply@github.com>2019-04-26 16:59:41 -0700
commitdb9124f1de0478dcac525009b6f1589b44a7edd8 (patch)
treefa26395a0f6cca53cf5cb6e10189f989c5bfa847 /src/wasm-features.h
parent87636dccd404a340d75acb1d96301581343f29ca (diff)
downloadbinaryen-db9124f1de0478dcac525009b6f1589b44a7edd8.tar.gz
binaryen-db9124f1de0478dcac525009b6f1589b44a7edd8.tar.bz2
binaryen-db9124f1de0478dcac525009b6f1589b44a7edd8.zip
Apply format changes from #2048 (#2059)
Mass change to apply clang-format to everything. We are applying this in a PR by me so the (git) blame is all mine ;) but @aheejin did all the work to get clang-format set up and all the manual work to tidy up some things to make the output nicer in #2048
Diffstat (limited to 'src/wasm-features.h')
-rw-r--r--src/wasm-features.h50
1 files changed, 31 insertions, 19 deletions
diff --git a/src/wasm-features.h b/src/wasm-features.h
index 6ef704f82..d31715f18 100644
--- a/src/wasm-features.h
+++ b/src/wasm-features.h
@@ -36,13 +36,20 @@ struct FeatureSet {
static std::string toString(Feature f) {
switch (f) {
- case Atomics: return "threads";
- case MutableGlobals: return "mutable-globals";
- case TruncSat: return "nontrapping-float-to-int";
- case SIMD: return "simd";
- case BulkMemory: return "bulk-memory";
- case SignExt: return "sign-ext";
- default: WASM_UNREACHABLE();
+ case Atomics:
+ return "threads";
+ case MutableGlobals:
+ return "mutable-globals";
+ case TruncSat:
+ return "nontrapping-float-to-int";
+ case SIMD:
+ return "simd";
+ case BulkMemory:
+ return "bulk-memory";
+ case SignExt:
+ return "sign-ext";
+ default:
+ WASM_UNREACHABLE();
}
}
@@ -60,7 +67,9 @@ struct FeatureSet {
bool hasAll() const { return features & All; }
void makeMVP() { features = MVP; }
- void set(Feature f, bool v = true) { features = v ? (features | f) : (features & ~f); }
+ 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); }
@@ -74,14 +83,19 @@ struct FeatureSet {
features = features & ~other.features & All;
}
- template<typename F>
- void iterFeatures(F f) {
- if (hasAtomics()) f(Atomics);
- if (hasBulkMemory()) f(BulkMemory);
- if (hasMutableGlobals()) f(MutableGlobals);
- if (hasTruncSat()) f(TruncSat);
- if (hasSignExt()) f(SignExt);
- if (hasSIMD()) f(SIMD);
+ template<typename F> void iterFeatures(F f) {
+ if (hasAtomics())
+ f(Atomics);
+ if (hasBulkMemory())
+ f(BulkMemory);
+ if (hasMutableGlobals())
+ f(MutableGlobals);
+ if (hasTruncSat())
+ f(TruncSat);
+ if (hasSignExt())
+ f(SignExt);
+ if (hasSIMD())
+ f(SIMD);
}
bool operator<=(const FeatureSet& other) const {
@@ -92,9 +106,7 @@ struct FeatureSet {
return *this <= other && other <= *this;
}
- bool operator!=(const FeatureSet& other) const {
- return !(*this == other);
- }
+ bool operator!=(const FeatureSet& other) const { return !(*this == other); }
FeatureSet& operator|=(const FeatureSet& other) {
features |= other.features;