Skip to content

Commit

Permalink
karm+vaev: Replaced some && and || by 'and' and 'or'.
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepy-monax committed Jan 23, 2025
1 parent dbac81f commit 157268f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
13 changes: 6 additions & 7 deletions src/libs/karm-image/jpeg/encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static Res<> _encodeMcu(

usize code = 0;
usize codeLength = 0;
if (!dcTable.getCode(coeffLength, code, codeLength)) {
if (not dcTable.getCode(coeffLength, code, codeLength)) {
return Error::invalidData("invalid dc huffman code length");
}
bitWriter.writeBits(code, codeLength);
Expand All @@ -36,21 +36,21 @@ static Res<> _encodeMcu(
for (usize i = 1; i < 64; ++i) {
// find zero run length
u8 numZeroes = 0;
while (i < 64 && mcu[ZIGZAG[i]] == 0) {
while (i < 64 and mcu[ZIGZAG[i]] == 0) {
numZeroes += 1;
i += 1;
}

if (i == 64) {
if (!acTable.getCode(0x00, code, codeLength)) {
if (not acTable.getCode(0x00, code, codeLength))
return Error::invalidData("invalid ac huffman code");
}

bitWriter.writeBits(code, codeLength);
return Ok();
}

while (numZeroes >= 16) {
if (!acTable.getCode(0xF0, code, codeLength))
if (not acTable.getCode(0xF0, code, codeLength))
return Error::invalidData("invalid ac huffman code");

bitWriter.writeBits(code, codeLength);
Expand All @@ -69,9 +69,8 @@ static Res<> _encodeMcu(

// find symbol in table
u8 symbol = numZeroes << 4 | coeffLength;
if (!acTable.getCode(symbol, code, codeLength)) {
if (not acTable.getCode(symbol, code, codeLength))
return Error::invalidData("invalid ac huffman code");
}

bitWriter.writeBits(code, codeLength);
bitWriter.writeBits(coeff, coeffLength);
Expand Down
6 changes: 3 additions & 3 deletions src/libs/karm-image/qoi/encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ Res<> encode(Gfx::Pixels pixels, Io::BEmit& e) {
}

if (
vg_r > -9 && vg_r < 8 &&
vg > -33 && vg < 32 &&
vg_b > -9 && vg_b < 8
vg_r > -9 and vg_r < 8 &&
vg > -33 and vg < 32 &&
vg_b > -9 and vg_b < 8
) {
e.writeU8be(Chunk::LUMA | (vg + 32));
e.writeU8be((vg_r + 8) << 4 | (vg_b + 8));
Expand Down
3 changes: 2 additions & 1 deletion src/web/vaev-layout/flex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,8 @@ struct FlexFormatingContext : public FormatingContext {
for (auto& i : _items) {
Px availableCrossSpace = fa.crossAxis(availableSpace) - i.getMargin(FlexItem::BOTH_CROSS);

if (fa.mainAxis(i.box->style->sizing) == Size::AUTO || fa.crossAxis(i.box->style->sizing) == Size::AUTO)
if (fa.mainAxis(i.box->style->sizing) == Size::AUTO and
fa.crossAxis(i.box->style->sizing) == Size::AUTO)
input.intrinsic = IntrinsicSize::STRETCH_TO_FIT;

i.speculateValues(
Expand Down
3 changes: 1 addition & 2 deletions src/web/vaev-style/select.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,9 +618,8 @@ static Res<Selector> _parseInfixExpr(Selector lhs, Cursor<Css::Sst>& cur, OpCode
}

Res<Selector> Selector::parse(Cursor<Css::Sst>& c) {
if (!c) {
if (not c)
return Error::invalidData("expected selector");
}

logDebugIf(DEBUG_SELECTORS, "PARSING SELECTOR : {}", c);
Selector currentSelector = try$(_parseSelectorElement(c, OpCode::NOP));
Expand Down

0 comments on commit 157268f

Please sign in to comment.