Skip to content

Commit

Permalink
Use true/false literals when assigning to bools.
Browse files Browse the repository at this point in the history
Found by clang-tidy [modernize-use-bool-literals]

#xls-build-gardener

PiperOrigin-RevId: 683789417
  • Loading branch information
hzeller authored and copybara-github committed Oct 8, 2024
1 parent 3340058 commit a5a5299
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions xls/ir/value_view_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ TEST(PackedBitViewTest, ExtractsUnalignedReallyBigs) {

BitsRope rope(kElementWidth + kBitOffset);
for (int i = 0; i < kBitOffset; i++) {
rope.push_back(0);
rope.push_back(0); // NOLINT(modernize-use-bool-literals)
}
int current_bit = 0;
int current_byte = 0;
Expand Down Expand Up @@ -146,7 +146,7 @@ template <int64_t kBitWidth>
absl::Status TestWidthAndOffset(int bit_offset) {
BitsRope rope(kBitWidth + bit_offset);
for (int i = 0; i < bit_offset; i++) {
rope.push_back(false);
rope.push_back(0); // NOLINT(modernize-use-bool-literals)
}
int current_bit = 0;
int current_byte = 0;
Expand Down Expand Up @@ -217,7 +217,7 @@ TEST(PackedArrayViewTest, ExtractsUnaligned) {

BitsRope rope(kElementBits * kNumElements + kBitOffset);
for (int i = 0; i < kBitOffset; i++) {
rope.push_back(0);
rope.push_back(0); // NOLINT(modernize-use-bool-literals)
}

// Fill the n'th element with n (for each element).
Expand Down Expand Up @@ -252,7 +252,7 @@ TEST(PackedTupleViewTest, ExtractsSimpleUnaligned) {
BitsRope rope(TupleT::kBitCount + kBitOffset);

for (int i = 0; i < kBitOffset; i++) {
rope.push_back(0);
rope.push_back(0); // NOLINT(modernize-use-bool-literals)
}
// Iterate low-to-high, keeping LSb-first ordering.
absl::Span<const Value> elements = value.elements();
Expand Down
2 changes: 1 addition & 1 deletion xls/netlist/function_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ absl::StatusOr<Ast> Parser::ParseInvertNext() {
// see if we have an odd or even count and apply after processing the
// following term.
XLS_ASSIGN_OR_RETURN(Token token, scanner_.Peek());
bool do_negate = 0;
bool do_negate = false;
while (token.kind() == Token::Kind::kInvertFollowing) {
XLS_RETURN_IF_ERROR(scanner_.Pop().status());
do_negate = !do_negate;
Expand Down
2 changes: 1 addition & 1 deletion xls/tools/eval_proc_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ struct ChannelInfo {
int64_t width = -1;
bool port_input = false;
// Is this ready-valid?
bool ready_valid = 0;
bool ready_valid = false;

// Precalculated channel names
std::string channel_ready;
Expand Down

0 comments on commit a5a5299

Please sign in to comment.