Skip to content

Commit 58c4b50

Browse files
authored
Merge pull request #707 from estshorter/fix-issue-692
Fix: Listing 33, 34, 38: Change implicit casts to explicit ones (#692)
2 parents e7e562a + 6efa862 commit 58c4b50

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ Change Log -- Ray Tracing in One Weekend
1212

1313
### _The Next Week_
1414
- Delete: remove unused u,v,w variables in initial `perlin::noise()` function (#684)
15-
- Fix: Listing 15 and `bvh.h`: Add missing `hittable_list.h` include (#690)
15+
- Fix: Listing 15: In `bvh.h`, add missing `hittable_list.h` include (#690)
16+
- Fix: Listing 33, 34, 38: Change implicit casts to explicit ones (#692)
1617

1718

1819
----------------------------------------------------------------------------------------------------

books/RayTracingTheNextWeek.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,9 +1592,9 @@
15921592
auto v = p.y() - floor(p.y());
15931593
auto w = p.z() - floor(p.z());
15941594

1595-
int i = floor(p.x());
1596-
int j = floor(p.y());
1597-
int k = floor(p.z());
1595+
auto i = static_cast<int>(floor(p.x()));
1596+
auto j = static_cast<int>(floor(p.y()));
1597+
auto k = static_cast<int>(floor(p.z()));
15981598
double c[2][2][2];
15991599

16001600
for (int di=0; di < 2; di++)
@@ -1646,9 +1646,9 @@
16461646
w = w*w*(3-2*w);
16471647
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
16481648

1649-
int i = floor(p.x());
1650-
int j = floor(p.y());
1651-
int k = floor(p.z());
1649+
auto i = static_cast<int>(floor(p.x()));
1650+
auto j = static_cast<int>(floor(p.y()));
1651+
auto k = static_cast<int>(floor(p.z()));
16521652
...
16531653
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16541654
[Listing [perlin-smoothed]: <kbd>[perlin.h]</kbd> Perlin smoothed]
@@ -1781,9 +1781,9 @@
17811781
auto v = p.y() - floor(p.y());
17821782
auto w = p.z() - floor(p.z());
17831783
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
1784-
int i = floor(p.x());
1785-
int j = floor(p.y());
1786-
int k = floor(p.z());
1784+
auto i = static_cast<int>(floor(p.x()));
1785+
auto j = static_cast<int>(floor(p.y()));
1786+
auto k = static_cast<int>(floor(p.z()));
17871787
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight
17881788
vec3 c[2][2][2];
17891789
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++

0 commit comments

Comments
 (0)