/*
Formatting library for C++
Copyright (c) 2012 - present, Victor Zverovich
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--- Optional exception to the license ---
As an exception, if, as a result of your compiling your source code, portions
of this Software are embedded into a machine-executable object form of such
source code, you may redistribute such embedded portions in such object form
without including the above copyright and permission notices.
*/
#ifndef FMT_FORMAT_H_
#define FMT_FORMAT_H_
#include <cmath> // std::signbit
#include <cstdint> // uint32_t
#include <cstring> // std::memcpy
#include <limits> // std::numeric_limits
#include <memory> // std::uninitialized_copy
#include <stdexcept> // std::runtime_error
#include <system_error> // std::system_error
#ifdef __cpp_lib_bit_cast
# include <bit> // std::bitcast
#endif
#include "core.h"
#if FMT_GCC_VERSION
# define FMT_GCC_VISIBILITY_HIDDEN __attribute__((visibility("hidden")))
#else
# define FMT_GCC_VISIBILITY_HIDDEN
#endif
#ifdef __NVCC__
# define FMT_CUDA_VERSION (__CUDACC_VER_MAJOR__ * 100 + __CUDACC_VER_MINOR__)
#else
# define FMT_CUDA_VERSION 0
#endif
#ifdef __has_builtin
# define FMT_HAS_BUILTIN(x) __has_builtin(x)
#else
# define FMT_HAS_BUILTIN(x) 0
#endif
#if FMT_GCC_VERSION || FMT_CLANG_VERSION
# define FMT_NOINLINE __attribute__((noinline))
#else
# define FMT_NOINLINE
#endif
#if FMT_MSC_VERSION
# define FMT_MSC_DEFAULT = default
#else
# define FMT_MSC_DEFAULT
#endif
#ifndef FMT_THROW
# if FMT_EXCEPTIONS
# if FMT_MSC_VERSION || defined(__NVCC__)
FMT_BEGIN_NAMESPACE
namespace detail {
template <typename Exception> inline void do_throw(const Exception& x) {
// Silence unreachable code warnings in MSVC and NVCC because these
// are nearly impossible to fix in a generic code.
volatile bool b = true;
if (b) throw x;
}
} // namespace detail
FMT_END_NAMESPACE
# define FMT_THROW(x) detail::do_throw(x)
# else
# define FMT_THROW(x) throw x
# endif
# else
# define FMT_THROW(x) \
do { \
FMT_ASSERT(false, (x).what()); \
} while (false)
# endif
#endif
#if FMT_EXCEPTIONS
# define FMT_TRY try
# define FMT_CATCH(x) catch (x)
#else
# define FMT_TRY if (true)
# define FMT_CATCH(x) if (false)
#endif
#ifndef FMT_MAYBE_UNUSED
# if FMT_HAS_CPP17_ATTRIBUTE(maybe_unused)
# define FMT_MAYBE_UNUSED [[maybe_unused]]
# else
# define FMT_MAYBE_UNUSED
# endif
#endif
#ifndef FMT_USE_USER_DEFINED_LITERALS
// EDG based compilers (Intel, NVIDIA, Elbrus, etc), GCC and MSVC support UDLs.
# if (FMT_HAS_FEATURE(cxx_user_literals) || FMT_GCC_VERSION >= 407 || \
FMT_MSC_VERSION >= 1900) && \
(!defined(__EDG_VERSION__) || __EDG_VERSION__ >= /* UDL feature */ 480)
# define FMT_USE_USER_DEFINED_LITERALS 1
# else
# define FMT_USE_USER_DEFINED_LITERALS 0
# endif
#endif
// Defining FMT_REDUCE_INT_INSTANTIATIONS to 1, will reduce the number of
// integer formatter template instantiations to just one by only using the
// largest integer type. This results in a reduction in binary size but will
// cause a decrease in integer formatting performance.
#if !defined(FMT_REDUCE_INT_INSTANTIATIONS)
# define FMT_REDUCE_INT_INSTANTIATIONS 0
#endif
// __builtin_clz is broken in clang with Microsoft CodeGen:
// https://github.com/fmtlib/fmt/issues/519.
#if !FMT_MSC_VERSION
# if FMT_HAS_BUILTIN(__builtin_clz) || FMT_GCC_VERSION || FMT_ICC_VERSION
# define FMT_BUILTIN_CLZ(n) __builtin_clz(n)
# endif
# if FMT_HAS_BUILTIN(__builtin_clzll) || FMT_GCC_VERSION || FMT_ICC_VERSION
# define FMT_BUILTIN_CLZLL(n) __builtin_clzll(n)
# endif
#endif
// __builtin_ctz is broken in Intel Compiler Classic on Windows:
// https://github.com/fmtlib/fmt/issues/2510.
#ifndef __ICL
# if FMT_HAS_BUILTIN(__builtin_ctz) || FMT_GCC_VERSION || FMT_ICC_VERSION || \
defined(__NVCOMPILER)
# define FMT_BUILTIN_CTZ(n) __builtin_ctz(n)
# endif
# if FMT_HAS_BUILTIN(__builtin_ctzll) || FMT_GCC_VERSION || \
FMT_ICC_VERSION || defined(__NVCOMPILER)
# define FMT_BUILTIN_CTZLL(n) __builtin_ctzll(n)
# endif
#endif
#if FMT_MSC_VERSION
# include <intrin.h> // _BitScanReverse[64], _BitScanForward[64], _umul128
#endif
// Some compilers masquerade as both MSVC and GCC-likes or otherwise support
// __builtin_clz and __builtin_clzll, so only define FMT_BUILTIN_CLZ using the
// MSVC intrinsics if the clz and clzll builtins are not available.
#if FMT_MSC_VERSION && !defined(FMT_BUILTIN_CLZLL) && \
!defined(FMT_BUILTIN_CTZLL)
FMT_BEGIN_NAMESPACE
namespace detail {
// Avoid Clang with Microsoft CodeGen's -Wunknown-pragmas warning.
# if !defined(__clang__)
# pragma intrinsic(_BitScanForward)
# pragma intrinsic(_BitScanReverse)
# if defined(_WIN64)
# pragma intrinsic(_BitScanForward64)
# pragma intrinsic(_BitScanReverse64)
# endif
# endif
inline auto clz(uint32_t x) -> int {
unsigned long r = 0;
_BitScanReverse(&r, x);
FMT_ASSERT(x != 0, "");
// Static analysis complains about using uninitialized data
// "r", but the only way that can happen is if "x" is 0,
// which the callers guarantee to not happen.
FMT_MSC_WARNING(suppress : 6102)
return 31 ^ static_cast<int>(r);
}
# define FMT_BUILTIN_CLZ(n) detail::clz(n)
inline auto clzll(uint64_t x) -> int {
unsigned long r = 0;
# ifdef _WIN64
_BitScanReverse64(&r, x);
# else
// Scan the high 32 bits.
if (_BitScanReverse(&r, static_cast<uint32_t>(x >> 32))) return 63 ^ (r + 32);
// Scan the low 32 bits.
_BitScanReverse(&r, static_cast<uint32_t>(x));
# endif
FMT_ASSERT(x != 0, "");
FMT_MSC_WARNING(suppress : 6102) // Suppress a bogus static analysis warning.
return 63 ^ static_cast<int>(r);
}
# define FMT_BUILTIN_CLZLL(n) detail::clzll(n)
inline auto ctz(uint32_t x) -> int {
unsigned long r = 0;
_BitScanForward(&r, x);
FMT_ASSERT(x != 0, "");
FMT_MSC_WARNING(suppress : 6102) // Suppress a bogus static analysis warning.
return static_cast<int>(r);
}
# define FMT_BUILTIN_CTZ(n) detail::ctz(n)
inline auto ctzll(uint64_t x) -> int {
unsigned long r = 0;
FMT_ASSERT(x != 0, "");
FMT_MSC_WARNING(suppress : 6102) // Suppress a bogus static analysis warning.
# ifdef _WIN64
_BitScanForward64(&r, x);
# else
// Scan the low 32 bits.
if (_BitScanForward(&r, static_cast<uint32_t>(x))) return static_cast<int>(r);
// Scan the high 32 bits.
_BitScanForward(&r, static_cast<uint32_t>(x >> 32));
r += 32;
# endif
return static_cast<int>(r);
}
# define FMT_BUILTIN_CTZLL(n) detail::ctzll(n)
} // namespace detail
FMT_END_NAMESPACE
#endif
FMT_BEGIN_NAMESPACE
没有合适的资源?快使用搜索试试~ 我知道了~
spdlog,VC2022外部依赖库
共128个文件
h:104个
md:9个
cmake:8个
需积分: 0 1 下载量 170 浏览量
2024-02-02
14:58:16
上传
评论
收藏 5.22MB ZIP 举报
温馨提示
spdlog,Visual Studio外部依赖库,已编译,直接引用即可。
资源推荐
资源详情
资源评论
收起资源包目录
spdlog,VC2022外部依赖库 (128个子文件)
spdlogConfigTargets.cmake 4KB
benchmarkTargets.cmake 4KB
spdlogConfigVersion.cmake 3KB
benchmarkConfigVersion.cmake 3KB
benchmarkTargets-debug.cmake 1KB
spdlogConfig.cmake 1KB
spdlogConfigTargets-debug.cmake 852B
benchmarkConfig.cmake 61B
format.h 155KB
core.h 112KB
format-inl.h 74KB
chrono.h 69KB
benchmark.h 60KB
pattern_formatter-inl.h 45KB
color.h 25KB
ranges.h 23KB
compile.h 21KB
printf.h 20KB
os-inl.h 18KB
os.h 14KB
logger.h 13KB
common.h 13KB
qt_sinks.h 12KB
spdlog.h 12KB
daily_file_sink.h 9KB
xchar.h 9KB
win_eventlog_sink.h 9KB
registry-inl.h 9KB
ostream.h 8KB
args.h 7KB
bin_to_hex.h 7KB
hourly_file_sink.h 7KB
logger-inl.h 7KB
wincolor_sink-inl.h 7KB
tweakme.h 6KB
mpmc_blocking_q.h 5KB
rotating_file_sink-inl.h 5KB
std.h 5KB
ansicolor_sink-inl.h 5KB
systemd_sink.h 5KB
android_sink.h 5KB
file_helper-inl.h 5KB
fmt_helper.h 5KB
kafka_sink.h 4KB
stdout_sinks-inl.h 4KB
thread_pool-inl.h 4KB
tcp_client-windows.h 4KB
syslog_sink.h 4KB
registry.h 4KB
async.h 4KB
mongo_sink.h 4KB
ansicolor_sink.h 4KB
os.h 4KB
tcp_client.h 4KB
pattern_formatter.h 4KB
thread_pool.h 4KB
circular_q.h 3KB
dup_filter_sink.h 3KB
rotating_file_sink.h 3KB
helpers-inl.h 3KB
udp_client-windows.h 3KB
spdlog-inl.h 3KB
async_logger-inl.h 3KB
wincolor_sink.h 3KB
async_logger.h 3KB
stdout_sinks.h 2KB
dist_sink.h 2KB
basic_file_sink.h 2KB
udp_client.h 2KB
tcp_sink.h 2KB
ringbuffer_sink.h 2KB
common-inl.h 2KB
msvc_sink.h 2KB
backtracer-inl.h 2KB
udp_sink.h 2KB
base_sink-inl.h 2KB
stdout_color_sinks.h 2KB
file_helper.h 2KB
periodic_worker.h 2KB
stopwatch.h 2KB
callback_sink.h 2KB
log_msg_buffer-inl.h 2KB
base_sink.h 2KB
stdout_color_sinks-inl.h 1KB
log_msg-inl.h 1KB
null_sink.h 1KB
ostream_sink.h 1KB
argv.h 1KB
basic_file_sink-inl.h 1KB
log_msg.h 1KB
backtracer.h 1KB
fmt.h 1KB
env.h 1022B
log_msg_buffer.h 967B
null_mutex.h 965B
sink.h 927B
synchronous_factory.h 773B
helpers.h 747B
sink-inl.h 747B
std.h 665B
共 128 条
- 1
- 2
资源评论
蹲在草丛嚼益达
- 粉丝: 71
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功