Skip to content

Commit 9ed8595

Browse files
committed
Replaced casts with type literals
1 parent 41b7703 commit 9ed8595

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

external/MathHelper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ SYCL_EXTERNAL std::pair<float, vecType> getDistanceAndNiw(vecType point, std::ar
4848
if (lSquared == 0.0) {
4949
return {0, {0, 0}};
5050
}
51-
float t = std::max(float(0.0), std::min(float(1.0), dotProduct(AP, AB) / lSquared));
51+
float t = std::max(0.0f, std::min(1.0f, dotProduct(AP, AB) / lSquared));
5252
auto projection = t * AB;
5353

5454
return {distance(AP, projection), normalize(AP - projection)};

external/VectorMaths.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ SYCL_EXTERNAL vecType operator*(float s, vecType a) {
5151
}
5252

5353
SYCL_EXTERNAL vecType operator/=(vecType& a, float s) {
54-
a[0] /= float(s);
55-
a[1] /= float(s);
54+
a[0] /= s;
55+
a[1] /= s;
5656
return a;
5757
}
5858

src/main.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,40 +22,40 @@ void init(SDL_Window* &win, SDL_Renderer* &render, std::vector<Actor> &actors) {
2222

2323
for (int i = 0; i < 5; i++) {
2424
for (int j = 0; j < 5; j++) {
25-
actors.push_back(Actor{{float(0.5 + (i * 0.5)), float(0.5 + (j * 0.5))},
25+
actors.push_back(Actor{{0.5f + (i * 0.5f), 0.5f + (j * 0.5f)},
2626
{0.01, 0.01},
2727
{0.02, 0.02},
28-
{float(6.5 + (i * 0.5)), float(6.5 + (j * 0.5))},
28+
{6.5f + (i * 0.5f), 6.5f + (j * 0.5f)},
2929
50, 0.05, false, {255, 0, 0}});
3030
}
3131
}
3232

3333
for (int i = 0; i < 5; i++) {
3434
for (int j = 0; j < 5; j++) {
35-
actors.push_back(Actor{{float(6.5 + (i * 0.5)), float(0.5 + (j * 0.5))},
35+
actors.push_back(Actor{{6.5f + (i * 0.5f), 0.5f + (j * 0.5f)},
3636
{0.01, 0.01},
3737
{0.02, 0.02},
38-
{float(0.5 + (i * 0.5)), float(6.5 + (j * 0.5))},
38+
{0.5f + (i * 0.5f), 6.5f + (j * 0.5f)},
3939
50, 0.05, false, {0, 255, 0}});
4040
}
4141
}
4242

4343
for (int i = 0; i < 5; i++) {
4444
for (int j = 0; j < 5; j++) {
45-
actors.push_back(Actor{{float(6.5 + (i * 0.5)), float(6.5 + (j * 0.5))},
45+
actors.push_back(Actor{{6.5f + (i * 0.5f), 6.5f + (j * 0.5f)},
4646
{0.01, 0.01},
4747
{0.02, 0.02},
48-
{float(0.5 + (i * 0.5)), float(0.5 + (j * 0.5))},
48+
{0.5f + (i * 0.5f), 0.5f + (j * 0.5f)},
4949
50, 0.05, false, {0, 0, 255}});
5050
}
5151
}
5252

5353
for (int i = 0; i < 5; i++) {
5454
for (int j = 0; j < 5; j++) {
55-
actors.push_back(Actor{{float(0.5 + (i * 0.5)), float(6.5 + (j * 0.5))},
55+
actors.push_back(Actor{{0.5f + (i * 0.5f), 6.5f + (j * 0.5f)},
5656
{0.01, 0.01},
5757
{0.02, 0.02},
58-
{float(6.5 + (i * 0.5)), float(0.5 + (j * 0.5))},
58+
{6.5f + (i * 0.5f), 0.5f + (j * 0.5f)},
5959
50, 0.05, false, {150, 150, 150}});
6060
}
6161
}

0 commit comments

Comments
 (0)