Skip to content

Commit

Permalink
use uint32_t for opcode type.
Browse files Browse the repository at this point in the history
  • Loading branch information
katrinafyi committed Feb 13, 2024
1 parent 992f38d commit 2dc00b4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions aslp-cpp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ CMakeUserPresets.json
compile_commands.json
env.bat
env.ps1
.cache
4 changes: 2 additions & 2 deletions aslp-cpp/include/aslp-cpp/aslp-cpp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class aslp_connection
public:
aslp_connection(const std::string& server_addr, int server_port);
aslp_connection(aslp_connection&&) noexcept;
auto get_opcode(int opcode) -> std::string;
auto get_opcode(uint32_t opcode) -> std::string;
void wait_active();
~aslp_connection();
};
Expand Down Expand Up @@ -54,7 +54,7 @@ class aslp_client {
auto static start(const std::string& addr, int server_port) -> std::unique_ptr<aslp_client>;

/** Returns the semantics for the given opcode, as a newline-separated string. */
auto get_opcode(int opcode) -> std::string;
auto get_opcode(uint32_t opcode) -> std::string;

/** Destroys the aslp_client and terminates the managed server as well. */
virtual ~aslp_client() {
Expand Down
6 changes: 3 additions & 3 deletions aslp-cpp/source/aslp-cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void aslp_connection::wait_active()
std::cout << "\n";
}

std::string aslp_connection::get_opcode(int opcode)
std::string aslp_connection::get_opcode(uint32_t opcode)
{
auto codestr = std::format("{:#x}", opcode);
std::cout << codestr << "\n";
Expand All @@ -165,7 +165,7 @@ std::string aslp_connection::get_opcode(int opcode)
throw std::runtime_error(result["error"]);
}
if (!result.contains("semantics")) {
throw std::runtime_error(result["semantics missing"]);
throw std::runtime_error("semantics missing");
}
return result["semantics"];
}
Expand All @@ -179,7 +179,7 @@ aslp_connection::aslp_connection(const std::string& server_addr,
aslp_connection::aslp_connection(aslp_connection&&) noexcept = default;
aslp_connection::~aslp_connection() = default;

std::string aslp_client::get_opcode(int opcode)
std::string aslp_client::get_opcode(uint32_t opcode)
{
aslp_connection conn {server_addr, server_port};
conn.wait_active();
Expand Down

0 comments on commit 2dc00b4

Please sign in to comment.