16#ifndef LIEF_UTILS_HEADER
17#define LIEF_UTILS_HEADER
29inline uint64_t
align(uint64_t value, uint64_t align_on) {
33 const auto r = value % align_on;
35 return value + (align_on - r);
62constexpr size_t operator ""_KB(
unsigned long long kbs)
67constexpr size_t operator ""_MB(
unsigned long long mbs)
69 return 1024LLU * 1024LLU * mbs;
72constexpr size_t operator ""_GB(
unsigned long long gbs)
74 return 1024LLU * 1024LLU * 1024LLU * gbs;
79LIEF_API std::string
u16tou8(
const std::u16string&
string,
bool remove_null_char =
false);
87 const std::string& sep =
":");
90 const std::string& sep =
":");
std::vector< uint8_t > uencode(uint64_t value)
LIEF namespace.
Definition Abstract/Binary.hpp:32
uint64_t align(uint64_t value, uint64_t align_on)
Definition utils.hpp:29
tcb::span< ElementType, Extent > span
Definition span.hpp:22
uint64_t round< uint64_t >(uint64_t x)
Definition utils.hpp:48
std::string hex_str(uint8_t c)
std::string hex_dump(const std::vector< uint8_t > &data, const std::string &sep=":")
result< std::u16string > u8tou16(const std::string &string)
Convert a UTF-8 string to a UTF-16 one.
bool is_extended()
Whether this version of LIEF includes extended features.
std::string u16tou8(const std::u16string &string, bool remove_null_char=false)
Convert a UTF-16 string to a UTF-8 one.
constexpr T round(T x)
Definition utils.hpp:42
tl::expected< T, lief_errors > result
Wrapper that contains an Object (T) or an error.
Definition errors.hpp:74
bool is_hex_number(const std::string &nb)
Check if the given number is a hex-like string.
#define LIEF_API
Definition visibility.h:41