Fix "for" incosistencies

This commit is contained in:
ReinUsesLisp 2018-10-23 05:09:17 -03:00
parent 6a2d1da742
commit 8c1ab76ce5
3 changed files with 6 additions and 6 deletions

View file

@ -15,10 +15,10 @@ LiteralString::LiteralString(const std::string& string) : string(string) {
LiteralString::~LiteralString() = default;
void LiteralString::Fetch(Stream& stream) const {
for (std::size_t i{}; i < string.size(); i++) {
for (std::size_t i = 0; i < string.size(); i++) {
stream.Write(static_cast<u8>(string[i]));
}
for (std::size_t i{}; i < 4 - (string.size() % 4); i++) {
for (std::size_t i = 0; i < 4 - (string.size() % 4); i++) {
stream.Write(static_cast<u8>(0));
}
}

View file

@ -35,7 +35,7 @@ bool Op::operator==(const Operand& other) const {
const Op& op = dynamic_cast<const Op&>(other);
if (op.opcode == opcode && result_type == op.result_type &&
operands.size() == op.operands.size()) {
for (std::size_t i{}; i < operands.size(); i++) {
for (std::size_t i = 0; i < operands.size(); i++) {
if (*operands[i] != *op.operands[i]) {
return false;
}
@ -55,7 +55,7 @@ void Op::Write(Stream& stream) const {
if (id.has_value()) {
stream.Write(id.value());
}
for (const Operand* operand : operands) {
for (const auto* operand : operands) {
operand->Fetch(stream);
}
}
@ -66,7 +66,7 @@ void Op::Sink(Operand* operand) {
}
void Op::Sink(const std::vector<Operand*>& operands) {
for (Operand* operand : operands) {
for (auto* operand : operands) {
Sink(operand);
}
}

View file

@ -41,7 +41,7 @@ std::vector<u8> Module::Assemble() const {
stream.Write(bound);
stream.Write(static_cast<u32>(0));
for (auto capability : capabilities) {
for (const auto capability : capabilities) {
WriteEnum(stream, spv::Op::OpCapability, capability);
}
// TODO write extensions