Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike-Leo-Smith committed Nov 1, 2024
1 parent 1505d19 commit df5e75e
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/xir/translators/xir2text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,6 @@ class XIR2TextTranslator final {
luisa::unordered_map<const Type *, uint> _struct_uid_map;

private:
void _emit_constant(const Constant *c) noexcept {
auto t = _type_ident(c->type());
auto v = _value_ident(c);
if (!c->metadata_list().empty()) {
_emit_metadata_list(_prelude, c->metadata_list());
_prelude << "\n";
}
_prelude << "const %" << v << ": " << t << " = ";
auto size = c->type()->size();
for (auto i = 0u; i < size; i++) {
auto x = static_cast<const uint8_t *>(c->data())[i];
_prelude << luisa::format("{:02x}", static_cast<uint>(x));
}
_prelude << ";\n\n";
}

[[nodiscard]] auto _value_uid(const Value *value) noexcept {
LUISA_ASSERT(value != nullptr, "Value must not be null.");
auto next_uid = static_cast<uint>(_value_uid_map.size());
Expand Down Expand Up @@ -126,6 +110,22 @@ class XIR2TextTranslator final {
for (int i = 0; i < indent; i++) { _main << " "; }
}

void _emit_constant(const Constant *c) noexcept {
auto t = _type_ident(c->type());
auto v = _value_ident(c);
if (!c->metadata_list().empty()) {
_emit_metadata_list(_prelude, c->metadata_list());
_prelude << "\n";
}
_prelude << "const %" << v << ": " << t << " = ";
auto size = c->type()->size();
for (auto i = 0u; i < size; i++) {
auto x = static_cast<const uint8_t *>(c->data())[i];
_prelude << luisa::format("{:02x}", static_cast<uint>(x));
}
_prelude << ";\n\n";
}

static void _emit_string_escaped(StringScratch &ss, luisa::string_view s) noexcept {
ss << "\"";
for (auto c : s) {
Expand Down

0 comments on commit df5e75e

Please sign in to comment.