Skip to content

Commit 86418f1

Browse files
committed
Add IsHumanChar function
1 parent 1b952e2 commit 86418f1

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

include/dynlibutils/memaddr.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,14 @@ inline std::string MemToHexString(T val)
6868
return std::string(MemToHexString_unsafe<T, SIZE, CHARS>(sBuffer, val), CHARS); // Small-string optimization?
6969
}
7070

71+
inline bool IsHumanChar(std::uint8_t byte)
72+
{
73+
return ' ' <= byte && byte <= '~';
74+
}
75+
7176
inline char MemToHumanChar(std::uint8_t byte)
7277
{
73-
return (' ' <= byte && byte <= '~') ? static_cast<char>(byte) : '.';
78+
return IsHumanChar(byte) ? static_cast<char>(byte) : '.';
7479
}
7580

7681
template<std::size_t BYTES_PER_LINE>

0 commit comments

Comments
 (0)