Skip to content

Commit

Permalink
clSetKernelArg: fix hex logging (unsigned).
Browse files Browse the repository at this point in the history
  • Loading branch information
psyhtest committed Mar 3, 2017
1 parent 90db4c7 commit 5eb908f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cpp/prof.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,9 @@ class ostreamLogger : public Prof::Logger
stream << prefix << sep << call_name << sep << arg_name << sep << std::hex;
for (size_t i = 0; i < arg_size; ++i)
{
int byte = static_cast<int>(reinterpret_cast<const char*>(arg_value_ptr)[i] & 0xff);
unsigned int byte = static_cast<unsigned int>(
reinterpret_cast<const unsigned char*>(arg_value_ptr)[i]
);
stream << std::setfill('0') << std::setw(2) << byte;
}
stream << std::dec << lf;
Expand Down Expand Up @@ -563,7 +565,9 @@ class cjsonLogger : public Prof::Logger
ss << std::hex;
for (size_t i = 0; i < arg_size; ++i)
{
int byte = static_cast<int>(reinterpret_cast<const char*>(arg_value_ptr)[i] & 0xff);
unsigned int byte = static_cast<unsigned int>(
reinterpret_cast<const unsigned char*>(arg_value_ptr)[i]
);
ss << std::setfill('0') << std::setw(2) << byte;
}
const std::string arg_value_str = ss.str();
Expand Down

0 comments on commit 5eb908f

Please sign in to comment.