1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-21 17:16:44 +00:00

Made various corrections following a quick for-loop constness audit.

This commit is contained in:
Thomas Harte
2018-04-30 22:23:57 -04:00
parent 9da481b060
commit f4097290c2
19 changed files with 39 additions and 39 deletions
+2 -2
View File
@@ -16,14 +16,14 @@ PCMTrack::PCMTrack() : segment_pointer_(0) {}
PCMTrack::PCMTrack(const std::vector<PCMSegment> &segments) : PCMTrack() {
// sum total length of all segments
Time total_length;
for(auto segment : segments) {
for(const auto &segment : segments) {
total_length += segment.length_of_a_bit * segment.number_of_bits;
}
total_length.simplify();
// each segment is then some proportion of the total; for them all to sum to 1 they'll
// need to be adjusted to be
for(auto segment : segments) {
for(const auto &segment : segments) {
Time original_length_of_segment = segment.length_of_a_bit * segment.number_of_bits;
Time proportion_of_whole = original_length_of_segment / total_length;
proportion_of_whole.simplify();