Classes | Namespaces | Macros | Enumerations | Functions
bloaty/src/util.h File Reference
#include <stdexcept>
#include "absl/numeric/int128.h"
#include "absl/strings/string_view.h"
#include "absl/strings/substitute.h"
Include dependency graph for bloaty/src/util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  bloaty::Error
 

Namespaces

 bloaty
 

Macros

#define BLOATY_ASSERT(expr)   assert(expr)
 
#define BLOATY_UNREACHABLE()
 
#define THROW(msg)   Throw(msg, __LINE__)
 
#define THROWF(...)   Throw(absl::Substitute(__VA_ARGS__).c_str(), __LINE__)
 
#define WARN(...)
 

Enumerations

enum  bloaty::Endian { bloaty::Endian::kBig, bloaty::Endian::kLittle }
 

Functions

template<size_t N, class T >
constexpr T bloaty::_BS (T val)
 
size_t bloaty::AlignUp (size_t offset, size_t granularity)
 
template<class T >
constexpr T bloaty::ByteSwap (T val)
 
uint64_t bloaty::CheckedAdd (uint64_t a, uint64_t b)
 
uint64_t bloaty::CheckedMul (uint64_t a, uint64_t b)
 
Endian bloaty::GetMachineEndian ()
 
template<class T >
T bloaty::ReadBigEndian (absl::string_view *data)
 
absl::string_view bloaty::ReadBytes (size_t bytes, absl::string_view *data)
 
template<class T >
T bloaty::ReadEndian (absl::string_view *data, Endian endian)
 
template<class T , size_t N = sizeof(T)>
T bloaty::ReadFixed (absl::string_view *data)
 
template<class T >
T bloaty::ReadLittleEndian (absl::string_view *data)
 
absl::string_view bloaty::ReadNullTerminated (absl::string_view *data)
 
void bloaty::SkipBytes (size_t bytes, absl::string_view *data)
 
absl::string_view bloaty::StrictSubstr (absl::string_view data, size_t off)
 
absl::string_view bloaty::StrictSubstr (absl::string_view data, size_t off, size_t n)
 
ABSL_ATTRIBUTE_NORETURN void bloaty::Throw (const char *str, int line)
 

Macro Definition Documentation

◆ BLOATY_ASSERT

#define BLOATY_ASSERT (   expr)    assert(expr)

Definition at line 68 of file bloaty/src/util.h.

◆ BLOATY_UNREACHABLE

#define BLOATY_UNREACHABLE ( )
Value:
do { \
assert(false); \
__builtin_unreachable(); \
} while (0)

Definition at line 53 of file bloaty/src/util.h.

◆ THROW

#define THROW (   msg)    Throw(msg, __LINE__)

Definition at line 45 of file bloaty/src/util.h.

◆ THROWF

#define THROWF (   ...)    Throw(absl::Substitute(__VA_ARGS__).c_str(), __LINE__)

Definition at line 46 of file bloaty/src/util.h.

◆ WARN

#define WARN (   ...)
Value:
if (verbose_level > 0) { \
printf("WARNING: %s\n", absl::Substitute(__VA_ARGS__).c_str()); \
}

Definition at line 47 of file bloaty/src/util.h.

bloaty::verbose_level
int verbose_level
Definition: bloaty.cc:74
gen_stats_data.c_str
def c_str(s, encoding='ascii')
Definition: gen_stats_data.py:38
absl::Substitute
ABSL_MUST_USE_RESULT std::string Substitute(absl::string_view format)
Definition: abseil-cpp/absl/strings/substitute.h:506


grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:37