summaryrefslogtreecommitdiff
path: root/src/wasm/literal.cpp
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2020-09-30 16:08:00 -0700
committerGitHub <noreply@github.com>2020-09-30 16:08:00 -0700
commit2f6939a2cecc37691a1e474ff15a7801f9509cfb (patch)
treed994f14cb68e95d675d0ac3943c8087c77129b3e /src/wasm/literal.cpp
parentb91603f65c45139ad49dfa257749d100117b763d (diff)
downloadbinaryen-2f6939a2cecc37691a1e474ff15a7801f9509cfb.tar.gz
binaryen-2f6939a2cecc37691a1e474ff15a7801f9509cfb.tar.bz2
binaryen-2f6939a2cecc37691a1e474ff15a7801f9509cfb.zip
Clean up support/bits.h (#3177)
Use overloads instead of templates where applicable and change function names from PascalCase to camelCase. Also puts the functions in the Bits namespace to avoid naming conflicts.
Diffstat (limited to 'src/wasm/literal.cpp')
-rw-r--r--src/wasm/literal.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp
index 54453b356..f42727aeb 100644
--- a/src/wasm/literal.cpp
+++ b/src/wasm/literal.cpp
@@ -472,30 +472,30 @@ std::ostream& operator<<(std::ostream& o, const ExceptionPackage& exn) {
Literal Literal::countLeadingZeroes() const {
if (type == Type::i32) {
- return Literal((int32_t)CountLeadingZeroes(i32));
+ return Literal((int32_t)Bits::countLeadingZeroes(i32));
}
if (type == Type::i64) {
- return Literal((int64_t)CountLeadingZeroes(i64));
+ return Literal((int64_t)Bits::countLeadingZeroes(i64));
}
WASM_UNREACHABLE("invalid type");
}
Literal Literal::countTrailingZeroes() const {
if (type == Type::i32) {
- return Literal((int32_t)CountTrailingZeroes(i32));
+ return Literal((int32_t)Bits::countTrailingZeroes(i32));
}
if (type == Type::i64) {
- return Literal((int64_t)CountTrailingZeroes(i64));
+ return Literal((int64_t)Bits::countTrailingZeroes(i64));
}
WASM_UNREACHABLE("invalid type");
}
Literal Literal::popCount() const {
if (type == Type::i32) {
- return Literal((int32_t)PopCount(i32));
+ return Literal((int32_t)Bits::popCount(i32));
}
if (type == Type::i64) {
- return Literal((int64_t)PopCount(i64));
+ return Literal((int64_t)Bits::popCount(i64));
}
WASM_UNREACHABLE("invalid type");
}
@@ -1149,9 +1149,9 @@ Literal Literal::shrU(const Literal& other) const {
Literal Literal::rotL(const Literal& other) const {
switch (type.getBasic()) {
case Type::i32:
- return Literal(RotateLeft(uint32_t(i32), uint32_t(other.i32)));
+ return Literal(Bits::rotateLeft(uint32_t(i32), uint32_t(other.i32)));
case Type::i64:
- return Literal(RotateLeft(uint64_t(i64), uint64_t(other.i64)));
+ return Literal(Bits::rotateLeft(uint64_t(i64), uint64_t(other.i64)));
default:
WASM_UNREACHABLE("unexpected type");
}
@@ -1160,9 +1160,9 @@ Literal Literal::rotL(const Literal& other) const {
Literal Literal::rotR(const Literal& other) const {
switch (type.getBasic()) {
case Type::i32:
- return Literal(RotateRight(uint32_t(i32), uint32_t(other.i32)));
+ return Literal(Bits::rotateRight(uint32_t(i32), uint32_t(other.i32)));
case Type::i64:
- return Literal(RotateRight(uint64_t(i64), uint64_t(other.i64)));
+ return Literal(Bits::rotateRight(uint64_t(i64), uint64_t(other.i64)));
default:
WASM_UNREACHABLE("unexpected type");
}