P99
p99_int.h
Go to the documentation of this file.
1 /* This may look like nonsense, but it really is -*- mode: C; coding: utf-8 -*- */
2 /* */
3 /* Except for parts copied from previous work and as explicitly stated below, */
4 /* the authors and copyright holders for this work are as follows: */
5 /* (C) copyright 2010-2013, 2015 Jens Gustedt, INRIA, France */
6 /* (C) copyright 2013 Pierre-Nicolas Clauss */
7 /* (C) copyright 2012 William Morris */
8 /* */
9 /* This file is free software; it is part of the P99 project. */
10 /* */
11 /* Licensed under the Apache License, Version 2.0 (the "License"); */
12 /* you may not use this file except in compliance with the License. */
13 /* You may obtain a copy of the License at */
14 /* */
15 /* http://www.apache.org/licenses/LICENSE-2.0 */
16 /* */
17 /* Unless required by applicable law or agreed to in writing, software */
18 /* distributed under the License is distributed on an "AS IS" BASIS, */
19 /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
20 /* See the License for the specific language governing permissions and */
21 /* limitations under the License. */
22 /* */
23 #ifndef P99_INT_H_
24 # define P99_INT_H_
25 
44 #include "p99_c99.h"
45 #include "p99_id.h"
46 #include "p99_type.h"
47 
48 #if P99_COMPILER & (P99_COMPILER_GNU | P99_COMPILER_OPEN64)
49 # if P99_GCC_VERSION >= 40200UL
50 # pragma GCC diagnostic ignored "-Wmissing-braces"
51 # endif
52 #endif
53 
64 #define P00_DOCUMENT_C2(WIDTH)
66 #ifdef UINT16_MAX
67 P00_DOCUMENT_C2(16)
68 #define P99X_UINT16_C2(H, L) ((((uint16_t)(uint8_t)H) << 8u) | (uint16_t)(uint8_t)L)
69 #endif
70 #ifdef INT16_MAX
71 P00_DOCUMENT_C2(16)
72 #define P99X_INT16_C2(H, L) ((((int16_t)(int8_t)H) << 8u) | (int16_t)(int8_t)L)
73 #endif
74 #ifdef UINT32_MAX
75 P00_DOCUMENT_C2(32)
76 #define P99X_UINT32_C2(H, L) ((((uint32_t)(uint16_t)H) << 16u) | (uint32_t)(uint16_t)L)
77 #endif
78 #ifdef INT32_MAX
79 P00_DOCUMENT_C2(32)
80 #define P99X_INT32_C2(H, L) ((((int32_t)(int16_t)H) << 16u) | (int32_t)(int16_t)L)
81 #endif
82 #ifdef UINT64_MAX
83 P00_DOCUMENT_C2(64)
84 #define P99X_UINT64_C2(H, L) ((((uint64_t)(uint32_t)H) << 32u) | (uint64_t)(uint32_t)L)
85 #endif
86 #ifdef INT64_MAX
87 P00_DOCUMENT_C2(64)
88 #define P99X_INT64_C2(H, L) ((((int64_t)(int32_t)H) << 32u) | (int64_t)(int32_t)L)
89 #endif
90 
91 #ifdef p99x_uint128
92 P00_DOCUMENT_C2(128)
93 #define P99X_UINT128_C2(H, L) ((((p99x_uint128)H) << 64u) | (p99x_uint128)L)
94 #define P99X_UINT128_0 P99X_UINT128_C2(0x0000000000000000, 0x0000000000000000)
95 #define P99X_UINT128_MAX P99X_UINT128_C2(0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF)
96 #endif
97 
98 #ifdef p99x_int128
99 P00_DOCUMENT_C2(128)
100 #define P99X_INT128_C2(H, L) ((((p99x_int128)H) << 64u) | (p99x_int128)L)
101 #define P99X_INT128_MAX P99X_INT128_C2(0x7FFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF)
102 #define P99X_INT128_MIN P99X_INT128_C2(0x8000000000000000, 0x0000000000000000)
103 #endif
104 
117 #ifndef p99x_uint128
119 #endif
120 
133 #ifndef p99x_int128
134 typedef intmax_t p99x_intmax;
135 #endif
136 
137 #ifdef P00_DOXYGEN
138 
149 typedef extendedInt p99x_uint128;
150 
162 typedef extendedInt p99x_int128;
163 #endif
164 
165 #ifdef p99x_uintmax
166 
167 #define P99X__SIGN_PROMOTE(EXPR) \
168 ((p99x_uintmax)+P99_SIGN_PROMOTE(P99_UE_MAX(EXPR), (p99x_uintmax)+UINTMAX_MAX))
169 
170 #define P99X__SHIFT(EXPR) \
171 ((P99_SIGN_PROMOTE(P99_UE_MAX(EXPR), UINTMAX_MAX) > (p99x_uintmax)+UINTMAX_MAX) \
172  ? 64u \
173  : 0u)
174 #endif
175 
176 #ifndef P99_HIGH2
177 # if P99_UINTMAX_WIDTH == 64
178 # define P99_HIGH2(X) \
179 ((((X) & P00_B0) ? P00_S0 : 0u) \
180  | (((X) & P00_B1) ? P00_S1 : 0u) \
181  | (((X) & P00_B2) ? P00_S2 : 0u) \
182  | (((X) & P00_B3) ? P00_S3 : 0u) \
183  | (((X) & P00_B4) ? P00_S4 : 0u) \
184  | (((X) & P00_B5) ? P00_S5 : 0u))
185 # endif
186 #endif
187 #ifndef P99_HIGH2
188 # if P99_UINTMAX_WIDTH <= 128
189 # define P99_HIGH2(X) \
190 ((((X) & P00_B0) ? P00_S0 : 0u) \
191  | (((X) & P00_B1) ? P00_S1 : 0u) \
192  | (((X) & P00_B2) ? P00_S2 : 0u) \
193  | (((X) & P00_B3) ? P00_S3 : 0u) \
194  | (((X) & P00_B4) ? P00_S4 : 0u) \
195  | (((X) & P00_B5) ? P00_S5 : 0u) \
196  | (((X) & P00_B6) ? P00_S6 : 0u))
197 # endif
198 #endif
199 
200 #ifndef P99X__SHIFT
201 #define P99X__SHIFT(EXPR) 0
202 #endif
203 
204 #ifndef P99X__SIGN_PROMOTE
205 #define P99X__SIGN_PROMOTE(EXPR) 0
206 #endif
207 
208 #define P99_HIGH2_1(X) ((X) == P99_UINTMAX_MAX ? P99_UINTMAX_WIDTH : (P99_HIGH2((X) + UINTMAX_C(1))))
209 
216 P00_DOCUMENT_TYPE_ARGUMENT(P99_TO_UNSIGNED, 0)
217 P00_DOCUMENT_MACRO_ARGUMENT(P99_TO_UNSIGNED, 1)
218 #define P99_TO_UNSIGNED(T, MACRO) \
219 ((uintmax_t) \
220  (sizeof(T) < sizeof(signed) \
221  ? (sizeof(T) == 1u \
222  ? MACRO(unsigned char) \
223  : MACRO(unsigned short)) \
224  : (sizeof(T) < sizeof(unsigned long) \
225  ? MACRO(unsigned) \
226  : (sizeof(T) < sizeof(unsigned long long) \
227  ? MACRO(unsigned long) \
228  : MACRO(unsigned long long)))))
229 
230 P00_DOCUMENT_TYPE_ARGUMENT(P99_TO_UNSIGN, 0)
231 P00_DOCUMENT_MACRO_ARGUMENT(P99_TO_UNSIGN, 1)
232 #define P99_TO_UNSIGN(T, VAL) \
233 ((uintmax_t) \
234  (sizeof(T) < sizeof(signed) \
235  ? (sizeof(T) == 1u \
236  ? (unsigned char)+(VAL) \
237  : (unsigned short)+(VAL)) \
238  : (sizeof(T) < sizeof(unsigned long) \
239  ? (unsigned)+(VAL) \
240  : (sizeof(T) < sizeof(unsigned long long) \
241  ? (unsigned long)+(VAL) \
242  : (unsigned long long)+(VAL)))))
243 
244 
245 
259 #define P99_M1(T) ((T)-1)
260 
266 #define P99_M1U(T) (P99_ISSIGNED(T) ? P99_TO_UNSIGN(T, -1) : P99_C(uintmax_t, P99_M1(T)))
267 
268 #define P00_DOCUMENT_SIGNED(X)
269 #define P00_DOCUMENT_UNSIGNED(X)
302 #define P99_C(T, X) ((T)+(X))
303 
304 #define P00_DOCUMENT_CONSTANT(T)
306 /* Constants macros for the required typedefs */
307 
308 #if !defined(SIZE_C)
309 P00_DOCUMENT_CONSTANT(size_t)
310 # define SIZE_C(X) P99_C(size_t, X)
311 #endif
312 
313 #if !defined(PTRDIFF_C)
314 P00_DOCUMENT_CONSTANT(ptrdiff_t)
315 # define PTRDIFF_C(X) P99_C(ptrdiff_t, X)
316 #endif
317 
318 #if !defined(WCHAR_C)
319 P00_DOCUMENT_CONSTANT(wchar_t)
320 # define WCHAR_C(X) P99_C(wchar_t, X)
321 #endif
322 
323 #if !defined(WINT_C)
324 P00_DOCUMENT_CONSTANT(wint_t)
325 # define WINT_C(X) P99_C(wint_t, X)
326 #endif
327 
328 /* Constants macros for the optional typedefs */
329 
330 #if defined(SIG_ATOMIC_MAX) && !defined(SIG_ATOMIC_C)
331 P00_DOCUMENT_CONSTANT(sig_atomic_t)
332 # define SIG_ATOMIC_C(X) P99_C(sig_atomic_t, X)
333 #endif
334 
335 #if defined(UINTPTR_MAX) && !defined(UINTPTR_C)
336 P00_DOCUMENT_CONSTANT(uintptr_t)
337 # define UINTPTR_C(X) P99_C(uintptr_t, X)
338 #endif
339 
340 #if defined(UINTPTR_MAX) && !defined(INTPTR_C)
341 P00_DOCUMENT_CONSTANT(intptr_t)
342 # define INTPTR_C(X) P99_C(intptr_t, X)
343 #endif
344 
345 
346 
347 
348 P00_DOCUMENT_SIGNED(0)
349 #define P99_0(T) P99_C(T, 0)
350 
351 P00_DOCUMENT_UNSIGNED(0)
352 #define P99_0U(T) P99_TO_UNSIGN(T, 0)
353 
354 P00_DOCUMENT_SIGNED(1)
355 #define P99_1(T) P99_C(T, 1)
356 
357 P00_DOCUMENT_UNSIGNED(1)
358 #define P99_1U(T) P99_TO_UNSIGN(T, 1)
359 
360 P00_DOCUMENT_SIGNED(2)
361 #define P99_2(T) P99_C(T, 2)
362 
363 P00_DOCUMENT_UNSIGNED(2)
364 #define P99_2U(T) P99_TO_UNSIGN(T, 2)
365 
366 P00_DOCUMENT_SIGNED(3)
367 #define P99_3(T) P99_C(T, 3)
368 
369 P00_DOCUMENT_UNSIGNED(3)
370 #define P99_3U(T) P99_TO_UNSIGN(T, 3)
371 
378 P00_DOCUMENT_TYPE_ARGUMENT(P99_UT_MAX, 0)
379 #define P99_UT_MAX(T) (P99_M1U(T))
380 
392 #define P99_UT_MAX1(T) (P99_UT_MAX(T)/2u)
393 
405 #define P00_ST_MIN1(T) (-(T)P99_UT_MAX1(T))
406 
422 P00_DOCUMENT_TYPE_ARGUMENT(P99_ISSIGNED, 0)
423 #define P99_ISSIGNED(T) (P99_M1(T) < P99_1(T))
424 
441 #define P99_SIGN_PROMOTE(A, B) (1 ? (A) : (B))
442 
443 
444 #define P00_SEE_PROMOTE
446 #define P00_DOCUMENT_PROMOTE(X)
448 P00_DOCUMENT_PROMOTE(0)
449 P00_SEE_PROMOTE
450 #define P99_PROMOTE_0(EXPR) P99_SIGN_PROMOTE(0, (EXPR))
451 
452 P00_DOCUMENT_PROMOTE(1)
453 P00_SEE_PROMOTE
454 #define P99_PROMOTE_1(EXPR) P99_SIGN_PROMOTE(1, (EXPR))
455 
456 P00_DOCUMENT_PROMOTE(2)
457 P00_SEE_PROMOTE
458 #define P99_PROMOTE_2(EXPR) P99_SIGN_PROMOTE(2, (EXPR))
459 
460 P00_DOCUMENT_PROMOTE(3)
461 P00_SEE_PROMOTE
462 #define P99_PROMOTE_3(EXPR) P99_SIGN_PROMOTE(3, (EXPR))
463 
464 P00_DOCUMENT_PROMOTE(0U)
465 P00_SEE_PROMOTE
466 #define P99_PROMOTE_0U(EXPR) P99_SIGN_PROMOTE(0U, (EXPR))
467 
468 P00_DOCUMENT_PROMOTE(1u)
469 P00_SEE_PROMOTE
470 #define P99_PROMOTE_1U(EXPR) P99_SIGN_PROMOTE(1U, (EXPR))
471 
472 P00_DOCUMENT_PROMOTE(2u)
473 P00_SEE_PROMOTE
474 #define P99_PROMOTE_2U(EXPR) P99_SIGN_PROMOTE(2U, (EXPR))
475 
476 
477 P00_DOCUMENT_PROMOTE(-1)
478 P00_SEE_PROMOTE
479 #define P99_PROMOTE_M1(EXPR) P99_SIGN_PROMOTE(-1, (EXPR))
480 
485 P00_SEE_PROMOTE
486 #define P99_PROMOTE_M1U(EXPR) P99_SIGN_PROMOTE(P99_PROMOTE_M1(EXPR), P99_PROMOTE_0U(EXPR))
487 
494 P00_SEE_PROMOTE
495 #define P99_UE_MAX(EXPR) (P99_PROMOTE_M1U(EXPR))
496 
508 P00_SEE_PROMOTE
509 #define P99_UE_MAX1(EXPR) (P99_UE_MAX(EXPR)/P99_PROMOTE_2U(EXPR))
510 
511 
512 #ifdef DOXYGEN
513 
527 P00_SEE_PROMOTE
528 #define P99_EWIDTH(EXPR)
529 
533 P00_DOCUMENT_TYPE_ARGUMENT(P99_TMAX, 0)
534 #define P99_TMAX(T)
535 
539 P00_DOCUMENT_TYPE_ARGUMENT(P99_TMIN, 0)
540 #define P99_TMIN(T)
541 
542 #endif
543 
544 #ifdef p99x_uintmax
545 #define P99_EWIDTH(EXPR) \
546  (P99X__SHIFT(EXPR) \
547  ? (P99_HIGH2_1((uintmax_t)+(P99_UE_MAX(EXPR)>>P99X__SHIFT(EXPR))) + P99X__SHIFT(EXPR)) \
548  : P99_HIGH2_1(P99_UE_MAX(EXPR)) \
549  )
550 #else
551 #define P99_EWIDTH(EXPR) P99_HIGH2_1(P99_UE_MAX(EXPR))
552 #endif
553 
565 P00_SEE_PROMOTE
566 #define P99_EPREC(EXPR) (P99_EWIDTH(EXPR) - P99_SIGNED(EXPR))
567 
582 P00_SEE_PROMOTE
583 #define P99_EPADDING(EXPR) (sizeof(P99_PROMOTE_0(EXPR))*CHAR_BIT - P99_EWIDTH(EXPR))
584 
585 #define P99_SE_MAX(EXPR) \
586 ((((P99_PROMOTE_1(EXPR) \
587  << (P99_EWIDTH(EXPR) - 2U)) \
588  - P99_PROMOTE_1(EXPR)) \
589  << 1U) \
590  + P99_PROMOTE_1(EXPR))
591 
592 
604 #define P00_SE_MIN1(EXPR) (-P99_SE_MAX(EXPR))
605 
621 P00_SEE_PROMOTE
622 #define P99_SIGNED(EXPR) (P99_PROMOTE_M1(EXPR) < P99_PROMOTE_1(EXPR))
623 
624 
627 uintmax_t p00_abs_signed(intmax_t p00_a) {
628  uintmax_t p00_aa = p00_a;
629  /* The minus is taken on the unsigned value, so it gives the
630  correct result with -INTMAX_MAX, namely INTMAX_MAX, which might
631  not be representable for two's complement representation. */
632  return (p00_a < INTMAX_C(0)) ? -p00_aa : p00_a;
633 }
634 
648 #define P99_ABS(EXPR) (P99_SIGNED(EXPR) ? p00_abs_signed(EXPR) : P99_C(uintmax_t, EXPR))
649 
650 #if defined(p99x_uintmax) && defined(p99x_intmax)
653 p99x_uintmax p99x__abs_signed(p99x_intmax p00_a) {
654  p99x_uintmax p00_aa = p00_a;
655  /* The minus is taken on the unsigned value, so it gives the
656  correct result with -INTMAX_MAX, namely INTMAX_MAX, which might
657  not be representable for two's complement representation. */
658  return (p00_a < (p99x_intmax)0) ? -p00_aa : p00_a;
659 }
660 #define P99X_ABS(EXPR) (P99_SIGNED(EXPR) ? p99x__abs_signed(EXPR) : (EXPR))
661 #endif
662 
663 #ifndef P99X_ABS
664 
674 # define P99X_ABS P00_ABS
675 #endif
676 
683 typedef enum {
689 
698 P00_DOCUMENT_TYPE_ARGUMENT(P99_SIGNED_REPRESENTATION, 0)
699 #define P99_SIGNED_REPRESENTATION(T) P99_C(p99_signed_representation, (P99_M1(T) & P99_3(T)))
700 
701 
707 #define P99_2COMPLEMENT(T) (P99_SIGNED_REPRESENTATION(T) == p99_signed_representation_twos)
708 
709 #ifdef p99x_uintmax
710 P00_DOCUMENT_TYPE_ARGUMENT(P99_TMAX, 0)
711 #define P99_TMAX(T) \
712 ((T) \
713  (P99X__SHIFT((T)0) \
714  ? (P99_ISSIGNED(T) ? P99X__SIGN_PROMOTE((T)-1)/2u : P99_UE_MAX((T)0)) \
715  : (P99_ISSIGNED(T) ? P99_UT_MAX1(T) : P99_UT_MAX(T))))
716 
717 P00_DOCUMENT_TYPE_ARGUMENT(P99_TMIN, 0)
718 #define P99_TMIN(T) \
719 ((T) \
720  (P99X__SHIFT((T)0) \
721  ? (P99_ISSIGNED(T) ? (-(P99X__SIGN_PROMOTE((T)-1)/2u)) - P99_2COMPLEMENT(T) : (T)0) \
722  : (P99_ISSIGNED(T) ? (P00_ST_MIN1(T) - P99_2COMPLEMENT(T)) : P99_0(T))))
723 #else
724 P00_DOCUMENT_TYPE_ARGUMENT(P99_TMAX, 0)
725 #define P99_TMAX(T) P99_C(T, P99_ISSIGNED(T) ? P99_UT_MAX1(T) : P99_UT_MAX(T))
726 P00_DOCUMENT_TYPE_ARGUMENT(P99_TMIN, 0)
727 #define P99_TMIN(T) P99_C(T, P99_ISSIGNED(T) ? (P00_ST_MIN1(T) - P99_2COMPLEMENT(T)) : P99_0(T))
728 #endif
729 
730 
739 #define P99_E_REPRESENTATION(EXPR) ((p99_signed_representation)(P99_PROMOTE_M1(EXPR) & P99_PROMOTE_3(EXPR)))
740 
741 
747 #define P99_E_2COMPLEMENT(EXPR) \
748 P99_SIGN_PROMOTE(P99_E_REPRESENTATION(EXPR) == p99_signed_representation_twos, (EXPR))
749 
754 #define P99_EMAX(EXPR) (P99_SIGNED(EXPR) ? P99_SE_MAX(EXPR) : P99_PROMOTE_M1(EXPR))
755 
760 #define P99_EMIN(EXPR) (P99_SIGNED(EXPR) ? (P00_SE_MIN1(EXPR) - P99_E_2COMPLEMENT(EXPR)) : P99_PROMOTE_0(EXPR))
761 
772 #define P99_TPREC(T) \
773 (P99X__SHIFT((T)-1) \
774  ? P99_EPREC((T)-1) \
775  : P99_HIGH2_1(P99_TMAX(T)))
776 
789 #define P99_TWIDTH(T) (P99_TPREC(T) + P99_ISSIGNED(T))
790 
804 #define P99_TPADDING(T) ((sizeof(T)*CHAR_BIT) - P99_TWIDTH(T))
805 
806 #ifdef P00_DOXYGEN
807 #define P00_DECLARE_OVERFLOW(SUFF) \
808  \
809  \
810  \
811 p99_inline \
812 P99_BUILTIN_TYPE(SUFF,) \
813 P99_PASTE2(p99_twos, SUFF)(P99_BUILTIN_TYPE(u, SUFF) p00_a); \
814 p99_inline \
815 P99_BUILTIN_TYPE(SUFF,) \
816 P99_PASTE2(p99_add, SUFF)(P99_BUILTIN_TYPE(SUFF,) p00_a, P99_BUILTIN_TYPE(SUFF,) p00_b, int* p00_err)
817 #else
818 #define P00_DECLARE_OVERFLOW(SUFF) \
819  P00_DECLARE_TWOS(SUFF) \
820  P00_DECLARE_UNSIG(SUFF) \
821  P00_DECLARE_ADD0(SUFF) \
822  P00_DECLARE_ADD1(SUFF) \
823  P00_DECLARE_ADD2(SUFF) \
824  P00_DECLARE_ADD(SUFF) \
825  P00_DECLARE_SUB0(SUFF) \
826  P00_DECLARE_SUB1(SUFF) \
827  P00_DECLARE_SUB2(SUFF) \
828  P00_DECLARE_SUB(SUFF) \
829 P99_MACRO_END(p99_overflow_, SUFF)
830 
831 
832 #define P00_DECLARE_TWOS(SUFF) \
833 P99_CONST_FUNCTION \
834 p99_inline \
835 P99_BUILTIN_TYPE(SUFF) \
836 P99_PASTE2(p99_twos, SUFF)(P99_BUILTIN_TYPE(u, SUFF) p00_a) { \
837  P99_BUILTIN_TYPE(u, SUFF) const type_max = P99_BUILTIN_MAX(SUFF); \
838  P99_BUILTIN_TYPE(u, SUFF) const type_max1 = (P99_BUILTIN_TYPE(u, SUFF))(type_max + 1); \
839  /* the unsigned max, as if it had just one value bit more */ \
840  P99_BUILTIN_TYPE(u, SUFF) const utype_max = (P99_BUILTIN_TYPE(u, SUFF))((2 * type_max) + 1); \
841  return \
842  /* for positive values there is nothing to do, this includes the \
843  case where the unsigned type has the same number of value bits \
844  as the signed type */ \
845  (p00_a <= type_max) \
846  ? p00_a \
847  /* Capture the special case where type_max1 is a trap \
848  representation for the signed type */ \
849  : (((P99_BUILTIN_MIN(SUFF) == -P99_BUILTIN_MAX(SUFF)) && (p00_a == type_max1)) \
850  ? (P99_BUILTIN_TYPE(SUFF))(-0) \
851  /* otherwise compute the negative modulo utype_max + 1. for \
852  the case that the unsigned type is much wider than the \
853  signed type we mask the higher order bits away. */ \
854  : (P99_BUILTIN_TYPE(SUFF))((-(P99_BUILTIN_TYPE(SUFF))(utype_max - (utype_max & p00_a))) - 1)); \
855 }
856 
857 #define P00_DECLARE_UNSIG(SUFF) \
858 P99_CONST_FUNCTION \
859 p99_inline \
860 P99_BUILTIN_TYPE(u, SUFF) \
861 P99_PASTE2(p99_unsig, SUFF)(P99_BUILTIN_TYPE(SUFF) p00_a) { \
862  /* needed to avoid spurious compiler warnings */ \
863  register P99_BUILTIN_TYPE(SUFF) const type_null = 0; \
864  register P99_BUILTIN_TYPE(u, SUFF) const type_max = P99_BUILTIN_MAX(SUFF); \
865  register P99_BUILTIN_TYPE(u, SUFF) const type_max1 = (P99_BUILTIN_TYPE(u, SUFF))(type_max + 1); \
866  /* the unsigned max, as if it had just one value bit more */ \
867  register P99_BUILTIN_TYPE(u, SUFF) const utype_max = (P99_BUILTIN_TYPE(u, SUFF))((2 * type_max) + 1); \
868  return \
869  p00_a >= type_null \
870  ? p00_a \
871  /* Capture the special case where -INTMAX_MIN can not represented \
872  in the signed type */ \
873  : (((P99_BUILTIN_MIN(SUFF) == -P99_BUILTIN_MAX(SUFF)) && (p00_a == P99_BUILTIN_MIN(SUFF))) \
874  ? type_max1 \
875  /* otherwise compute the negative modulo utype_max + 1. */ \
876  : (P99_BUILTIN_TYPE(u, SUFF))((utype_max - (P99_BUILTIN_TYPE(u, SUFF))-p00_a) + 1)); \
877 }
878 
879 #define P00_DECLARE_ADD0(SUFF) \
880 P99_CONST_FUNCTION \
881 p99_inline \
882 P99_BUILTIN_TYPE(u, SUFF) \
883 P99_PASTE2(p00_add0, SUFF)(P99_BUILTIN_TYPE(SUFF) p00_a, P99_BUILTIN_TYPE(SUFF) p00_b) { \
884  register P99_BUILTIN_TYPE(u, SUFF) p00_ua = P99_PASTE2(p99_unsig, SUFF)(p00_a); \
885  register P99_BUILTIN_TYPE(u, SUFF) p00_ub = P99_PASTE2(p99_unsig, SUFF)(p00_b); \
886  register P99_BUILTIN_TYPE(u, SUFF) p00_res = (P99_BUILTIN_TYPE(u, SUFF))(p00_ua + p00_ub); \
887  return p00_res; \
888 }
889 
890 #define P00_DECLARE_SUB0(SUFF) \
891 P99_CONST_FUNCTION \
892 p99_inline \
893 P99_BUILTIN_TYPE(u, SUFF) \
894 P99_PASTE2(p00_sub0, SUFF)(P99_BUILTIN_TYPE(SUFF) p00_a, P99_BUILTIN_TYPE(SUFF) p00_b) { \
895  register P99_BUILTIN_TYPE(u, SUFF) p00_ua = P99_PASTE2(p99_unsig, SUFF)(p00_a); \
896  register P99_BUILTIN_TYPE(u, SUFF) p00_ub = P99_PASTE2(p99_unsig, SUFF)(p00_b); \
897  register P99_BUILTIN_TYPE(u, SUFF) p00_res = (P99_BUILTIN_TYPE(u, SUFF))(p00_ua - p00_ub); \
898  return p00_res; \
899 }
900 
901 #define P00_DECLARE_ADD2(SUFF) \
902 P99_CONST_FUNCTION \
903 p99_inline \
904 P99_BUILTIN_TYPE(SUFF) \
905  P99_PASTE2(p00_add2, SUFF)(P99_BUILTIN_TYPE(SUFF) p00_a, \
906  P99_BUILTIN_TYPE(SUFF) p00_b, \
907  int p00_err[P99_ATLEAST 1]) { \
908  /* needed to avoid spurious compiler warnings */ \
909  register P99_BUILTIN_TYPE(SUFF) const type_null = 0; \
910  register P99_BUILTIN_TYPE(u, SUFF) const type_max = P99_BUILTIN_MAX(SUFF); \
911  register P99_BUILTIN_TYPE(u, SUFF) const type_max1 = (P99_BUILTIN_TYPE(u, SUFF))(type_max + 1); \
912  register P99_BUILTIN_TYPE(u, SUFF) p00_uc \
913  = P99_PASTE2(p00_add0, SUFF)(p00_a, p00_b); \
914  register P99_BUILTIN_TYPE(SUFF) p00_c \
915  = P99_PASTE2(p99_twos, SUFF)(p00_uc); \
916  /* (x ^ y) < 0 iff x and y have different signs */ \
917  if (P99_UNLIKELY(((p00_a ^ p00_b) >= type_null) && ((p00_b ^ p00_c) < type_null)) \
918  /* capture the case of the trap value */ \
919  || ((P99_BUILTIN_MIN(SUFF) == -P99_BUILTIN_MAX(SUFF)) \
920  && (p00_uc == type_max1))) \
921  p00_err[0] = ERANGE; \
922  return p00_c; \
923 }
924 
925 #define P00_DECLARE_SUB2(SUFF) \
926 P99_CONST_FUNCTION \
927 p99_inline \
928 P99_BUILTIN_TYPE(SUFF) \
929  P99_PASTE2(p00_sub2, SUFF)(P99_BUILTIN_TYPE(SUFF) p00_a, \
930  P99_BUILTIN_TYPE(SUFF) p00_b, \
931  int p00_err[P99_ATLEAST 1]) { \
932  /* needed to avoid spurious compiler warnings */ \
933  register P99_BUILTIN_TYPE(SUFF) const type_null = 0; \
934  register P99_BUILTIN_TYPE(u, SUFF) const type_max = P99_BUILTIN_MAX(SUFF); \
935  register P99_BUILTIN_TYPE(u, SUFF) const type_max1 = (P99_BUILTIN_TYPE(u, SUFF))(type_max + 1); \
936  register P99_BUILTIN_TYPE(u, SUFF) p00_uc \
937  = P99_PASTE2(p00_sub0, SUFF)(p00_a, p00_b); \
938  register P99_BUILTIN_TYPE(SUFF) p00_c \
939  = P99_PASTE2(p99_twos, SUFF)(p00_uc); \
940  /* (x ^ y) < 0 iff x and y have different signs */ \
941  if (P99_UNLIKELY(((p00_a ^ p00_b) < type_null) && ((p00_b ^ p00_c) >= type_null)) \
942  /* capture the case of the trap value */ \
943  || ((P99_BUILTIN_MIN(SUFF) == -P99_BUILTIN_MAX(SUFF)) \
944  && (p00_uc == type_max1))) \
945  p00_err[0] = ERANGE; \
946  return p00_c; \
947 }
948 
949 #define P00_DECLARE_ADD1(SUFF) \
950 P99_CONST_FUNCTION \
951 p99_inline \
952 P99_BUILTIN_TYPE(SUFF) \
953  P99_PASTE2(p00_add1, SUFF)(P99_BUILTIN_TYPE(SUFF) p00_a, \
954  P99_BUILTIN_TYPE(SUFF) p00_b, \
955  int p00_err[P99_ATLEAST 1]) { \
956  /* needed to avoid spurious compiler warnings */ \
957  register P99_BUILTIN_TYPE(SUFF) const type_null = 0; \
958  register P99_BUILTIN_TYPE(SUFF) p00_ret; \
959  if (p00_b >= type_null) { \
960  if (P99_LIKELY(P99_BUILTIN_MAX(SUFF) - p00_b >= p00_a)) { \
961  p00_ret = p00_a + p00_b; \
962  } else { \
963  p00_ret = ((p00_b - P99_BUILTIN_MAX(SUFF)) + p00_a) - 1; \
964  p00_err[0] = ERANGE; \
965  } \
966  } else { \
967  if (P99_LIKELY(P99_BUILTIN_MIN(SUFF) - p00_b <= p00_a)) { \
968  p00_ret = p00_a + p00_b; \
969  } else { \
970  p00_ret = ((p00_b + P99_BUILTIN_MAX(SUFF)) + p00_a) + 1; \
971  p00_err[0] = ERANGE; \
972  } \
973  } \
974  return p00_ret; \
975 }
976 
977 #define P00_DECLARE_SUB1(SUFF) \
978 P99_CONST_FUNCTION \
979 p99_inline \
980 P99_BUILTIN_TYPE(SUFF) \
981  P99_PASTE2(p00_sub1, SUFF)(P99_BUILTIN_TYPE(SUFF) p00_a, \
982  P99_BUILTIN_TYPE(SUFF) p00_b, \
983  int p00_err[P99_ATLEAST 1]) { \
984  /* needed to avoid spurious compiler warnings */ \
985  register P99_BUILTIN_TYPE(SUFF) const type_null = 0; \
986  register P99_BUILTIN_TYPE(SUFF) p00_ret; \
987  if (p00_b <= type_null) { \
988  if (P99_LIKELY(P99_BUILTIN_MAX(SUFF) + p00_b >= p00_a)) { \
989  p00_ret = p00_a - p00_b; \
990  } else { \
991  p00_ret = (p00_a - (p00_b + P99_BUILTIN_MAX(SUFF))) + 1; \
992  p00_err[0] = ERANGE; \
993  } \
994  } else { \
995  if (P99_LIKELY(P99_BUILTIN_MIN(SUFF) + p00_b <= p00_a)) { \
996  p00_ret = p00_a - p00_b; \
997  } else { \
998  p00_ret = (p00_a - (p00_b - P99_BUILTIN_MAX(SUFF))) - 1; \
999  p00_err[0] = ERANGE; \
1000  } \
1001  } \
1002  return p00_ret; \
1003 }
1004 
1005 #define P00_DECLARE_ADD(SUFF) \
1006 P99_CONST_FUNCTION \
1007 p99_inline \
1008 P99_BUILTIN_TYPE(SUFF) \
1009  P99_PASTE2(p99_add, SUFF)(P99_BUILTIN_TYPE(SUFF) p00_a, \
1010  P99_BUILTIN_TYPE(SUFF) p00_b, \
1011  int p00_err[P99_ATLEAST 1]) { \
1012  return \
1013  (P99_BUILTIN_MAX(SUFF) < P99_BUILTIN_MAX(u, SUFF)) \
1014  ? P99_PASTE2(p00_add2, SUFF)(p00_a, p00_b, p00_err) \
1015  : P99_PASTE2(p00_add1, SUFF)(p00_a, p00_b, p00_err); \
1016 }
1017 
1018 #define P00_DECLARE_SUB(SUFF) \
1019 P99_CONST_FUNCTION \
1020 p99_inline \
1021 P99_BUILTIN_TYPE(SUFF) \
1022  P99_PASTE2(p99_sub, SUFF)(P99_BUILTIN_TYPE(SUFF) p00_a, \
1023  P99_BUILTIN_TYPE(SUFF) p00_b, \
1024  int p00_err[P99_ATLEAST 1]) { \
1025  return \
1026  (P99_BUILTIN_MAX(SUFF) < P99_BUILTIN_MAX(u, SUFF)) \
1027  ? P99_PASTE2(p00_sub2, SUFF)(p00_a, p00_b, p00_err) \
1028  : P99_PASTE2(p00_sub1, SUFF)(p00_a, p00_b, p00_err); \
1029 }
1030 #endif
1031 
1032 P00_DECLARE_OVERFLOW(c);
1033 P00_DECLARE_OVERFLOW(hh);
1034 P00_DECLARE_OVERFLOW(h);
1035 P00_DECLARE_OVERFLOW();
1036 P00_DECLARE_OVERFLOW(l);
1037 P00_DECLARE_OVERFLOW(ll);
1038 
1059 #if P99_COMPILER & P99_COMPILER_CLANG
1060 # define P99_INIT \
1061 P99_WARN_INIT_PUSH \
1062  { 0 } \
1063 P99_WARN_INIT_POP
1064 #else
1065 # define P99_INIT { 0 }
1066 #endif
1067 
1068 #define P00_LVAL1(T) ((T)P99_INIT)
1069 #define P00_LVAL(T, ...) ((T){ __VA_ARGS__ })
1070 
1084 #define P99_LVAL(...) \
1085 P99_WARN_INIT_PUSH \
1086  P99_IF_LE(P99_NARG(__VA_ARGS__),1)(P00_LVAL1(__VA_ARGS__))(P00_LVAL(__VA_ARGS__)) \
1087 P99_WARN_INIT_POP
1088 
1089 #ifdef DOXYGEN
1090 
1121 # define P99_RVAL(T, VAL)
1122 #else
1123 # define P99_RVAL(...) \
1124 P99_WARN_INIT_PUSH \
1125  P99_IF_EQ_1(P99_NARG(__VA_ARGS__)) \
1126  (P00_RVAL1(__VA_ARGS__)) \
1127  (P00_RVAL2(__VA_ARGS__)) \
1128 P99_WARN_INIT_PUSH
1129 #endif
1130 
1131 #define P00_RVAL1_(T) (((const struct { int p00_bla1; T p00_T1; }){ .p00_bla1 = 0 }).p00_T1)
1132 #define P00_RVAL2_(T) ((( struct { int p00_bla2; T p00_T2; }){ .p00_bla2 = 0 }).p00_T2)
1133 
1134 #define P00_RVAL2(T, ...) (P00_RVAL2_(T) = (__VA_ARGS__))
1135 #define P00_RVAL1(T) P00_RVAL2(T, P00_RVAL1_(T))
1136 
1156 #define P99_AVAL(T) P00_RVAL2_(T)
1157 
1158 
1159 P00_DOCUMENT_PERMITTED_ARGUMENT(P99_CHOOSE5, 0)
1160 #define P99_CHOOSE5(xT, cc, cs, ci, cl, cll) \
1161 ((sizeof(xT) < sizeof(int)) \
1162  ? ((sizeof(xT) < sizeof(short)) \
1163  ? cc \
1164  : cs) \
1165  : ((sizeof(xT) <= sizeof(long)) \
1166  ? ((sizeof(xT) == sizeof(int)) \
1167  ? ci \
1168  : cl) \
1169  : cll))
1170 
1171 
1172 P00_DOCUMENT_PERMITTED_ARGUMENT(P99_PRI, 0)
1173 #define P99_PRI(xT, F, LEN) \
1174 P99_CHOOSE5(xT, \
1175  "%" #LEN "hh" #F, \
1176  "%" #LEN "h" #F, \
1177  "%" #LEN "" #F, \
1178  "%" #LEN "l" #F, \
1179  "%" #LEN "ll" #F)
1180 
1185 #define P00_J(X) (0 ? P99_0(uintmax_t) : (X))
1186 
1187 
1201 #define P99_HMASK(N,M) (P99_PASTE2(P00_MASK_, N)^P99_PASTE2(P00_MASK_, P99_MINUS(N, M)))
1202 
1246 #define P99_LOW2(X) ((X) & -(X))
1247 
1252 p99_inline
1253 uintmax_t p99_low2(uintmax_t p00_x) { return P99_LOW2(p00_x); }
1254 
1261 #define P99_LOW2MASK1(X) ((X) ^ ((X) - 1))
1262 
1267 p99_inline
1269 
1276 #define P99_LOW2MASK0(X) (~(X) & ((X) - 1))
1277 
1282 p99_inline
1284 
1291 #define P99_MASK2LOW1(X) ((X) | -(X))
1292 
1297 p99_inline
1299 
1306 #define P99_MASK2LOW0(X) ((X) ^ -(X))
1307 
1312 p99_inline
1314 
1320 #define P99_LOW2CLEAR(X) ((X) & ((X) - 1))
1321 
1326 p99_inline
1328 
1334 #define P99_LOW2FILL(X) ((X) | ((X) - 1))
1335 
1340 p99_inline
1342 
1348 #define P99_LOW0SET(X) ((X) | ((X) + 1))
1349 
1354 p99_inline
1355 uintmax_t p99_low0set(uintmax_t p00_x) { return P99_LOW0SET(p00_x); }
1356 
1363 #define P99_LOW2SHIFT(X) (P99_LIKELY(!!(X)) ? ((X) / ((X) & -(X))) : 0u)
1364 
1369 p99_inline
1371 
1381 p99_inline
1383  uintmax_t p00_ret = 0;
1384  if (p00_x) {
1385  uintmax_t p00_b = P99_LOW2(p00_x);
1386  uintmax_t p00_t = p00_x + p00_b;
1387  uintmax_t p00_c = p00_x ^ p00_t;
1388  uintmax_t p00_m = (p00_c >> 2) / p00_b;
1389  p00_ret = p00_t | p00_m;
1390  }
1391  return p00_ret;
1392 }
1393 
1405 P99_DECLARE_UNION(p00_endian_2);
1407 P99_DECLARE_UNION(p00_endian_4);
1409 P99_DECLARE_UNION(p00_endian_8);
1411 P99_DECLARE_UNION(p00_endian_16);
1412 
1413 typedef uint16_t p00_uint_byte_2;
1414 typedef uint32_t p00_uint_byte_4;
1415 typedef uint64_t p00_uint_byte_8;
1416 
1417 union p00_endian_2 {
1418  uint8_t p00_c[2];
1419  uint16_t p00_i;
1420 };
1421 
1422 union p00_endian_4 {
1423  uint8_t p00_c[4];
1424  uint32_t p00_i;
1425 };
1426 
1427 union p00_endian_8 {
1428  uint8_t p00_c[8];
1429  uint64_t p00_i;
1430 };
1431 
1432 
1433 #ifdef UINT128_MAX
1434 typedef uint128_t p00_uint_byte_16;
1435 
1436 union p00_endian_16 {
1437  uint8_t p00_c[16];
1438  uint128_t p00_i;
1439 };
1440 #else
1441 # ifdef p99x_uint128
1442 typedef p99x_uint128 p00_uint_byte_16;
1443 
1444 union p00_endian_16 {
1445  uint8_t p00_c[16];
1446  p99x_uint128 p00_i;
1447 };
1448 # endif
1449 #endif
1450 
1451 
1452 #define P00_HTON0(N, X, I) [I] = (0xFF & ((X)>>((N - (I + 1))*CHAR_BIT)))
1453 #define P00_HTON(N, X) P99_FOR(N, N, P00_SEQ, P00_HTON0, P99_DUPL(N, X))
1454 #define P99_HTON_INITIALIZER(N, X) { .p00_c = { P00_HTON(N, X) } }
1455 
1461 #define P99_HTON(N, X) (((P99_PASTE2(p00_endian_, N) const)P99_HTON_INITIALIZER(N, X)).p00_i)
1462 
1469 P00_DOCUMENT_NUMBER_ARGUMENT(P99_HTONS, 0)
1470 P00_DOCUMENT_PERMITTED_ARGUMENT(P99_HTONS, 1)
1471 #define P99_HTONS(X) P99_HTON(2, X)
1472 
1479 P00_DOCUMENT_NUMBER_ARGUMENT(P99_HTONL, 0)
1480 P00_DOCUMENT_PERMITTED_ARGUMENT(P99_HTONL, 1)
1481 #define P99_HTONL(X) P99_HTON(4, X)
1482 
1483 
1484 #define P00_NTOH0(N, X, I) (((P99_PASTE2(p00_uint_byte_, N))((X).p00_c[I]))<<((N - (I + 1))*CHAR_BIT))
1485 #define P00_NTOH(N, X, XX) P99_FOR(N, N, P00_BOR, P00_NTOH0, P99_DUPL(N, XX))
1486 #define P99_NTOH_INITIALIZER(N, X) { .p00_i = (X) }
1487 
1493 #define P99_NTOH(N, X) (P99_PASTE2(p00_uint_byte_, N) const)P00_NTOH(N, X, ((P99_PASTE2(p00_endian_, N) const)P99_NTOH_INITIALIZER(N, X)))
1494 
1501 P00_DOCUMENT_NUMBER_ARGUMENT(P99_NTOHS, 0)
1502 #define P99_NTOHS(X) P99_NTOH(2, X)
1503 
1510 P00_DOCUMENT_NUMBER_ARGUMENT(P99_NTOHL, 0)
1511 #define P99_NTOHL(X) P99_NTOH(4, X)
1512 
1513 
1514 
1524 #endif /* !P99_INT_H_ */
p99_mask2low0
uintmax_t p99_mask2low0(uintmax_t p00_x)
function equivalent to P99_MASK2LOW0
Definition: p99_int.h:1313
P99_TO_UNSIGNED
#define P99_TO_UNSIGNED(T, MACRO)
Apply the type macro MACRO to an unsigned type that is compatible with type T.
Definition: p99_int.h:218
p99_signed_representation_invalid
@ p99_signed_representation_invalid
Definition: p99_int.h:684
p99_c99.h
C99 specific include files that are required by the standard.
p99_low2clear
uintmax_t p99_low2clear(uintmax_t p00_x)
function equivalent to P99_LOW2CLEAR
Definition: p99_int.h:1327
P99_LOW0SET
#define P99_LOW0SET(X)
set least significant zero bit
Definition: p99_int.h:1348
uintmax_t
uintmax_t
Definition: p99_str.h:117
P99_LOW2MASK1
#define P99_LOW2MASK1(X)
mask consisting of bits strictly below the least significant bit that is non zero
Definition: p99_int.h:1261
p99_type.h
p99_signed_representation_ones
@ p99_signed_representation_ones
Definition: p99_int.h:686
P99_ISSIGNED
#define P99_ISSIGNED(T)
Determine if T is an unsigned or signed integral type.
Definition: p99_int.h:423
p99_mask2low1
uintmax_t p99_mask2low1(uintmax_t p00_x)
function equivalent to P99_MASK2LOW1
Definition: p99_int.h:1298
P99_MASK2LOW0
#define P99_MASK2LOW0(X)
mask consisting of bits strictly above the least significant bit that is non zero
Definition: p99_int.h:1306
p99_id.h
Implement a simple FILEID that changes each time this file is included somewhere.
P99_TMAX
#define P99_TMAX(T)
Give the maximum representable value of type T.
Definition: p99_int.h:725
ptrdiff_t
ptrdiff_t
Definition: p99_str.h:101
p99_low0set
uintmax_t p99_low0set(uintmax_t p00_x)
function equivalent to P99_LOW0SET
Definition: p99_int.h:1355
P99_HTONS
#define P99_HTONS(X)
host to network transformation of integers according to the endianness of the platform
Definition: p99_int.h:1471
P99_UT_MAX
#define P99_UT_MAX(T)
The maximum representable value of the unsigned type corresponding to T.
Definition: p99_int.h:379
p99_next_popcount
uintmax_t p99_next_popcount(uintmax_t p00_x)
function that returns the next higher value that has exactly the same popcount as x.
Definition: p99_int.h:1382
P99_NTOHL
#define P99_NTOHL(X)
network to host transformation of integers according to the endianness of the platform
Definition: p99_int.h:1511
p99_inline
#define p99_inline
Try to force a function always to be inlined.
Definition: p99_compiler.h:496
P99_MASK2LOW1
#define P99_MASK2LOW1(X)
mask consisting of bits above and including the least significant bit that is non zero
Definition: p99_int.h:1291
p99x_intmax
intmax_t p99x_intmax
A signed integer type of maximal width that exceeds the C99 specifications.
Definition: p99_int.h:134
p99_low2mask1
uintmax_t p99_low2mask1(uintmax_t p00_x)
function equivalent to P99_LOW2MASK1
Definition: p99_int.h:1268
p99x_uintmax
uintmax_t p99x_uintmax
An unsigned integer type of maximal width that exceeds the C99 specifications.
Definition: p99_int.h:118
P99_SIGNED_REPRESENTATION
#define P99_SIGNED_REPRESENTATION(T)
C99 allows exactly three different possibilities for the encoding of negative values of integer types...
Definition: p99_int.h:699
p99_signed_representation
p99_signed_representation
C99 allows exactly three different possibilities for the encoding of negative values of integer types...
Definition: p99_int.h:683
p99_low2fill
uintmax_t p99_low2fill(uintmax_t p00_x)
function equivalent to P99_LOW2FILL
Definition: p99_int.h:1341
p99_signed_representation_twos
@ p99_signed_representation_twos
Definition: p99_int.h:687
P99_LOW2
#define P99_LOW2(X)
extract the least significant bit that is non zero
Definition: p99_int.h:1246
P99_CHOOSE5
#define P99_CHOOSE5(xT, cc, cs, ci, cl, cll)
Definition: p99_int.h:1160
p99_low2mask0
uintmax_t p99_low2mask0(uintmax_t p00_x)
function equivalent to P99_LOW2MASK0
Definition: p99_int.h:1283
P99_CONST_FUNCTION
#define P99_CONST_FUNCTION
On architectures that support this, assert that a function is "const", i.e only depends on parameters...
Definition: p99_compiler.h:622
p99_signed_representation_magnitude
@ p99_signed_representation_magnitude
Definition: p99_int.h:685
p99_low2shift
uintmax_t p99_low2shift(uintmax_t p00_x)
function equivalent to P99_LOW2SHIFT
Definition: p99_int.h:1370
p99_low2
uintmax_t p99_low2(uintmax_t p00_x)
function equivalent to P99_LOW2
Definition: p99_int.h:1253
P99_LOW2FILL
#define P99_LOW2FILL(X)
fill all bits below least significant bit that is non zero
Definition: p99_int.h:1334
P99_LOW2MASK0
#define P99_LOW2MASK0(X)
mask consisting of bits below and including the least significant bit that is non zero
Definition: p99_int.h:1276
P99_LOW2CLEAR
#define P99_LOW2CLEAR(X)
clear the least significant bit that is non zero
Definition: p99_int.h:1320
P99_LOW2SHIFT
#define P99_LOW2SHIFT(X)
shift number right such that the least significant bit that is non zero ends up at bit position 0
Definition: p99_int.h:1363
P99_TMIN
#define P99_TMIN(T)
Give the minimum representable value of type T.
Definition: p99_int.h:727
P99_HTONL
#define P99_HTONL(X)
host to network transformation of integers according to the endianness of the platform
Definition: p99_int.h:1481
P99_TO_UNSIGN
#define P99_TO_UNSIGN(T, VAL)
Definition: p99_int.h:232
P99_DECLARE_UNION
#define P99_DECLARE_UNION(NAME)
forward declaration of a union NAME
Definition: p99_type.h:74
P99_NTOHS
#define P99_NTOHS(X)
network to host transformation of integers according to the endianness of the platform
Definition: p99_int.h:1502
p99x_uint128
extendedInt p99x_uint128
An unsigned integer type of width 128 that exceeds the C99 specifications.
Definition: p99_int.h:149
P99_PRI
#define P99_PRI(xT, F, LEN)
Definition: p99_int.h:1173
p99x_int128
extendedInt p99x_int128
A signed integer type of width 128 that exceeds the C99 specifications.
Definition: p99_int.h:162