1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-10-04 01:57:54 +00:00

Applies minor style improvements.

This commit is contained in:
Thomas Harte 2018-07-01 15:38:42 -04:00
parent f75af3b45e
commit 77feee8197

View File

@ -53,7 +53,7 @@ PCMSegment &PCMSegment::operator +=(const PCMSegment &rhs) {
Storage::Disk::Track::Event PCMSegmentEventSource::get_next_event() { Storage::Disk::Track::Event PCMSegmentEventSource::get_next_event() {
// track the initial bit pointer for potentially considering whether this was an // track the initial bit pointer for potentially considering whether this was an
// initial index hole or a subsequent one later on // initial index hole or a subsequent one later on
std::size_t initial_bit_pointer = bit_pointer_; const std::size_t initial_bit_pointer = bit_pointer_;
// if starting from the beginning, pull half a bit backward, as if the initial bit // if starting from the beginning, pull half a bit backward, as if the initial bit
// is set, it should be in the centre of its window // is set, it should be in the centre of its window
@ -89,7 +89,7 @@ Storage::Time PCMSegmentEventSource::get_length() {
Storage::Time PCMSegmentEventSource::seek_to(const Time &time_from_start) { Storage::Time PCMSegmentEventSource::seek_to(const Time &time_from_start) {
// test for requested time being beyond the end // test for requested time being beyond the end
Time length = get_length(); const Time length = get_length();
if(time_from_start >= length) { if(time_from_start >= length) {
next_event_.type = Track::Event::IndexHole; next_event_.type = Track::Event::IndexHole;
bit_pointer_ = segment_->data.size()+1; bit_pointer_ = segment_->data.size()+1;
@ -104,14 +104,13 @@ Storage::Time PCMSegmentEventSource::seek_to(const Time &time_from_start) {
half_bit_length.length >>= 1; half_bit_length.length >>= 1;
if(time_from_start < half_bit_length) { if(time_from_start < half_bit_length) {
bit_pointer_ = 0; bit_pointer_ = 0;
Storage::Time zero; return Storage::Time(0);
return zero;
} }
// adjust for time to get to bit zero and determine number of bits in; // adjust for time to get to bit zero and determine number of bits in;
// bit_pointer_ always records _the next bit_ that might trigger an event, // bit_pointer_ always records _the next bit_ that might trigger an event,
// so should be one beyond the one reached by a seek. // so should be one beyond the one reached by a seek.
Time relative_time = time_from_start - half_bit_length; const Time relative_time = time_from_start - half_bit_length;
bit_pointer_ = 1 + (relative_time / segment_->length_of_a_bit).get<unsigned int>(); bit_pointer_ = 1 + (relative_time / segment_->length_of_a_bit).get<unsigned int>();
// map up to the correct amount of time // map up to the correct amount of time