Skip to content

Commit

Permalink
Remove obsolete convenience method
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Oct 19, 2024
1 parent cd9673d commit ab0d4ba
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 17 deletions.
9 changes: 0 additions & 9 deletions cpp/base/memory_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,6 @@ void memory_util::SetInt32(vector<T> &buf, int offset, uint32_t value)
template void memory_util::SetInt32(vector<byte>&, int, uint32_t);
template void memory_util::SetInt32(vector<uint8_t>&, int, uint32_t);

void memory_util::SetInt24(span<uint8_t> buf, int offset, int value)
{
assert(buf.size() > static_cast<size_t>(offset) + 2);

buf[offset] = static_cast<uint8_t>(value >> 16);
buf[offset + 1] = static_cast<uint8_t>(value >> 8);
buf[offset + 2] = static_cast<uint8_t>(value);
}

int memory_util::GetInt24(span<const int> buf, int offset)
{
assert(buf.size() > static_cast<size_t>(offset) + 2);
Expand Down
1 change: 0 additions & 1 deletion cpp/base/memory_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ int GetInt16(const auto &buf, int offset)
template<typename T> void SetInt16(vector<T>&, int, int);
template<typename T> void SetInt32(vector<T>&, int, uint32_t);

void SetInt24(span<uint8_t>, int, int);
int GetInt24(span<const int>, int);
int32_t GetSignedInt24(span<const int>, int);
uint32_t GetInt32(span<const int>, int);
Expand Down
4 changes: 2 additions & 2 deletions cpp/devices/storage_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ int StorageDevice::ModeSense6(cdb_t cdb, vector<uint8_t> &buf) const

// Short LBA mode parameter block descriptor (number of blocks and block length)
SetInt32(buf, 4, static_cast<uint32_t>(blocks <= 0xffffffff ? blocks : 0xffffffff));
SetInt24(buf, 9, block_size);
SetInt32(buf, 8, block_size);

size += 8;
}
Expand Down Expand Up @@ -443,7 +443,7 @@ int StorageDevice::ModeSense10(cdb_t cdb, vector<uint8_t> &buf) const

// Short LBA mode parameter block descriptor (number of blocks and block length)
SetInt32(buf, 8, static_cast<uint32_t>(blocks <= 0xffffffff ? blocks : 0xffffffff));
SetInt24(buf, 13, block_size);
SetInt32(buf, 12, block_size);

size += 8;
}
Expand Down
7 changes: 2 additions & 5 deletions cpp/devices/tape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,13 +370,10 @@ void Tape::Erase6()

void Tape::ReadBlockLimits()
{
vector<uint8_t> &buf = GetController()->GetBuffer();
buf[0] = 0;

vector<uint32_t> sorted_sizes = { GetSupportedBlockSizes().cbegin(), GetSupportedBlockSizes().cend() };
ranges::sort(sorted_sizes);
SetInt24(buf, 1, sorted_sizes.back());
SetInt16(buf, 4, 4);
SetInt32(GetController()->GetBuffer(), 0, sorted_sizes.back());
SetInt16(GetController()->GetBuffer(), 4, 4);

DataInPhase(6);
}
Expand Down

0 comments on commit ab0d4ba

Please sign in to comment.