Fix type conversions to make Clang 10 happy

Change-Id: I07f30e9bb19e3f7b0486c982bb3c4406a03dd615
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/20161
Reviewed-by: David Neto <dneto@google.com>
diff --git a/src/writer/spirv/operand.cc b/src/writer/spirv/operand.cc
index 1a991ad..6aa7bea 100644
--- a/src/writer/spirv/operand.cc
+++ b/src/writer/spirv/operand.cc
@@ -54,8 +54,9 @@
       break;
     case Kind::kString:
       // SPIR-V always nul-terminates strings. The length is rounded up to a
-      // multiple of 4 bytes with 0 bytes padding the end.
-      val = static_cast<uint32_t>(ceil((str_val_.length() + 1) / 4.0));
+      // multiple of 4 bytes with 0 bytes padding the end. Accounting for the
+      // nul terminator is why '+ 4u' is used here instead of '+ 3u'.
+      val = static_cast<uint32_t>((str_val_.length() + 4u) >> 2);
       break;
   }
   return val;
diff --git a/src/writer/wgsl/generator_impl_constructor_test.cc b/src/writer/wgsl/generator_impl_constructor_test.cc
index 44b65d2..8eba2b1 100644
--- a/src/writer/wgsl/generator_impl_constructor_test.cc
+++ b/src/writer/wgsl/generator_impl_constructor_test.cc
@@ -165,8 +165,10 @@
   ast::ExpressionList mat_values;
 
   for (size_t i = 0; i < 3; i++) {
-    auto lit1 = std::make_unique<ast::FloatLiteral>(&f32, 1.f + (i * 2));
-    auto lit2 = std::make_unique<ast::FloatLiteral>(&f32, 2.f + (i * 2));
+    auto lit1 = std::make_unique<ast::FloatLiteral>(
+        &f32, static_cast<float>(1 + (i * 2)));
+    auto lit2 = std::make_unique<ast::FloatLiteral>(
+        &f32, static_cast<float>(2 + (i * 2)));
 
     ast::ExpressionList values;
     values.push_back(
@@ -196,9 +198,12 @@
   ast::ExpressionList ary_values;
 
   for (size_t i = 0; i < 3; i++) {
-    auto lit1 = std::make_unique<ast::FloatLiteral>(&f32, 1.f + (i * 3));
-    auto lit2 = std::make_unique<ast::FloatLiteral>(&f32, 2.f + (i * 3));
-    auto lit3 = std::make_unique<ast::FloatLiteral>(&f32, 3.f + (i * 3));
+    auto lit1 = std::make_unique<ast::FloatLiteral>(
+        &f32, static_cast<float>(1 + (i * 3)));
+    auto lit2 = std::make_unique<ast::FloatLiteral>(
+        &f32, static_cast<float>(2 + (i * 3)));
+    auto lit3 = std::make_unique<ast::FloatLiteral>(
+        &f32, static_cast<float>(3 + (i * 3)));
 
     ast::ExpressionList values;
     values.push_back(