YSTest: cstdint.hpp 源文件

YSTest PreAlpha_b900_20201012 The YSLib Test Project

cstdint.hpp
浏览该文件的文档.
1 /*
2 © 2012-2013, 2015-2016, 2018-2020 FrankHB.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #ifndef YB_INC_ystdex_cstdint_hpp_
29 #define YB_INC_ystdex_cstdint_hpp_ 1
30
31 #include "iterator_op.hpp" // for CHAR_BIT, size_t_, make_signed, make_unsigned,
32 // size_t, std::int64_t, std::uint64_t, is_signed, _t, common_type,
33 // cond_t, and_, is_unsigned, bool_, yconstraint, YB_VerifyIterator,
34 // ystdex::make_reverse_iterator;
35 #include <limits>
36 #include <numeric> // for std::accumulate;
37
38 namespace ystdex
39 {
40
42
43
47 enum class byte_order
48 {
49 unknown = 0,
50 neutral = 1,
51 little = 2,
52 big = 3,
53 PDP = 4
54 };
55
56
58
59 namespace details
60 {
61
62 struct bit_order_tester
63 {
64 unsigned char le : 4, : CHAR_BIT - 4;
65 };
66
67 union byte_order_tester
68 {
69 std::uint_least32_t n;
70 byte p[4];
71 };
72
73 } // namespace details;
74
75 // XXX: This cannot be 'constexpr'.
77 YB_STATELESS inline byte_order
78 native_byte_order()
79 {
80 yconstexpr const details::byte_order_tester x = {0x01020304};
81
82 return x.p[0] == byte(4) ? byte_order::little : (x.p[0] == byte(1)
83 ? byte_order::big
84 : (x.p[0] == byte(2) ? byte_order::PDP : byte_order::unknown));
85 }
86
88 YB_STATELESS yconstfn bool
89 native_little_bit_order()
90 {
91 return bool(details::bit_order_tester{1}.le & 1);
92 }
94
95
96
102 template<typename _tInt>
103 struct integer_width : size_t_<sizeof(_tInt) * CHAR_BIT>
104 {};
105
106
113 template<typename _type, bool>
114 struct make_signed_c : make_signed<_type>
115 {};
116
117 template<typename _type>
118 struct make_signed_c<_type, false> : make_unsigned<_type>
119 {};
121
122
130 template<size_t _vWidth>
131 struct make_width_int
132 {
133 static_assert(_vWidth <= 64, "Width too large found.");
134
135 using fast_type = typename make_width_int<(_vWidth <= 8U ? 8U
136 : (_vWidth <= 16U ? 16U : (_vWidth <= 32U ? 32U : 64U)))>::fast_type;
137 using unsigned_fast_type = typename make_width_int<(_vWidth <= 8U ? 8U
138 : (_vWidth <= 16U ? 16U : (_vWidth <= 32U ? 32U : 64U)))>
139 ::unsigned_fast_type;
140 using least_type = typename make_width_int<(_vWidth <= 8U ? 8U
141 : (_vWidth <= 16U ? 16U : (_vWidth <= 32U ? 32U : 64U)))>::least_type;
142 using unsigned_least_type = typename make_width_int<(_vWidth <= 8U ? 8U
143 : (_vWidth <= 16U ? 16U : (_vWidth <= 32U ? 32U : 64U)))>
144 ::unsigned_least_type;
145 };
146
147 template<>
148 struct make_width_int<8U>
149 {
150 using type = std::int8_t;
151 using unsigned_type = std::uint8_t;
152 using fast_type = std::int_fast8_t;
153 using unsigned_fast_type = std::uint_fast8_t;
154 using least_type = std::int_least8_t;
155 using unsigned_least_type = std::uint_least8_t;
156 };
157
158 template<>
159 struct make_width_int<16U>
160 {
161 using type = std::int16_t;
162 using unsigned_type = std::uint16_t;
163 using fast_type = std::int_fast16_t;
164 using unsigned_fast_type = std::uint_fast16_t;
165 using least_type = std::int_least16_t;
166 using unsigned_least_type = std::uint_least16_t;
167 };
168
169 template<>
170 struct make_width_int<32U>
171 {
172 using type = std::int32_t;
173 using unsigned_type = std::uint32_t;
174 using fast_type = std::int_fast32_t;
175 using unsigned_fast_type = std::uint_fast32_t;
176 using least_type = std::int_least32_t;
177 using unsigned_least_type = std::uint_least32_t;
178 };
179
180 template<>
181 struct make_width_int<64U>
182 {
183 using type = std::int64_t;
184 using unsigned_type = std::uint64_t;
185 using fast_type = std::int_fast64_t;
186 using unsigned_fast_type = std::uint_fast64_t;
187 using least_type = std::int_least64_t;
188 using unsigned_least_type = std::uint_least64_t;
189 };
191
192
194
195
201 template<typename _type, bool _bSigned = is_signed<_type>::value>
202 struct make_widen_int
203 {
204 private:
205 using width = integer_width<_type>;
206
207 public:
208 using type = _t<make_signed_c<_t<make_width_int<(width::value << 1) <= 64
209 ? width::value << 1 : width::value>>, _bSigned>>;
210 };
211
212
219 template<typename... _types>
220 struct common_int_type : common_type<_types...>
221 {};
222
223 template<typename _type1, typename _type2, typename... _types>
224 struct common_int_type<_type1, _type2, _types...>
225 {
226 private:
227 using common_t = common_type_t<_type1, _type2>;
228
229 public:
230 using type = typename common_int_type<cond_t<
231 and_<is_unsigned<common_t>, or_<is_signed<_type1>, is_signed<_type2>>>,
232 _t<make_widen_int<common_t, true>>, common_t>, _types...>::type;
233 };
235
236
237
246 template<typename _type>
247 struct modular_arithmetic
248 {
249 static yconstexpr const _type value = is_unsigned<_type>::value
250 ? std::numeric_limits<_type>::max() : _type(0);
251 };
252
253
259 template<typename _type1, typename _type2>
260 struct have_same_modulo : bool_<std::uintmax_t(modular_arithmetic<
261 _type1>::value) != 0 && std::uintmax_t(modular_arithmetic<_type1>::value)
262 == std::uintmax_t(modular_arithmetic<_type2>::value)>
263 {};
264
265
267
268 YB_ATTR_nodiscard YB_STATELESS yconstfn bool
270 is_power_of_2(std::uintmax_t n) ynothrow
271 {
272 return (n & (n - 1)) == 0;
273 }
274
279 YB_ATTR_nodiscard YB_FLATTEN YB_STATELESS yconstfn bool
280 is_power_of_2_positive(std::uintmax_t n) ynothrow
281 {
282 return n != 0 && is_power_of_2(n);
283 }
284
286 namespace details
287 {
288
290 YB_ATTR_nodiscard YB_ATTR(always_inline) YB_STATELESS inline size_t
291 floor_lb_shift(size_t n, true_) ynothrow
292 {
293 return n >> 1;
294 }
296 YB_ATTR_nodiscard YB_ATTR(always_inline) YB_STATELESS inline size_t
297 floor_lb_shift(size_t n, false_) ynothrow
298 {
299 return (n >> 1) + (n & 1 & size_t(n != 1));
300 }
301
302 template<size_t _vN, typename = enable_if_t<_vN != 32 && _vN != 64>>
303 YB_ATTR_nodiscard YB_STATELESS inline size_t
304 floor_lb_w(std::uintmax_t n, size_t_<_vN>) ynothrow
305 {
306 yconstraint(n != 0);
307
308 // NOTE: This is like %is_power_of_2. Note 0 is already excluded.
309 using is_pow_2_t = bool_<(_vN & (_vN - 1)) == 0>;
310 size_t res(0);
311 auto shifted(floor_lb_shift(_vN, is_pow_2_t()));
312
313 while(shifted != 0)
314 {
315 const auto tmp(n >> shifted);
316
317 if(tmp != 0)
318 yunseq(res += shifted, n = tmp);
319 shifted = floor_lb_shift(shifted, is_pow_2_t());
320 }
321 return res;
322 }
323 // NOTE: See http://stackoverflow.com/questions/11376288/fast-computing-of-log2-for-64-bit-integers.
325 YB_ATTR_nodiscard YB_STATELESS inline size_t
326 floor_lb_w(std::uint32_t n, size_t_<32>) ynothrow
327 {
328 static yconstexpr const size_t deBruijn_bit_pos[32]{
329 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30,
330 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31};
331
332 n |= n >> 1;
333 n |= n >> 2;
334 n |= n >> 4;
335 n |= n >> 8;
336 n |= n >> 16;
337 return deBruijn_bit_pos[std::uint32_t(n * 0x07C4ACDDU) >> 27];
338 }
340 YB_ATTR_nodiscard YB_STATELESS inline size_t
341 floor_lb_w(std::uint64_t n, size_t_<64>) ynothrow
342 {
343 static yconstexpr const size_t deBruijn_bit_pos[64]{
344 63, 0, 58, 1, 59, 47, 53, 2,
345 60, 39, 48, 27, 54, 33, 42, 3,
346 61, 51, 37, 40, 49, 18, 28, 20,
347 55, 30, 34, 11, 43, 14, 22, 4,
348 62, 57, 46, 52, 38, 26, 32, 41,
349 50, 36, 17, 19, 29, 10, 13, 21,
350 56, 45, 25, 31, 35, 16, 9, 12,
351 44, 24, 15, 8, 23, 7, 6, 5};
352
353 n |= n >> 1;
354 n |= n >> 2;
355 n |= n >> 4;
356 n |= n >> 8;
357 n |= n >> 16;
358 n |= n >> 32;
359 return deBruijn_bit_pos[std::uint64_t((n - (n >> 1))
360 * 0x07EDD5E59A4E28C2ULL) >> 58];
361 }
362
363 #if YB_IMPL_GNUCPP >= 30400 || (__has_builtin(__builtin_clz) \
364 && __has_builtin(__builtin_clzl) && __has_builtin(__builtin_clzll))
365 # define YB_Impl_has_builtin_clz true
366 // TODO: Extract %builtin_clz_dispatch to some public header.
367 template<typename _type>
368 struct builtin_clz_dispatch
369 {
370 static_assert(is_unsigned<_type>(), "Unsupport type found.");
371
372 YB_ATTR_nodiscard YB_STATELESS static inline size_t
373 call(_type n) ynothrowv
374 {
375 yconstraint(n != 0);
376 details::floor_lb_w(n, size_t_<sizeof(_type) * CHAR_BIT>());
377 }
378 };
379
380 template<>
381 struct builtin_clz_dispatch<unsigned long long>
382 {
384 YB_ATTR_nodiscard YB_ATTR(always_inline) YB_STATELESS static inline size_t
385 call(unsigned long long n) ynothrow
386 {
387 yconstraint(n != 0);
388 return size_t(__builtin_clzll(n));
389 }
390 };
391
392 template<>
393 struct builtin_clz_dispatch<unsigned long>
394 {
396 YB_ATTR_nodiscard YB_ATTR(always_inline) YB_STATELESS static inline size_t
397 call(unsigned long n) ynothrow
398 {
399 yconstraint(n != 0);
400 return size_t(__builtin_clzl(n));
401 }
402 };
403
404 template<>
405 struct builtin_clz_dispatch<unsigned>
406 {
408 YB_ATTR_nodiscard YB_ATTR(always_inline) static inline size_t
409 call(unsigned n) ynothrow
410 {
411 yconstraint(n != 0);
412 return size_t(__builtin_clz(n));
413 }
414 };
415 #endif
416
418 YB_ATTR_nodiscard YB_STATELESS inline size_t
419 floor_lb(std::uintmax_t n) ynothrow
420 {
421 #if YB_Impl_has_builtin_clz
422 return sizeof(n) * CHAR_BIT - 1
423 - builtin_clz_dispatch<std::uintmax_t>::call(n);
424 #else
425 return floor_lb_w(n, size_t_<sizeof(n * CHAR_BIT)>());
426 // NOTE: Intrinsics provided by implementation is not allowed in YStandard
427 // yet. Hopefully this can be recognized as a common pattern and optimized.
428 // TODO: Detect intrinsics without machine-dependent macros for Microsoft
429 // VC++?
430 // TODO: Optimize without builtins.
431 #endif
432 }
434 #undef YB_Impl_has_builtin_clz
435
436 } // namespace details;
437
442 YB_ATTR_nodiscard YB_STATELESS inline size_t
443 floor_lb(std::uintmax_t n) ynothrow
444 {
445 return details::floor_lb(n);
446 }
447
452 YB_ATTR_nodiscard YB_STATELESS inline size_t
453 ceiling_lb(std::uintmax_t n) ynothrow
454 {
455 return 1 + details::floor_lb(n - 1);
456 }
458
459
461
462
467 template<size_t _vWidth, typename _tIn>
468 YB_ATTR_nodiscard YB_PURE typename make_width_int<_vWidth>::unsigned_type
469 pack_uint(_tIn first, _tIn last) ynothrowv
470 {
471 static_assert(_vWidth != 0 && _vWidth
472 % std::numeric_limits<unsigned char>::digits == 0,
473 "Invalid integer width found.");
474 using utype = typename make_width_int<_vWidth>::unsigned_type;
475
476 YB_VerifyIterator(first);
477 return std::accumulate(first, last, utype(), [](utype x, byte y){
478 return utype(x << std::numeric_limits<unsigned char>::digits
479 | utype(y));
480 });
481 }
482
488 template<size_t _vWidth, typename _tOut>
489 void
490 unpack_uint(typename ystdex::make_width_int<_vWidth>::unsigned_type value,
491 _tOut result) ynothrow
492 {
493 static_assert(_vWidth != 0 && _vWidth % std::numeric_limits<
494 unsigned char>::digits == 0, "Invalid integer width found.");
495 auto n(_vWidth);
496
497 while(!(_vWidth < (n -= std::numeric_limits<unsigned char>::digits)))
498 {
499 YB_VerifyIterator(result);
500 *result = byte(value >> n);
501 ++result;
502 }
503 }
505
507
508
512 template<size_t _vWidth>
513 YB_ATTR_nodiscard YB_NONNULL(1) YB_PURE inline
514 typename make_width_int<_vWidth>::unsigned_type
515 read_uint_be(const byte* buf) ynothrowv
516 {
517 yconstraint(buf);
518 return ystdex::pack_uint<_vWidth>(buf,
519 buf + _vWidth / std::numeric_limits<unsigned char>::digits);
520 }
521
523
524 template<size_t _vWidth>
526 YB_ATTR_nodiscard YB_NONNULL(1) YB_PURE inline
527 typename make_width_int<_vWidth>::unsigned_type
528 read_uint_le(const byte* buf) ynothrowv
529 {
530 yconstraint(buf);
531 return ystdex::pack_uint<_vWidth>(ystdex::make_reverse_iterator(
532 buf + _vWidth / std::numeric_limits<unsigned char>::digits),
533 ystdex::make_reverse_iterator(buf));
534 }
535
540 template<size_t _vWidth>
541 YB_NONNULL(1) inline void
542 write_uint_be(byte* buf,
543 typename make_width_int<_vWidth>::unsigned_type val) ynothrowv
544 {
545 yconstraint(buf);
546 ystdex::unpack_uint<_vWidth>(val, buf);
547 }
548
550 template<size_t _vWidth>
551 YB_NONNULL(1) inline void
552 write_uint_le(byte* buf,
553 typename make_width_int<_vWidth>::unsigned_type val) ynothrowv
554 {
555 yconstraint(buf);
556 ystdex::unpack_uint<_vWidth>(val, ystdex::make_reverse_iterator(buf
557 + _vWidth / std::numeric_limits<unsigned char>::digits));
558 }
560
561
562 } // namespace ystdex;
563
564 #endif
565
ystdex::make_width_int< 16U >::unsigned_least_type
std::uint_least16_t unsigned_least_type
Definition: cstdint.hpp:166
ystdex::details::floor_lb
size_t floor_lb(std::uintmax_t n)
Definition: cstdint.hpp:419
ystdex::read_uint_be
make_width_int< _vWidth >::unsigned_type read_uint_be(const byte *buf)
从字节缓冲区读取指定宽的大端序无符号整数。
Definition: cstdint.hpp:515
ystdex::ceiling_lb
size_t ceiling_lb(std::uintmax_t n)
计算 2 为底数的无符号整数向上取整的的对数值。
Definition: cstdint.hpp:453
ystdex::details::byte_order_tester::p
byte p[4]
Definition: cstdint.hpp:70
ystdex::native_little_bit_order
bool native_little_bit_order()
测试本机位序。
Definition: cstdint.hpp:89
YB_ATTR_nodiscard
#define YB_ATTR_nodiscard
标记返回值不被忽略的属性。
Definition: ydef.h:715
ystdex::make_width_int< 16U >::fast_type
std::int_fast16_t fast_type
Definition: cstdint.hpp:163
ystdex::cpp2014::make_reverse_iterator
reverse_iterator< _tIter > make_reverse_iterator(_tIter i)
构造反向迭代器。
Definition: iterator_op.hpp:110
x
const EncapsulationBase & x
Definition: NPLA1Forms.cpp:1536
ystdex::make_width_int< 8U >::unsigned_least_type
std::uint_least8_t unsigned_least_type
Definition: cstdint.hpp:155
ystdex::make_width_int::unsigned_least_type
typename make_width_int<(_vWidth<=8U ? 8U :(_vWidth<=16U ? 16U :(_vWidth<=32U ? 32U :64U)))> ::unsigned_least_type unsigned_least_type
Definition: cstdint.hpp:144
ystdex::make_width_int< 64U >::least_type
std::int_least64_t least_type
Definition: cstdint.hpp:187
yconstexpr
#define yconstexpr
指定编译时常量表达式。
Definition: ydef.h:1072
ystdex::is_power_of_2
bool is_power_of_2(std::uintmax_t n)
判断无符号整数是否为 2 的整数次幂。
Definition: cstdint.hpp:270
ystdex::make_width_int< 32U >::unsigned_type
std::uint32_t unsigned_type
Definition: cstdint.hpp:173
YB_PURE
#define YB_PURE
指示函数或函数模板实例为纯函数。
Definition: ydef.h:919
ystdex::make_width_int::fast_type
typename make_width_int<(_vWidth<=8U ? 8U :(_vWidth<=16U ? 16U :(_vWidth<=32U ? 32U :64U)))>::fast_type fast_type
Definition: cstdint.hpp:136
ystdex::pack_uint
make_width_int< _vWidth >::unsigned_type pack_uint(_tIn first, _tIn last)
使用迭代器对指定的范围中的字节表示的序列构造无符号整数。
Definition: cstdint.hpp:469
ystdex::make_width_int< 8U >::type
std::int8_t type
Definition: cstdint.hpp:150
YB_FLATTEN
#define YB_FLATTEN
标记函数尽可能内联定义内的调用。
Definition: ydef.h:843
ystdex::make_width_int< 16U >::unsigned_type
std::uint16_t unsigned_type
Definition: cstdint.hpp:162
platform::size_t
YB_ATTR_nodiscard YF_API size_t
Definition: FileIO.h:1345
ystdex::make_width_int< 64U >::fast_type
std::int_fast64_t fast_type
Definition: cstdint.hpp:185
ystdex::byte_order::neutral
@ neutral
ystdex::byte_order::little
@ little
ystdex::common_int_type< _type1, _type2, _types... >::common_t
common_type_t< _type1, _type2 > common_t
Definition: cstdint.hpp:227
ystdex::make_width_int< 64U >::unsigned_fast_type
std::uint_fast64_t unsigned_fast_type
Definition: cstdint.hpp:186
ystdex::make_widen_int::type
_t< make_signed_c< _t< make_width_int<(width::value<< 1)<=64 ? width::value<< 1 :width::value > >, _bSigned > > type
Definition: cstdint.hpp:209
ystdex::cpp2014::max
const _type & max(const _type &a, const _type &b, _fComp comp=less< _type >())
取较大的元素。
Definition: algorithm.hpp:635
ystdex::details::bit_order_tester
Definition: cstdint.hpp:63
ystdex::make_width_int
取按指定宽度的整数类型。
Definition: cstdint.hpp:132
ystdex::make_width_int< 32U >::fast_type
std::int_fast32_t fast_type
Definition: cstdint.hpp:174
ystdex::make_widen_int
位加倍扩展。
Definition: cstdint.hpp:203
ystdex::make_width_int< 64U >::unsigned_least_type
std::uint_least64_t unsigned_least_type
Definition: cstdint.hpp:188
ystdex::read_uint_le
make_width_int< _vWidth >::unsigned_type read_uint_le(const byte *buf)
从字节缓冲区读取指定宽的小端序无符号整数。
Definition: cstdint.hpp:528
ystdex::make_width_int< 32U >::unsigned_fast_type
std::uint_fast32_t unsigned_fast_type
Definition: cstdint.hpp:175
platform_ex::Windows::unsigned
YF_API unsigned
Definition: NLS.h:52
ystdex::floor_lb
size_t floor_lb(std::uintmax_t n)
计算 2 为底数的无符号整数的向下取整的对数值。
Definition: cstdint.hpp:443
ystdex::integer_width
取指定整数类型的位宽度。
Definition: cstdint.hpp:104
ystdex::bool_
integral_constant< bool, _vInt > bool_
Definition: integral_constant.hpp:93
ystdex::details::_type2
_type2
Definition: operators.hpp:241
ystdex::details::byte_order_tester::n
std::uint_least32_t n
Definition: cstdint.hpp:69
ystdex::make_width_int< 8U >::least_type
std::int_least8_t least_type
Definition: cstdint.hpp:154
ystdex::make_width_int< 16U >::least_type
std::int_least16_t least_type
Definition: cstdint.hpp:165
ystdex::byte_order
byte_order
字节序。
Definition: cstdint.hpp:48
ystdex::or_
逻辑或。
Definition: integral_constant.hpp:172
ystdex::byte_order::big
@ big
ystdex::make_width_int< 16U >::type
std::int16_t type
Definition: cstdint.hpp:161
YB_VerifyIterator
#define YB_VerifyIterator(_expr)
验证表达式求值的迭代器的有效性。
Definition: deref_op.hpp:67
YB_STATELESS
#define YB_STATELESS
指示函数或函数模板实例为无状态函数。
Definition: ydef.h:941
ystdex::make_width_int< 64U >::type
std::int64_t type
Definition: cstdint.hpp:183
ystdex::size_t_
integral_constant< size_t, _vInt > size_t_
Definition: integral_constant.hpp:103
YB_ATTR
#define YB_ATTR(...)
GNU 风格属性。
Definition: ydef.h:567
ystdex::write_uint_be
void write_uint_be(byte *buf, typename make_width_int< _vWidth >::unsigned_type val)
向字节缓冲区写入指定宽的大端序无符号整数。
Definition: cstdint.hpp:542
ystdex::make_width_int< 32U >::unsigned_least_type
std::uint_least32_t unsigned_least_type
Definition: cstdint.hpp:177
ystdex::make_width_int::least_type
typename make_width_int<(_vWidth<=8U ? 8U :(_vWidth<=16U ? 16U :(_vWidth<=32U ? 32U :64U)))>::least_type least_type
Definition: cstdint.hpp:141
ystdex::make_width_int< 8U >::fast_type
std::int_fast8_t fast_type
Definition: cstdint.hpp:152
yunseq
#define yunseq
无序列依赖表达式组求值。
Definition: ydef.h:1535
ystdex::make_width_int< 32U >::least_type
std::int_least32_t least_type
Definition: cstdint.hpp:176
ystdex::make_width_int< 8U >::unsigned_fast_type
std::uint_fast8_t unsigned_fast_type
Definition: cstdint.hpp:153
ystdex::make_width_int< 16U >::unsigned_fast_type
std::uint_fast16_t unsigned_fast_type
Definition: cstdint.hpp:164
ystdex::modular_arithmetic::value
static const _type value
Definition: cstdint.hpp:249
yconstraint
#define yconstraint(_expr)
约束：接口语义。
Definition: cassert.h:125
YSLib::UI::y
SPos SPos y
Definition: YWidget.cpp:44
ystdex::byte_order::PDP
@ PDP
ystdex::true_
bool_< true > true_
Definition: integral_constant.hpp:109
ystdex::native_byte_order
byte_order native_byte_order()
测试本机字节序。
Definition: cstdint.hpp:78
iterator_op.hpp
迭代器操作。
ystdex::cond_t
_t< cond< _tCond, _tThen, _tElse > > cond_t
Definition: meta.hpp:794
ystdex::byte_order::unknown
@ unknown
ynothrowv
#define ynothrowv
YSLib 无异常抛出保证验证：有条件地使用无异常抛出规范。
Definition: ydef.h:1219
YSLib::Text::buf
YB_ATTR_nodiscard YB_PURE const char * buf
Definition: TextFile.h:83
ystdex::have_same_modulo
判断两个类型是否具有相同的模值。
Definition: cstdint.hpp:263
ystdex
<memory> 特性测试宏。
Definition: ydef.h:1262
ystdex::unpack_uint
void unpack_uint(typename ystdex::make_width_int< _vWidth >::unsigned_type value, _tOut result)
分解无符号整数到迭代器对指定的字节范围。
Definition: cstdint.hpp:490
ystdex::write_uint_le
void write_uint_le(byte *buf, typename make_width_int< _vWidth >::unsigned_type val)
向字节缓冲区写入指定宽的小端序无符号整数。
Definition: cstdint.hpp:552
ystdex::_t
typename _type::type _t
嵌套类型别名。
Definition: meta.hpp:45
ystdex::make_width_int< 32U >::type
std::int32_t type
Definition: cstdint.hpp:172
ystdex::details::byte_order_tester
Definition: cstdint.hpp:68
ystdex::common_int_type
公共整数类型。
Definition: cstdint.hpp:221
ystdex::byte
unsigned char byte
字节类型。
Definition: ydef.h:1283
ystdex::make_width_int< 8U >::unsigned_type
std::uint8_t unsigned_type
Definition: cstdint.hpp:151
ystdex::make_width_int::unsigned_fast_type
typename make_width_int<(_vWidth<=8U ? 8U :(_vWidth<=16U ? 16U :(_vWidth<=32U ? 32U :64U)))> ::unsigned_fast_type unsigned_fast_type
Definition: cstdint.hpp:139
const
const Decapsulate const Decapsulate &y ynothrow ContextNode &ctx const
Definition: NPLA1Forms.cpp:1629
platform::bool
YB_ATTR_nodiscard std::FILE *fp bool
Definition: FileIO.h:1271
ystdex::details::floor_lb_w
size_t floor_lb_w(std::uintmax_t n, size_t_< _vN >)
Definition: cstdint.hpp:304
ystdex::false_
bool_< false > false_
Definition: integral_constant.hpp:110
ynothrow
#define ynothrow
YSLib 无异常抛出保证：若支持 noexcept 关键字， 指定特定的 noexcept 异常规范。
Definition: ydef.h:1199
ystdex::is_power_of_2_positive
bool is_power_of_2_positive(std::uintmax_t n)
判断无符号整数是否为 2 的整数次幂的正整数。
Definition: cstdint.hpp:280
ystdex::common_int_type< _type1, _type2, _types... >::type
typename common_int_type< cond_t< and_< is_unsigned< common_t >, or_< is_signed< _type1 >, is_signed< _type2 > >>, _t< make_widen_int< common_t, true > >, common_t >, _types... >::type type
Definition: cstdint.hpp:232
ystdex::make_signed_c
取指定整数类型和条件表达式对应的有符号或无符号整数类型。
Definition: cstdint.hpp:115
ystdex::cpp2014::common_type_t
typename common_type< _types... >::type common_type_t
Definition: meta.hpp:205
ystdex::modular_arithmetic
模算术特性：取得不超过模值的最大值。
Definition: cstdint.hpp:248
ystdex::details::bit_order_tester::le
unsigned char le
Definition: cstdint.hpp:64
yconstfn
#define yconstfn
指定编译时常量函数。
Definition: ydef.h:1073
ystdex::make_width_int< 64U >::unsigned_type
std::uint64_t unsigned_type
Definition: cstdint.hpp:184
ystdex::and_
逻辑操作元函数。
Definition: integral_constant.hpp:151
ystdex::details::floor_lb_shift
size_t floor_lb_shift(size_t n, true_)
Definition: cstdint.hpp:291