1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-08-05 08:26:28 +00:00

Throw in some consts.

This commit is contained in:
Thomas Harte
2025-04-25 23:17:00 -04:00
parent ad37c0d2ac
commit 9790b4d2e9
2 changed files with 8 additions and 8 deletions

View File

@@ -116,7 +116,7 @@ Storage::Time PCMSegmentEventSource::get_length() {
return segment_->length_of_a_bit * unsigned(segment_->data.size());
}
float PCMSegmentEventSource::seek_to(float time_from_start) {
float PCMSegmentEventSource::seek_to(const float time_from_start) {
// test for requested time being beyond the end
const float length = get_length().get<float>();
if(time_from_start >= length) {

View File

@@ -49,7 +49,7 @@ struct PCMSegment {
Constructs an instance of PCMSegment with the specified @c length_of_a_bit
and @c data.
*/
PCMSegment(Time length_of_a_bit, const std::vector<bool> &data)
PCMSegment(const Time length_of_a_bit, const std::vector<bool> &data)
: length_of_a_bit(length_of_a_bit), data(data) {}
/*!
@@ -57,7 +57,7 @@ struct PCMSegment {
long and @c data is populated from the supplied @c source by serialising it
from MSB to LSB for @c number_of_bits.
*/
PCMSegment(size_t number_of_bits, const uint8_t *source)
PCMSegment(const size_t number_of_bits, const uint8_t *source)
: data(number_of_bits, false) {
for(size_t c = 0; c < number_of_bits; ++c) {
if((source[c >> 3] >> (7 ^ (c & 7)))&1) {
@@ -71,7 +71,7 @@ struct PCMSegment {
specified by @c length_of_a_bit, and @c data is populated from the supplied
@c source by serialising it from MSB to LSB for @c number_of_bits.
*/
PCMSegment(Time length_of_a_bit, size_t number_of_bits, const uint8_t *source)
PCMSegment(const Time length_of_a_bit, const size_t number_of_bits, const uint8_t *const source)
: PCMSegment(number_of_bits, source) {
this->length_of_a_bit = length_of_a_bit;
}
@@ -81,7 +81,7 @@ struct PCMSegment {
specified by @c length_of_a_bit, and @c data is populated from the supplied
@c source by serialising it from MSB to LSB for @c number_of_bits.
*/
PCMSegment(Time length_of_a_bit, size_t number_of_bits, const std::vector<uint8_t> &source) :
PCMSegment(const Time length_of_a_bit, const size_t number_of_bits, const std::vector<uint8_t> &source) :
PCMSegment(length_of_a_bit, number_of_bits, source.data()) {}
/*!
@@ -89,7 +89,7 @@ struct PCMSegment {
long and @c data is populated from the supplied @c source by serialising it
from MSB to LSB for @c number_of_bits.
*/
PCMSegment(size_t number_of_bits, const std::vector<uint8_t> &source) :
PCMSegment(const size_t number_of_bits, const std::vector<uint8_t> &source) :
PCMSegment(number_of_bits, source.data()) {}
/*!
@@ -127,7 +127,7 @@ struct PCMSegment {
If @c msb_first is @c false then each byte is expected to be deserialised from
LSB to MSB.
*/
std::vector<uint8_t> byte_data(bool msb_first = true) const {
std::vector<uint8_t> byte_data(const bool msb_first = true) const {
std::vector<uint8_t> bytes((data.size() + 7) >> 3);
size_t pointer = 0;
const size_t pointer_mask = msb_first ? 7 : 0;
@@ -182,7 +182,7 @@ public:
@returns the time the source is now at.
*/
float seek_to(float time_from_start);
float seek_to(const float time_from_start);
/*!
@returns the total length of the stream of data that the source will provide.