summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2016-03-28 15:20:49 +0300
committerJukka Jylänki <jujjyl@gmail.com>2016-03-28 21:40:23 +0300
commit6dabb50603975681c5ae6ac8048abd66a582bf40 (patch)
treeb8b45244ed248611a12f32defdc3e1288c8e1781 /src
parent432163d499f183ed794f50ec4d38919a169fb80f (diff)
downloadbinaryen-6dabb50603975681c5ae6ac8048abd66a582bf40.tar.gz
binaryen-6dabb50603975681c5ae6ac8048abd66a582bf40.tar.bz2
binaryen-6dabb50603975681c5ae6ac8048abd66a582bf40.zip
Avoid the use of CRT pow(2, n) function to generate integer bit patterns, since pow() returns a double. Cleans VS build warnings C4244: '=': conversion from 'double' to 'size_t', possible loss of data.
Diffstat (limited to 'src')
-rw-r--r--src/s2wasm.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/s2wasm.h b/src/s2wasm.h
index e10d365a0..f4c83fe65 100644
--- a/src/s2wasm.h
+++ b/src/s2wasm.h
@@ -703,7 +703,7 @@ class S2WasmBuilder {
curr->align = curr->bytes;
if (attributes[0]) {
assert(strncmp(attributes[0], "p2align=", 8) == 0);
- curr->align = pow(2, getInt(attributes[0] + 8));
+ curr->align = 1U << getInt(attributes[0] + 8);
}
setOutput(curr, assign);
};
@@ -722,7 +722,7 @@ class S2WasmBuilder {
curr->align = curr->bytes;
if (attributes[0]) {
assert(strncmp(attributes[0], "p2align=", 8) == 0);
- curr->align = pow(2, getInt(attributes[0] + 8));
+ curr->align = 1U << getInt(attributes[0] + 8);
}
curr->value = inputs[1];
setOutput(curr, assign);
@@ -1101,7 +1101,7 @@ class S2WasmBuilder {
align = getInt();
skipWhitespace();
}
- align = pow(2, align); // convert from power to actual bytes
+ align = (size_t)1 << align; // convert from power to actual bytes
if (match(".lcomm")) {
parseLcomm(name, align);
return;