From 6dabb50603975681c5ae6ac8048abd66a582bf40 Mon Sep 17 00:00:00 2001 From: Jukka Jylänki Date: Mon, 28 Mar 2016 15:20:49 +0300 Subject: 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. --- src/s2wasm.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') 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; -- cgit v1.2.3