Skip to content

Commit

Permalink
Simplify, as suggested in PR
Browse files Browse the repository at this point in the history
  • Loading branch information
mdboom committed Oct 18, 2024
1 parent 383f97a commit 8e47990
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions Tools/jit/_stencils.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,7 @@ def _get_trampoline_mask(self) -> str:
word = bitmask & ((1 << 32) - 1)
trampoline_mask.append(f"{word:#04x}")
bitmask >>= 32
if len(trampoline_mask):
return "{" + ", ".join(trampoline_mask) + "}"
else:
return "{0}"
return "{" + (", ".join(trampoline_mask) or "0") + "}"

def as_c(self, opname: str) -> str:
"""Dump this hole as a StencilGroup initializer."""
Expand Down
4 changes: 2 additions & 2 deletions Tools/jit/_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def _dump_footer(
yield f" [{opname}] = {group.as_c(opname)},"
yield "};"
yield ""
yield f"static const void * const symbols_map[{max(len(symbols), 1)}] = {{"
if len(symbols):
yield "static const void * const symbols_map[] = {"
if symbols:
for symbol, ordinal in symbols.items():
yield f" [{ordinal}] = &{symbol},"
else:
Expand Down

0 comments on commit 8e47990

Please sign in to comment.