1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947
|
/** @file
* IPRT - Types.
*/
/*
* Copyright (C) 2006-2025 Oracle and/or its affiliates.
*
* This file is part of VirtualBox base platform packages, as
* available from https://www.virtualbox.org.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, in version 3 of the
* License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <https://www.gnu.org/licenses>.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
* in the VirtualBox distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*
* SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
*/
#ifndef IPRT_INCLUDED_types_h
#define IPRT_INCLUDED_types_h
#ifndef RT_WITHOUT_PRAGMA_ONCE
# pragma once
#endif
#include <iprt/cdefs.h>
#include <iprt/stdint.h>
#include <iprt/stdarg.h>
/*
* Include standard C types.
*/
#if !defined(IPRT_NO_CRT) && !defined(DOXYGEN_RUNNING)
# if defined(IN_XF86_MODULE) && !defined(NO_ANSIC)
/*
* Kludge for xfree86 modules: size_t and other types are redefined.
*/
RT_C_DECLS_BEGIN
# include "xf86_ansic.h"
# undef NULL
RT_C_DECLS_END
# elif defined(RT_OS_DARWIN) && defined(KERNEL)
/*
* Kludge for the darwin kernel:
* stddef.h is missing IIRC.
*/
# ifndef _PTRDIFF_T
# define _PTRDIFF_T
typedef __darwin_ptrdiff_t ptrdiff_t;
# endif
# include <sys/types.h>
# elif defined(RT_OS_FREEBSD) && defined(_KERNEL)
# include <sys/param.h>
# undef PVM
# if __FreeBSD_version < 1200000
/*
* Kludge for the FreeBSD kernel:
* stddef.h and sys/types.h have slightly different offsetof definitions
* when compiling in kernel mode. This is just to make GCC shut up.
*/
# ifndef _STDDEF_H_
# undef offsetof
# endif
# include <sys/stddef.h>
# ifndef _SYS_TYPES_H_
# undef offsetof
# endif
# include <sys/types.h>
# ifndef offsetof
# error "offsetof is not defined!"
# endif
# else
# include <sys/stddef.h>
# include <sys/types.h>
# endif
# elif defined(RT_OS_FREEBSD) && HC_ARCH_BITS == 64 && defined(RT_ARCH_X86)
/*
* Kludge for compiling 32-bit code on a 64-bit FreeBSD:
* FreeBSD declares uint64_t and int64_t wrong (long unsigned and long int
* though they need to be long long unsigned and long long int). These
* defines conflict with our declaration in stdint.h. Adding the defines
* below omits the definitions in the system header.
*/
# include <stddef.h>
# define _UINT64_T_DECLARED
# define _INT64_T_DECLARED
# define _UINTPTR_T_DECLARED
# define _INTPTR_T_DECLARED
# include <sys/types.h>
# elif defined(RT_OS_NETBSD) && defined(_KERNEL)
# include <sys/types.h>
/*
* Kludge for NetBSD-6.x where the definition of bool in
* <sys/types.h> does not check for C++.
*/
# if defined(__cplusplus) && defined(bool)
# undef bool
# undef true
# undef false
# endif
/*
* Kludge for NetBSD-6.x where <sys/types.h> does not define
* ptrdiff_t for the kernel code. Note that we don't worry about
* redefinition in <stddef.h> since that header doesn't exist for
* _KERNEL code.
*/
# ifdef _BSD_PTRDIFF_T_
typedef _BSD_PTRDIFF_T_ ptrdiff_t;
# endif
# elif defined(RT_OS_LINUX) && defined(__KERNEL__)
/*
* Kludge for the linux kernel:
* 1. sys/types.h doesn't mix with the kernel.
* 2. Starting with 2.6.19, linux/types.h typedefs bool and linux/stddef.h
* declares false and true as enum values.
* 3. Starting with 2.6.24, linux/types.h typedefs uintptr_t.
* We work around these issues here and nowhere else.
*/
# if defined(__cplusplus)
typedef bool _Bool;
# endif
# define bool linux_bool
# define true linux_true
# define false linux_false
# define uintptr_t linux_uintptr_t
# include <linux/version.h>
# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
# include <generated/autoconf.h>
# else
# ifndef AUTOCONF_INCLUDED
# include <linux/autoconf.h>
# endif
# endif
# include <linux/compiler.h>
# if defined(__cplusplus)
/*
* Starting with 3.3, <linux/compiler-gcc.h> appends 'notrace' (which
* expands to __attribute__((no_instrument_function))) to inline,
* __inline and __inline__. Revert that.
*/
# undef inline
# define inline inline
# undef __inline__
# define __inline__ __inline__
# undef __inline
# define __inline __inline
# endif
# include <linux/types.h>
# include <linux/stddef.h>
/*
* Starting with 3.4, <linux/stddef.h> defines NULL as '((void*)0)' which
* does not work for C++ code.
*/
# undef NULL
# undef uintptr_t
# ifdef __GNUC__
# if !RT_GNUC_PREREQ(4, 1)
/*
* <linux/compiler-gcc{3,4}.h> does
* #define __inline__ __inline__ __attribute__((always_inline))
* in some older Linux kernels. Forcing inlining will fail for some RTStrA*
* functions with gcc <= 4.0 due to passing variable argument lists.
*/
# undef __inline__
# define __inline__ __inline__
# endif
# endif
# undef false
# undef true
# undef bool
# elif !defined(DOXYGEN_RUNNING) && RT_MSC_PREREQ(RT_MSC_VER_VC140) && defined(RT_OS_AGNOSTIC)
/* Try avoid needing the UCRT just for stddef.h and sys/types.h. */
/** @todo refine the RT_OS_AGNOSTIC test? */
# include <vcruntime.h>
# else
# include <stddef.h>
# if defined(RT_OS_SOLARIS) && defined(VBOX_WITH_PARFAIT) && defined(_KERNEL) && defined(__INT_FAST16_MAX__)
/* HACK ALERT: Workaround for duplicate [u]int_fast16_t conflicting due to 'incorrect'
__INT_FAST16_TYPE__ and __UINT_FAST16_TYPE__ definitions in pairfait.
The types are usually 'int' and 'unsigned int', which the system headers
assume, thus we get a conflict when the pairfait compiler redefines to
a narrow variant. Workaround, try ignore the system types and use the
compiler ones... */
# if (__INT_FAST16_MAX__) == 32767
# define int_fast16_t hacked_int_fast16_t
# define uint_fast16_t hacked_uint_fast16_t
# include <sys/int_types.h>
# undef int_fast16_t
# undef uint_fast16_t
# endif
# endif
# include <sys/types.h>
# endif
/* Define any types missing from sys/types.h on Windows and OS/2. */
# ifdef _MSC_VER
# undef ssize_t
typedef intptr_t ssize_t;
# endif
# if defined(RT_OS_OS2) && (defined(__IBMC__) || defined(__IBMCPP__))
typedef signed long ssize_t;
# endif
#else /* no crt */
# include <iprt/nocrt/compiler/compiler.h>
#endif /* no crt */
/** @def NULL
* NULL pointer.
*/
#ifndef NULL
# ifdef __cplusplus
# define NULL 0
# else
# define NULL ((void*)0)
# endif
#endif
/** @defgroup grp_rt_types IPRT Base Types
* @{
*/
/* define wchar_t, we don't wanna include all the wcsstuff to get this. */
#ifdef _MSC_VER
# ifndef _WCHAR_T_DEFINED
typedef unsigned short wchar_t;
# define _WCHAR_T_DEFINED
# endif
#endif
#ifdef __GNUC__
/** @todo wchar_t on GNUC */
#endif
/*
* C doesn't have bool, nor does VisualAge for C++ v3.08.
* Starting with c23, bool, true and false are keywords.
*/
#if (!defined(__cplusplus) || (defined(__IBMCPP__) && defined(RT_OS_OS2))) && !RT_STDC_VERSION_PREREQ(202311L)
# if defined(__GNUC__)
# if defined(RT_OS_LINUX) && __GNUC__ < 3
typedef uint8_t bool;
# elif defined(RT_OS_FREEBSD)
# ifndef __bool_true_false_are_defined
typedef _Bool bool;
# endif
# elif defined(RT_OS_NETBSD)
# if !defined(_KERNEL)
/*
* For the kernel code <stdbool.h> is not available, but bool is
* provided by <sys/types.h> included above.
*/
# include <stdbool.h>
/*
* ... but the story doesn't end here. The C standard says that
* <stdbool.h> defines preprocessor macro "bool" that expands to
* "_Bool", but adds that a program may undefine/redefine it
* (this is 7.16 in C99 and 7.18 in C11). We have to play this
* game here because X11 code uses "bool" as a struct member name
* - so undefine "bool" and provide it as a typedef instead. We
* still keep #include <stdbool.h> so that any code that might
* include it later doesn't mess things up.
*/
# undef bool
typedef _Bool bool;
# endif
# else
# undef bool /* see above netbsd explanation */
typedef _Bool bool;
# endif
# else
# if RT_MSC_PREREQ(RT_MSC_VER_VC120)
# include <stdbool.h>
# else
typedef unsigned char bool;
# endif
# endif
# ifndef true
# define true (1)
# endif
# ifndef false
# define false (0)
# endif
#endif
/**
* 128-bit unsigned integer.
*/
#ifdef RT_COMPILER_WITH_128BIT_INT_TYPES
typedef __uint128_t uint128_t;
#else
typedef struct uint128_s
{
# ifdef RT_BIG_ENDIAN
uint64_t Hi;
uint64_t Lo;
# else
uint64_t Lo;
uint64_t Hi;
# endif
} uint128_t;
#endif
/**
* 128-bit signed integer.
*/
#ifdef RT_COMPILER_WITH_128BIT_INT_TYPES
typedef __int128_t int128_t;
#else
typedef struct int128_s
{
# ifdef RT_BIG_ENDIAN
int64_t Hi;
uint64_t Lo;
# else
uint64_t Lo;
int64_t Hi;
# endif
} int128_t;
#endif
/**
* 16-bit unsigned integer union.
*/
typedef union RTUINT16U
{
/** natural view. */
uint16_t u;
/** 16-bit hi/lo view. */
struct
{
#ifdef RT_BIG_ENDIAN
uint8_t Hi;
uint8_t Lo;
#else
uint8_t Lo;
uint8_t Hi;
#endif
} s;
/** Unsigned 16-bit view. */
uint16_t au16[1];
/** Unsigned 8-bit view. */
uint8_t au8[2];
/** Signed 16-bit view. */
int16_t ai16[1];
/** Signed 8-bit view. */
int8_t ai8[2];
} RTUINT16U;
/** Pointer to a 16-bit unsigned integer union. */
typedef RTUINT16U RT_FAR *PRTUINT16U;
/** Pointer to a const 32-bit unsigned integer union. */
typedef const RTUINT16U RT_FAR *PCRTUINT16U;
/**
* 32-bit unsigned integer union.
*/
typedef union RTUINT32U
{
/** natural view. */
uint32_t u;
/** Hi/Low view. */
struct
{
#ifdef RT_BIG_ENDIAN
uint16_t Hi;
uint16_t Lo;
#else
uint16_t Lo;
uint16_t Hi;
#endif
} s;
/** Word view. */
struct
{
#ifdef RT_BIG_ENDIAN
uint16_t w1;
uint16_t w0;
#else
uint16_t w0;
uint16_t w1;
#endif
} Words;
/** Unsigned 32-bit view. */
uint32_t au32[1];
/** Unsigned 16-bit view. */
uint16_t au16[2];
/** Unsigned 8-bit view. */
uint8_t au8[4];
/** Signed 32-bit view. */
int32_t ai32[1];
/** Signed 16-bit view. */
int16_t ai16[2];
/** Signed 8-bit view. */
int8_t ai8[4];
} RTUINT32U;
/** Pointer to a 32-bit unsigned integer union. */
typedef RTUINT32U RT_FAR *PRTUINT32U;
/** Pointer to a const 32-bit unsigned integer union. */
typedef const RTUINT32U RT_FAR *PCRTUINT32U;
/**
* 64-bit unsigned integer union.
*/
typedef union RTUINT64U
{
/** Natural view. */
uint64_t u;
/** Hi/Low view. */
struct
{
#ifdef RT_BIG_ENDIAN
uint32_t Hi;
uint32_t Lo;
#else
uint32_t Lo;
uint32_t Hi;
#endif
} s;
/** Double-Word view. */
struct
{
#ifdef RT_BIG_ENDIAN
uint32_t dw1;
uint32_t dw0;
#else
uint32_t dw0;
uint32_t dw1;
#endif
} DWords;
/** Word view. */
struct
{
#ifdef RT_BIG_ENDIAN
uint16_t w3;
uint16_t w2;
uint16_t w1;
uint16_t w0;
#else
uint16_t w0;
uint16_t w1;
uint16_t w2;
uint16_t w3;
#endif
} Words;
/** Unsigned 64-bit view. */
uint64_t au64[1];
/** Unsigned 32-bit view. */
uint32_t au32[2];
/** Unsigned 16-bit view. */
uint16_t au16[4];
/** Unsigned 8-bit view. */
uint8_t au8[8];
/** Signed 64-bit view. */
int64_t ai64[1];
/** Signed 32-bit view. */
int32_t ai32[2];
/** Signed 16-bit view. */
int16_t ai16[4];
/** Signed 8-bit view. */
int8_t ai8[8];
} RTUINT64U;
/** Pointer to a 64-bit unsigned integer union. */
typedef RTUINT64U RT_FAR *PRTUINT64U;
/** Pointer to a const 64-bit unsigned integer union. */
typedef const RTUINT64U RT_FAR *PCRTUINT64U;
/**
* 128-bit unsigned integer union.
*
* @note This is not necessarily automatically 16 byte aligned. Sorry.
*/
#pragma pack(1)
typedef union RTUINT128U
{
/** Hi/Low view.
* @remarks We put this first so we can have portable initializers
* (RTUINT128_INIT) */
struct
{
#ifdef RT_BIG_ENDIAN
uint64_t Hi;
uint64_t Lo;
#else
uint64_t Lo;
uint64_t Hi;
#endif
} s;
/** Natural view.
* WARNING! This member depends on the compiler supporting 128-bit stuff. */
uint128_t u;
/** Quad-Word view. */
struct
{
#ifdef RT_BIG_ENDIAN
uint64_t qw1;
uint64_t qw0;
#else
uint64_t qw0;
uint64_t qw1;
#endif
} QWords;
/** Double-Word view. */
struct
{
#ifdef RT_BIG_ENDIAN
uint32_t dw3;
uint32_t dw2;
uint32_t dw1;
uint32_t dw0;
#else
uint32_t dw0;
uint32_t dw1;
uint32_t dw2;
uint32_t dw3;
#endif
} DWords;
/** Word view. */
struct
{
#ifdef RT_BIG_ENDIAN
uint16_t w7;
uint16_t w6;
uint16_t w5;
uint16_t w4;
uint16_t w3;
uint16_t w2;
uint16_t w1;
uint16_t w0;
#else
uint16_t w0;
uint16_t w1;
uint16_t w2;
uint16_t w3;
uint16_t w4;
uint16_t w5;
uint16_t w6;
uint16_t w7;
#endif
} Words;
/** Unsigned 64-bit view. */
uint64_t au64[2];
/** Unsigned 32-bit view. */
uint32_t au32[4];
/** Unsigned 16-bit view. */
uint16_t au16[8];
/** Unsigned 8-bit view. */
uint8_t au8[16];
/** Signed 64-bit view. */
int64_t ai64[2];
/** Signed 32-bit view. */
int32_t ai32[4];
/** Signed 16-bit view. */
int16_t ai16[8];
/** Signed 8-bit view. */
int8_t ai8[16];
} RTUINT128U;
#pragma pack()
/** Pointer to a 128-bit unsigned integer union. */
typedef RTUINT128U RT_FAR *PRTUINT128U;
/** Pointer to a const 128-bit unsigned integer union. */
typedef const RTUINT128U RT_FAR *PCRTUINT128U;
/** @def RTUINT128_INIT
* Portable RTUINT128U initializer. */
#ifdef RT_BIG_ENDIAN
# define RTUINT128_INIT(a_Hi, a_Lo) { { a_Hi, a_Lo } }
#else
# define RTUINT128_INIT(a_Hi, a_Lo) { { a_Lo, a_Hi } }
#endif
/** @def RTUINT128_INIT_C
* Portable RTUINT128U initializer for 64-bit constants. */
#ifdef RT_BIG_ENDIAN
# define RTUINT128_INIT_C(a_Hi, a_Lo) { { UINT64_C(a_Hi), UINT64_C(a_Lo) } }
#else
# define RTUINT128_INIT_C(a_Hi, a_Lo) { { UINT64_C(a_Lo), UINT64_C(a_Hi) } }
#endif
/**
* 256-bit unsigned integer union.
*/
#pragma pack(1)
typedef union RTUINT256U
{
/** Quad-Word view (first as it's used by RTUINT256_INIT). */
struct
{
#ifdef RT_BIG_ENDIAN
uint64_t qw3;
uint64_t qw2;
uint64_t qw1;
uint64_t qw0;
#else
uint64_t qw0;
uint64_t qw1;
uint64_t qw2;
uint64_t qw3;
#endif
} QWords;
/** Double-Word view. */
struct
{
#ifdef RT_BIG_ENDIAN
uint32_t dw7;
uint32_t dw6;
uint32_t dw5;
uint32_t dw4;
uint32_t dw3;
uint32_t dw2;
uint32_t dw1;
uint32_t dw0;
#else
uint32_t dw0;
uint32_t dw1;
uint32_t dw2;
uint32_t dw3;
uint32_t dw4;
uint32_t dw5;
uint32_t dw6;
uint32_t dw7;
#endif
} DWords;
/** Word view. */
struct
{
#ifdef RT_BIG_ENDIAN
uint16_t w15;
uint16_t w14;
uint16_t w13;
uint16_t w12;
uint16_t w11;
uint16_t w10;
uint16_t w9;
uint16_t w8;
uint16_t w7;
uint16_t w6;
uint16_t w5;
uint16_t w4;
uint16_t w3;
uint16_t w2;
uint16_t w1;
uint16_t w0;
#else
uint16_t w0;
uint16_t w1;
uint16_t w2;
uint16_t w3;
uint16_t w4;
uint16_t w5;
uint16_t w6;
uint16_t w7;
uint16_t w8;
uint16_t w9;
uint16_t w10;
uint16_t w11;
uint16_t w12;
uint16_t w13;
uint16_t w14;
uint16_t w15;
#endif
} Words;
/** Double-Quad-Word view. */
struct
{
#ifdef RT_BIG_ENDIAN
RTUINT128U dqw1;
RTUINT128U dqw0;
#else
RTUINT128U dqw0;
RTUINT128U dqw1;
#endif
} DQWords;
/** Unsigned 128-bit view. */
RTUINT128U au128[2];
/** Unsigned 64-bit view. */
uint64_t au64[4];
/** Unsigned 32-bit view. */
uint32_t au32[8];
/** Unsigned 16-bit view. */
uint16_t au16[16];
/** Unsigned 8-bit view. */
uint8_t au8[32];
/** Signed 64-bit view. */
int64_t ai64[4];
/** Signed 32-bit view. */
int32_t ai32[8];
/** Signed 16-bit view. */
int16_t ai16[16];
/** Signed 8-bit view. */
int8_t ai8[32];
} RTUINT256U;
#pragma pack()
/** Pointer to a 256-bit unsigned integer union. */
typedef RTUINT256U RT_FAR *PRTUINT256U;
/** Pointer to a const 256-bit unsigned integer union. */
typedef const RTUINT256U RT_FAR *PCRTUINT256U;
/** @def RTUINT256_INIT
* Portable RTUINT256U initializer. */
#ifdef RT_BIG_ENDIAN
# define RTUINT256_INIT(a_Qw3, a_Qw2, a_Qw1, a_Qw0) { { a_Qw3, a_Qw2, a_Qw1, a_Qw0 } }
#else
# define RTUINT256_INIT(a_Qw3, a_Qw2, a_Qw1, a_Qw0) { { a_Qw0, a_Qw1, a_Qw2, a_Qw3 } }
#endif
/** @def RTUINT256_INIT_C
* Portable RTUINT256U initializer for 64-bit constants. */
#define RTUINT256_INIT_C(a_Qw3, a_Qw2, a_Qw1, a_Qw0) \
RTUINT256_INIT(UINT64_C(a_Qw3), UINT64_C(a_Qw2), UINT64_C(a_Qw1), UINT64_C(a_Qw0))
/**
* 512-bit unsigned integer union.
*/
#pragma pack(1)
typedef union RTUINT512U
{
/** Quad-Word view (first as it's used by RTUINT512_INIT). */
struct
{
#ifdef RT_BIG_ENDIAN
uint64_t qw7;
uint64_t qw6;
uint64_t qw5;
uint64_t qw4;
uint64_t qw3;
uint64_t qw2;
uint64_t qw1;
uint64_t qw0;
#else
uint64_t qw0;
uint64_t qw1;
uint64_t qw2;
uint64_t qw3;
uint64_t qw4;
uint64_t qw5;
uint64_t qw6;
uint64_t qw7;
#endif
} QWords;
/** Double-Word view. */
struct
{
#ifdef RT_BIG_ENDIAN
uint32_t dw15;
uint32_t dw14;
uint32_t dw13;
uint32_t dw12;
uint32_t dw11;
uint32_t dw10;
uint32_t dw9;
uint32_t dw8;
uint32_t dw7;
uint32_t dw6;
uint32_t dw5;
uint32_t dw4;
uint32_t dw3;
uint32_t dw2;
uint32_t dw1;
uint32_t dw0;
#else
uint32_t dw0;
uint32_t dw1;
uint32_t dw2;
uint32_t dw3;
uint32_t dw4;
uint32_t dw5;
uint32_t dw6;
uint32_t dw7;
uint32_t dw8;
uint32_t dw9;
uint32_t dw10;
uint32_t dw11;
uint32_t dw12;
uint32_t dw13;
uint32_t dw14;
uint32_t dw15;
#endif
} DWords;
/** Word view. */
struct
{
#ifdef RT_BIG_ENDIAN
uint16_t w31;
uint16_t w30;
uint16_t w29;
uint16_t w28;
uint16_t w27;
uint16_t w26;
uint16_t w25;
uint16_t w24;
uint16_t w23;
uint16_t w22;
uint16_t w21;
uint16_t w20;
uint16_t w19;
uint16_t w18;
uint16_t w17;
uint16_t w16;
uint16_t w15;
uint16_t w14;
uint16_t w13;
uint16_t w12;
uint16_t w11;
uint16_t w10;
uint16_t w9;
uint16_t w8;
uint16_t w7;
uint16_t w6;
uint16_t w5;
uint16_t w4;
uint16_t w3;
uint16_t w2;
uint16_t w1;
uint16_t w0;
#else
uint16_t w0;
uint16_t w1;
uint16_t w2;
uint16_t w3;
uint16_t w4;
uint16_t w5;
uint16_t w6;
uint16_t w7;
uint16_t w8;
uint16_t w9;
uint16_t w10;
uint16_t w11;
uint16_t w12;
uint16_t w13;
uint16_t w14;
uint16_t w15;
uint16_t w16;
uint16_t w17;
uint16_t w18;
uint16_t w19;
uint16_t w20;
uint16_t w21;
uint16_t w22;
uint16_t w23;
uint16_t w24;
uint16_t w25;
uint16_t w26;
uint16_t w27;
uint16_t w28;
uint16_t w29;
uint16_t w30;
uint16_t w31;
#endif
} Words;
/** Double-Quad-Word view. */
struct
{
#ifdef RT_BIG_ENDIAN
RTUINT128U dqw3;
RTUINT128U dqw2;
RTUINT128U dqw1;
RTUINT128U dqw0;
#else
RTUINT128U dqw0;
RTUINT128U dqw1;
RTUINT128U dqw2;
RTUINT128U dqw3;
#endif
} DQWords;
/** Octo-Word view. */
struct
{
#ifdef RT_BIG_ENDIAN
RTUINT256U ow3;
RTUINT256U ow2;
RTUINT256U ow1;
RTUINT256U ow0;
#else
RTUINT256U ow0;
RTUINT256U ow1;
RTUINT256U ow2;
RTUINT256U ow3;
#endif
} OWords;
/** 256-bit view. */
RTUINT256U au256[2];
/** 128-bit view. */
RTUINT128U au128[4];
/** 64-bit view. */
uint64_t au64[8];
/** 32-bit view. */
uint32_t au32[16];
/** 16-bit view. */
uint16_t au16[32];
/** 8-bit view. */
uint8_t au8[64];
} RTUINT512U;
#pragma pack()
/** Pointer to a 512-bit unsigned integer union. */
typedef RTUINT512U RT_FAR *PRTUINT512U;
/** Pointer to a const 512-bit unsigned integer union. */
typedef const RTUINT512U RT_FAR *PCRTUINT512U;
/** @def RTUINT512_INIT
* Portable RTUINT512U initializer. */
#ifdef RT_BIG_ENDIAN
# define RTUINT512_INIT(a_Qw7, a_Qw6, a_Qw5, a_Qw4, a_Qw3, a_Qw2, a_Qw1, a_Qw0) \
{ { a_Qw7, a_Qw6, a_Qw5, a_Qw4, a_Qw3, a_Qw2, a_Qw1, a_Qw0 } }
#else
# define RTUINT512_INIT(a_Qw7, a_Qw6, a_Qw5, a_Qw4, a_Qw3, a_Qw2, a_Qw1, a_Qw0) \
{ { a_Qw0, a_Qw1, a_Qw2, a_Qw3, a_Qw4, a_Qw5, a_Qw6, a_Qw7 } }
#endif
/** @def RTUINT512_INIT_C
* Portable RTUINT512U initializer for 64-bit constants. */
#define RTUINT512_INIT_C(a_Qw7, a_Qw6, a_Qw5, a_Qw4, a_Qw3, a_Qw2, a_Qw1, a_Qw0) \
RTUINT512_INIT(UINT64_C(a_Qw7), UINT64_C(a_Qw6), UINT64_C(a_Qw5), UINT64_C(a_Qw4), \
UINT64_C(a_Qw3), UINT64_C(a_Qw2), UINT64_C(a_Qw1), UINT64_C(a_Qw0))
/**
* Single precision floating point format (32-bit).
*/
typedef union RTFLOAT32U
{
/** Format using regular bitfields. */
struct
{
# ifdef RT_BIG_ENDIAN
/** The sign indicator. */
uint32_t fSign : 1;
/** The exponent (offsetted by 127). */
uint32_t uExponent : 8;
/** The fraction. */
uint32_t uFraction : 23;
# else
/** The fraction. */
uint32_t uFraction : 23;
/** The exponent (offsetted by 127). */
uint32_t uExponent : 8;
/** The sign indicator. */
uint32_t fSign : 1;
# endif
} s;
#if 1 /** @todo exclude targets which doesn't have a 64-bit double type. (currently none) */
/** Double view. */
float r;
#endif
/** Unsigned integer view. */
uint32_t u;
/** 32-bit view. */
uint32_t au32[1];
/** 16-bit view. */
uint16_t au16[2];
/** 8-bit view. */
uint8_t au8[4];
} RTFLOAT32U;
/** Pointer to a single precision floating point format union. */
typedef RTFLOAT32U RT_FAR *PRTFLOAT32U;
/** Pointer to a const single precision floating point format union. */
typedef const RTFLOAT32U RT_FAR *PCRTFLOAT32U;
/** RTFLOAT32U initializer. */
#ifdef RT_BIG_ENDIAN
# define RTFLOAT32U_INIT(a_fSign, a_uFraction, a_uExponent) { { (a_fSign), (a_uExponent), (a_uFraction) } }
#else
# define RTFLOAT32U_INIT(a_fSign, a_uFraction, a_uExponent) { { (a_uFraction), (a_uExponent), (a_fSign) } }
#endif
#define RTFLOAT32U_INIT_C(a_fSign, a_uFraction, a_uExponent) RTFLOAT32U_INIT((a_fSign), UINT32_C(a_uFraction), (a_uExponent))
#define RTFLOAT32U_INIT_ZERO(a_fSign) RTFLOAT32U_INIT((a_fSign), 0, 0)
#define RTFLOAT32U_INIT_INF(a_fSign) RTFLOAT32U_INIT((a_fSign), 0, RTFLOAT32U_EXP_MAX)
#define RTFLOAT32U_INIT_SNAN(a_fSign) RTFLOAT32U_INIT((a_fSign), 1, RTFLOAT32U_EXP_MAX)
#define RTFLOAT32U_INIT_SNAN_EX(a_fSign, a_uVal) RTFLOAT32U_INIT((a_fSign), (a_uVal) ? (a_uVal) : 1, RTFLOAT32U_EXP_MAX)
#define RTFLOAT32U_INIT_SIGNALLING_NAN(a_fSign) RTFLOAT32U_INIT_SNAN(a_fSign)
#define RTFLOAT32U_INIT_QNAN(a_fSign) RTFLOAT32U_INIT((a_fSign), RT_BIT_32(RTFLOAT32U_FRACTION_BITS - 1), RTFLOAT32U_EXP_MAX)
#define RTFLOAT32U_INIT_QNAN_EX(a_fSign, a_uVal) RTFLOAT32U_INIT((a_fSign), RT_BIT_32(RTFLOAT32U_FRACTION_BITS - 1) | (a_uVal), RTFLOAT32U_EXP_MAX)
#define RTFLOAT32U_INIT_QUIET_NAN(a_fSign) RTFLOAT32U_INIT_QNAN(a_fSign)
#define RTFLOAT32U_INIT_NAN_EX(a_fQuiet, a_fSign, a_uVal) \
RTFLOAT32U_INIT((a_fSign), \
((a_uVal) || (a_fQuiet) ? (a_uVal) : 1) | ((a_fQuiet) ? RT_BIT_32(RTFLOAT32U_FRACTION_BITS - 1) : 0), \
RTFLOAT32U_EXP_MAX)
/** The exponent bias for the RTFLOAT32U format. */
#define RTFLOAT32U_EXP_BIAS (127)
/** The max exponent value for the RTFLOAT32U format. */
#define RTFLOAT32U_EXP_MAX (255)
/** The exponent bias overflow/underflow adjust for the RTFLOAT32U format.
* @note 754-1985 sec 7.3 & 7.4, not mentioned in later standard versions. */
#define RTFLOAT32U_EXP_BIAS_ADJUST (192)
/** Fraction width (in bits) for the RTFLOAT32U format. */
#define RTFLOAT32U_FRACTION_BITS (23)
/** Check if two 32-bit floating values are identical (memcmp, not
* numerically). */
#define RTFLOAT32U_ARE_IDENTICAL(a_pLeft, a_pRight) ((a_pLeft)->u == (a_pRight)->u)
/** @name RTFLOAT32U classification macros
* @{ */
#define RTFLOAT32U_IS_ZERO(a_pr32) (((a_pr32)->u & (RT_BIT_32(31) - 1)) == 0)
#define RTFLOAT32U_IS_SUBNORMAL(a_pr32) ((a_pr32)->s.uExponent == 0 && (a_pr32)->s.uFraction != 0)
#define RTFLOAT32U_IS_INF(a_pr32) ((a_pr32)->s.uExponent == 0xff && (a_pr32)->s.uFraction == 0)
#define RTFLOAT32U_IS_SIGNALLING_NAN(a_pr32) ((a_pr32)->s.uExponent == 0xff && !((a_pr32)->s.uFraction & RT_BIT_32(22)) \
&& (a_pr32)->s.uFraction != 0)
#define RTFLOAT32U_IS_QUIET_NAN(a_pr32) ((a_pr32)->s.uExponent == 0xff && ((a_pr32)->s.uFraction & RT_BIT_32(22)))
#define RTFLOAT32U_IS_NAN(a_pr32) ((a_pr32)->s.uExponent == 0xff && (a_pr32)->s.uFraction != 0)
#define RTFLOAT32U_IS_NORMAL(a_pr32) ((a_pr32)->s.uExponent > 0 && (a_pr32)->s.uExponent < 0xff)
/** @} */
/**
* Double precision floating point format (64-bit).
*/
typedef union RTFLOAT64U
{
/** Format using regular bitfields. */
struct
{
# ifdef RT_BIG_ENDIAN
/** The sign indicator. */
uint32_t fSign : 1;
/** The exponent (offsetted by 1023). */
uint32_t uExponent : 11;
/** The fraction, bits 32 thru 51. */
uint32_t uFractionHigh : 20;
/** The fraction, bits 0 thru 31. */
uint32_t uFractionLow;
# else
/** The fraction, bits 0 thru 31. */
uint32_t uFractionLow;
/** The fraction, bits 32 thru 51. */
uint32_t uFractionHigh : 20;
/** The exponent (offsetted by 1023). */
uint32_t uExponent : 11;
/** The sign indicator. */
uint32_t fSign : 1;
# endif
} s;
#ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS
/** Format using 64-bit bitfields. */
RT_GCC_EXTENSION struct
{
# ifdef RT_BIG_ENDIAN
/** The sign indicator. */
RT_GCC_EXTENSION uint64_t fSign : 1;
/** The exponent (offsetted by 1023). */
RT_GCC_EXTENSION uint64_t uExponent : 11;
/** The fraction. */
RT_GCC_EXTENSION uint64_t uFraction : 52;
# else
/** The fraction. */
RT_GCC_EXTENSION uint64_t uFraction : 52;
/** The exponent (offsetted by 1023). */
RT_GCC_EXTENSION uint64_t uExponent : 11;
/** The sign indicator. */
RT_GCC_EXTENSION uint64_t fSign : 1;
# endif
} s64;
#endif
#if 1 /** @todo exclude targets which doesn't have a 64-bit double type. (currently none) */
/** Double view. */
double rd, r;
#endif
#ifdef RT_COMPILER_WITH_64BIT_LONG_DOUBLE
/** Long double view. */
long double lrd;
#endif
/** Unsigned integer view. */
uint64_t u;
/** 64-bit view. */
uint64_t au64[1];
/** 32-bit view. */
uint32_t au32[2];
/** 16-bit view. */
uint16_t au16[4];
/** 8-bit view. */
uint8_t au8[8];
} RTFLOAT64U;
/** Pointer to a double precision floating point format union. */
typedef RTFLOAT64U RT_FAR *PRTFLOAT64U;
/** Pointer to a const double precision floating point format union. */
typedef const RTFLOAT64U RT_FAR *PCRTFLOAT64U;
/** RTFLOAT64U initializer. */
#ifdef RT_BIG_ENDIAN
# define RTFLOAT64U_INIT(a_fSign, a_uFraction, a_uExponent) \
{ { (a_fSign), (a_uExponent), (uint32_t)((a_uFraction) >> 32), (uint32_t)((a_uFraction) & UINT32_MAX) } }
#else
# define RTFLOAT64U_INIT(a_fSign, a_uFraction, a_uExponent) \
{ { (uint32_t)((a_uFraction) & UINT32_MAX), (uint32_t)((a_uFraction) >> 32), (a_uExponent), (a_fSign) } }
#endif
#define RTFLOAT64U_INIT_C(a_fSign, a_uFraction, a_uExponent) RTFLOAT64U_INIT((a_fSign), UINT64_C(a_uFraction), (a_uExponent))
#define RTFLOAT64U_INIT_ZERO(a_fSign) RTFLOAT64U_INIT((a_fSign), UINT64_C(0), 0)
#define RTFLOAT64U_INIT_INF(a_fSign) RTFLOAT64U_INIT((a_fSign), UINT64_C(0), RTFLOAT64U_EXP_MAX)
#define RTFLOAT64U_INIT_SNAN(a_fSign) RTFLOAT64U_INIT((a_fSign), UINT64_C(1), RTFLOAT64U_EXP_MAX)
#define RTFLOAT64U_INIT_SNAN_EX(a_fSign, a_uVal) RTFLOAT64U_INIT((a_fSign), (a_uVal) ? (a_uVal) : UINT64_C(1), RTFLOAT64U_EXP_MAX)
#define RTFLOAT64U_INIT_SIGNALLING_NAN(a_fSign) RTFLOAT64U_INIT_SNAN(a_fSign)
#define RTFLOAT64U_INIT_QNAN(a_fSign) RTFLOAT64U_INIT((a_fSign), RT_BIT_64(RTFLOAT64U_FRACTION_BITS - 1), RTFLOAT64U_EXP_MAX)
#define RTFLOAT64U_INIT_QNAN_EX(a_fSign, a_uVal) RTFLOAT64U_INIT((a_fSign), RT_BIT_64(RTFLOAT64U_FRACTION_BITS - 1) | (a_uVal), RTFLOAT64U_EXP_MAX)
#define RTFLOAT64U_INIT_QUIET_NAN(a_fSign) RTFLOAT64U_INIT_QNAN(a_fSign)
#define RTFLOAT64U_INIT_NAN_EX(a_fQuiet, a_fSign, a_uVal) \
RTFLOAT64U_INIT((a_fSign), \
((a_uVal) || (a_fQuiet) ? (a_uVal) : UINT64_C(1)) | ((a_fQuiet) ? RT_BIT_64(RTFLOAT64U_FRACTION_BITS - 1) : UINT64_C(0)), \
RTFLOAT64U_EXP_MAX)
/** The exponent bias for the RTFLOAT64U format. */
#define RTFLOAT64U_EXP_BIAS (1023)
/** The max exponent value for the RTFLOAT64U format. */
#define RTFLOAT64U_EXP_MAX (2047)
/** The exponent bias overflow/underflow adjust for the RTFLOAT64U format.
* @note 754-1985 sec 7.3 & 7.4, not mentioned in later standard versions. */
#define RTFLOAT64U_EXP_BIAS_ADJUST (1536)
/** Fraction width (in bits) for the RTFLOAT64U format. */
#define RTFLOAT64U_FRACTION_BITS (52)
/** Check if two 64-bit floating values are identical (memcmp, not
* numerically). */
#define RTFLOAT64U_ARE_IDENTICAL(a_pLeft, a_pRight) ((a_pLeft)->u == (a_pRight)->u)
/** @name RTFLOAT64U classification macros
* @{ */
#define RTFLOAT64U_IS_ZERO(a_pr64) (((a_pr64)->u & (RT_BIT_64(63) - 1)) == 0)
#define RTFLOAT64U_IS_SUBNORMAL(a_pr64) ( (a_pr64)->s.uExponent == 0 \
&& ((a_pr64)->s.uFractionLow != 0 || (a_pr64)->s.uFractionHigh != 0) )
#define RTFLOAT64U_IS_INF(a_pr64) ( (a_pr64)->s.uExponent == 0x7ff \
&& (a_pr64)->s.uFractionLow == 0 && (a_pr64)->s.uFractionHigh == 0)
#define RTFLOAT64U_IS_SIGNALLING_NAN(a_pr64) ( (a_pr64)->s.uExponent == 0x7ff \
&& !((a_pr64)->s.uFractionHigh & RT_BIT_32(19)) \
&& ((a_pr64)->s.uFractionHigh != 0 || (a_pr64)->s.uFractionLow != 0) )
#define RTFLOAT64U_IS_QUIET_NAN(a_pr64) ((a_pr64)->s.uExponent == 0x7ff && ((a_pr64)->s.uFractionHigh & RT_BIT_32(19)))
#define RTFLOAT64U_IS_NAN(a_pr64) ( (a_pr64)->s.uExponent == 0x7ff \
&& ((a_pr64)->s.uFractionHigh != 0 || (a_pr64)->s.uFractionLow != 0) )
#define RTFLOAT64U_IS_NORMAL(a_pr64) ((a_pr64)->s.uExponent > 0 && (a_pr64)->s.uExponent < 0x7ff)
/** @} */
#if !defined(__IBMCPP__) && !defined(__IBMC__)
/**
* Extended Double precision floating point format (80-bit).
*/
# pragma pack(1)
typedef union RTFLOAT80U
{
/** Format using bitfields. */
RT_GCC_EXTENSION struct
{
# ifdef RT_BIG_ENDIAN /** @todo big endian mapping is wrong. */
/** The sign indicator. */
RT_GCC_EXTENSION uint16_t fSign : 1;
/** The exponent (offsetted by 16383). */
RT_GCC_EXTENSION uint16_t uExponent : 15;
/** The mantissa. */
uint64_t uMantissa;
# else
/** The mantissa. */
uint64_t uMantissa;
/** The exponent (offsetted by 16383). */
RT_GCC_EXTENSION uint16_t uExponent : 15;
/** The sign indicator. */
RT_GCC_EXTENSION uint16_t fSign : 1;
# endif
} s;
/** Format for accessing it as two separate components. */
RT_GCC_EXTENSION struct
{
# ifdef RT_BIG_ENDIAN /** @todo big endian mapping is wrong. */
/** The sign bit and exponent. */
uint16_t uSignAndExponent;
/** The mantissa. */
uint64_t uMantissa;
# else
/** The mantissa. */
uint64_t uMantissa;
/** The sign bit and exponent. */
uint16_t uSignAndExponent;
# endif
} s2;
# ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS
/** 64-bit bitfields exposing the J bit and the fraction. */
RT_GCC_EXTENSION struct
{
# ifdef RT_BIG_ENDIAN /** @todo big endian mapping is wrong. */
/** The sign indicator. */
RT_GCC_EXTENSION uint16_t fSign : 1;
/** The exponent (offsetted by 16383). */
RT_GCC_EXTENSION uint16_t uExponent : 15;
/** The J bit, aka the integer bit. */
RT_GCC_EXTENSION uint64_t fInteger : 1;
/** The fraction. */
RT_GCC_EXTENSION uint64_t uFraction : 63;
# else
/** The fraction. */
RT_GCC_EXTENSION uint64_t uFraction : 63;
/** The J bit, aka the integer bit. */
RT_GCC_EXTENSION uint64_t fInteger : 1;
/** The exponent (offsetted by 16383). */
RT_GCC_EXTENSION uint16_t uExponent : 15;
/** The sign indicator. */
RT_GCC_EXTENSION uint16_t fSign : 1;
# endif
} sj64;
# endif
/** 64-bit view. */
uint64_t au64[1];
/** 32-bit view. */
uint32_t au32[2];
/** 16-bit view. */
uint16_t au16[5];
/** 8-bit view. */
uint8_t au8[10];
} RTFLOAT80U;
# pragma pack()
/** Pointer to a extended precision floating point format union. */
typedef RTFLOAT80U RT_FAR *PRTFLOAT80U;
/** Pointer to a const extended precision floating point format union. */
typedef const RTFLOAT80U RT_FAR *PCRTFLOAT80U;
/** RTFLOAT80U initializer. */
# ifdef RT_BIG_ENDIAN
# define RTFLOAT80U_INIT(a_fSign, a_uMantissa, a_uExponent) { { (a_fSign), (a_uExponent), (a_uMantissa) } }
# else
# define RTFLOAT80U_INIT(a_fSign, a_uMantissa, a_uExponent) { { (a_uMantissa), (a_uExponent), (a_fSign) } }
# endif
# define RTFLOAT80U_INIT_C(a_fSign, a_uMantissa, a_uExponent) RTFLOAT80U_INIT((a_fSign), UINT64_C(a_uMantissa), (a_uExponent))
# define RTFLOAT80U_INIT_ZERO(a_fSign) RTFLOAT80U_INIT((a_fSign), 0, 0)
# define RTFLOAT80U_INIT_INF(a_fSign) RTFLOAT80U_INIT((a_fSign), RT_BIT_64(63), RTFLOAT80U_EXP_MAX)
# define RTFLOAT80U_INIT_SIGNALLING_NAN(a_fSign) RTFLOAT80U_INIT_SNAN((a_fSign))
# define RTFLOAT80U_INIT_SNAN(a_fSign) RTFLOAT80U_INIT((a_fSign), RT_BIT_64(63) | 1, RTFLOAT80U_EXP_MAX)
# define RTFLOAT80U_INIT_SNAN_EX(a_fSign, a_uVal) RTFLOAT80U_INIT((a_fSign), RT_BIT_64(63) | (a_uVal), RTFLOAT80U_EXP_MAX)
# define RTFLOAT80U_INIT_QUIET_NAN(a_fSign) RTFLOAT80U_INIT_QNAN((a_fSign))
# define RTFLOAT80U_INIT_QNAN(a_fSign) RTFLOAT80U_INIT((a_fSign), RT_BIT_64(63) | RT_BIT_64(62), RTFLOAT80U_EXP_MAX)
# define RTFLOAT80U_INIT_QNAN_EX(a_fSign, a_uVal) RTFLOAT80U_INIT((a_fSign), RT_BIT_64(63) | RT_BIT_64(62) | (a_uVal), RTFLOAT80U_EXP_MAX)
#define RTFLOAT80U_INIT_NAN_EX(a_fQuiet, a_fSign, a_uVal) \
RTFLOAT80U_INIT((a_fSign), \
((a_uVal) || (a_fQuiet) ? (a_uVal) : UINT64_C(1)) | ((a_fQuiet) ? RT_BIT_64(63) | RT_BIT_64(62) : RT_BIT_64(63)), \
RTFLOAT80U_EXP_MAX)
# define RTFLOAT80U_INIT_INDEFINITE(a_fSign) RTFLOAT80U_INIT((a_fSign), RT_BIT_64(63) | RT_BIT_64(62), RTFLOAT80U_EXP_MAX)
# define RTFLOAT80U_INIT_IND(a_fSign) RTFLOAT80U_INIT_INDEFINITE(a_fSign)
/** The exponent bias for the RTFLOAT80U format. */
# define RTFLOAT80U_EXP_BIAS (16383)
/** The max exponent value for the RTFLOAT80U format. */
# define RTFLOAT80U_EXP_MAX (32767)
/** The exponent bias overflow/underflow adjust for the RTFLOAT80U format.
* @note 754-1985 sec 7.3 & 7.4, not mentioned in later standard versions. */
# define RTFLOAT80U_EXP_BIAS_ADJUST (24576)
/** Fraction width (in bits) for the RTFLOAT80U format. */
# define RTFLOAT80U_FRACTION_BITS (63)
/** Check if two 80-bit floating values are identical (memcmp, not
* numberically). */
# define RTFLOAT80U_ARE_IDENTICAL(a_pLeft, a_pRight) \
( (a_pLeft)->au64[0] == (a_pRight)->au64[0] \
&& (a_pLeft)->au16[4] == (a_pRight)->au16[4] )
/** @name RTFLOAT80U classification macros
* @{ */
/** Is @a a_pr80 +0 or -0. */
# define RTFLOAT80U_IS_ZERO(a_pr80) RTFLOAT80U_IS_ZERO_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
# define RTFLOAT80U_IS_ZERO_EX(a_uMantissa, a_uExponent) \
((a_uExponent) == 0 && (a_uMantissa) == 0)
/** Is @a a_pr80 a denormal (does not match psuedo-denormal). */
# define RTFLOAT80U_IS_DENORMAL(a_pr80) RTFLOAT80U_IS_DENORMAL_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
# define RTFLOAT80U_IS_DENORMAL_EX(a_uMantissa, a_uExponent) \
((a_uExponent) == 0 && (a_uMantissa) < RT_BIT_64(63) && (a_uMantissa) != 0)
/** Is @a a_pr80 a pseudo-denormal. */
# define RTFLOAT80U_IS_PSEUDO_DENORMAL(a_pr80) RTFLOAT80U_IS_PSEUDO_DENORMAL_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
# define RTFLOAT80U_IS_PSEUDO_DENORMAL_EX(a_uMantissa, a_uExponent) \
((a_uExponent) == 0 && (a_uMantissa) >= RT_BIT_64(63))
/** Is @a a_pr80 denormal or pseudo-denormal. */
# define RTFLOAT80U_IS_DENORMAL_OR_PSEUDO_DENORMAL(a_pr80) \
RTFLOAT80U_IS_DENORMAL_OR_PSEUDO_DENORMAL_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
# define RTFLOAT80U_IS_DENORMAL_OR_PSEUDO_DENORMAL_EX(a_uMantissa, a_uExponent) ((a_uExponent) == 0 && (a_uMantissa) != 0)
/** Is @a a_pr80 +/-pseudo-infinity. */
# define RTFLOAT80U_IS_PSEUDO_INF(a_pr80) RTFLOAT80U_IS_PSEUDO_INF_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
# define RTFLOAT80U_IS_PSEUDO_INF_EX(a_uMantissa, a_uExponent) ((a_uExponent) == 0x7fff && (a_uMantissa) == 0)
/** Is @a a_pr80 pseudo-not-a-number. */
# define RTFLOAT80U_IS_PSEUDO_NAN(a_pr80) RTFLOAT80U_IS_PSEUDO_NAN_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
# define RTFLOAT80U_IS_PSEUDO_NAN_EX(a_uMantissa, a_uExponent) ((a_uExponent) == 0x7fff && !((a_uMantissa) & RT_BIT_64(63)))
/** Is @a a_pr80 infinity (does not match pseudo-infinity). */
# define RTFLOAT80U_IS_INF(a_pr80) RTFLOAT80U_IS_INF_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
# define RTFLOAT80U_IS_INF_EX(a_uMantissa, a_uExponent) ((a_uExponent) == 0x7fff && (a_uMantissa) == RT_BIT_64(63))
/** Is @a a_pr80 a signalling not-a-number value. */
# define RTFLOAT80U_IS_SIGNALLING_NAN(a_pr80) RTFLOAT80U_IS_SIGNALLING_NAN_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
# define RTFLOAT80U_IS_SIGNALLING_NAN_EX(a_uMantissa, a_uExponent) \
( (a_uExponent) == 0x7fff \
&& ((a_uMantissa) & (RT_BIT_64(63) | RT_BIT_64(62))) == RT_BIT_64(63) \
&& ((a_uMantissa) & (RT_BIT_64(62) - 1)) != 0)
/** Is @a a_pr80 a quiet not-a-number value. */
# define RTFLOAT80U_IS_QUIET_NAN(a_pr80) RTFLOAT80U_IS_QUIET_NAN_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
# define RTFLOAT80U_IS_QUIET_NAN_EX(a_uMantissa, a_uExponent) \
( (a_uExponent) == 0x7fff \
&& ((a_uMantissa) & (RT_BIT_64(63) | RT_BIT_64(62))) == (RT_BIT_64(63) | RT_BIT_64(62)) \
&& ((a_uMantissa) & (RT_BIT_64(62) - 1)) != 0)
/** Is @a a_pr80 Signalling-, Quiet- or Pseudo-NaN. */
# define RTFLOAT80U_IS_NAN(a_pr80) RTFLOAT80U_IS_NAN_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
# define RTFLOAT80U_IS_NAN_EX(a_uMantissa, a_uExponent) ((a_uExponent) == 0x7fff && ((a_uMantissa) & (RT_BIT_64(63) - 1)) != 0)
/** Is @a a_pr80 Signalling- or Quiet-Nan, but not Pseudo-NaN. */
# define RTFLOAT80U_IS_QUIET_OR_SIGNALLING_NAN(a_pr80) \
RTFLOAT80U_IS_QUIET_OR_SIGNALLING_NAN_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
# define RTFLOAT80U_IS_QUIET_OR_SIGNALLING_NAN_EX(a_uMantissa, a_uExponent) \
((a_uExponent) == 0x7fff && ((a_uMantissa) > RT_BIT_64(63)))
/** Is @a a_pr80 indefinite (ignoring sign). */
# define RTFLOAT80U_IS_INDEFINITE(a_pr80) RTFLOAT80U_IS_INDEFINITE_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
# define RTFLOAT80U_IS_INDEFINITE_EX(a_uMantissa, a_uExponent) \
((a_uExponent) == 0x7fff && (a_uMantissa) == (RT_BIT_64(63) | RT_BIT_64(62)))
/** Is @a a_pr80 Indefinite, Signalling- or Quiet-Nan, but not Pseudo-NaN (nor Infinity). */
# define RTFLOAT80U_IS_INDEFINITE_OR_QUIET_OR_SIGNALLING_NAN(a_pr80) \
RTFLOAT80U_IS_INDEFINITE_OR_QUIET_OR_SIGNALLING_NAN_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
# define RTFLOAT80U_IS_INDEFINITE_OR_QUIET_OR_SIGNALLING_NAN_EX(a_uMantissa, a_uExponent) \
((a_uExponent) == 0x7fff && (a_uMantissa) > RT_BIT_64(63))
/** Is @a a_pr80 an unnormal value (invalid operand on 387+). */
# define RTFLOAT80U_IS_UNNORMAL(a_pr80) RTFLOAT80U_IS_UNNORMAL_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
# define RTFLOAT80U_IS_UNNORMAL_EX(a_uMantissa, a_uExponent) \
(!((a_uMantissa) & RT_BIT_64(63)) && (a_uExponent) > 0 && (a_uExponent) < 0x7fff) /* a_uExponent can be signed and up to 64-bit wide */
/** Is @a a_pr80 a normal value (excludes zero). */
# define RTFLOAT80U_IS_NORMAL(a_pr80) RTFLOAT80U_IS_NORMAL_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
# define RTFLOAT80U_IS_NORMAL_EX(a_uMantissa, a_uExponent) \
(((a_uMantissa) & RT_BIT_64(63)) && (a_uExponent) > 0 && (a_uExponent) < 0x7fff) /* a_uExponent can be signed and up to 64-bit wide */
/** Invalid 387 (and later) operands: Pseudo-Infinity, Psuedo-NaN, Unnormals. */
#define RTFLOAT80U_IS_387_INVALID(a_pr80) RTFLOAT80U_IS_387_INVALID_EX((a_pr80)->s.uMantissa, (a_pr80)->s.uExponent)
#define RTFLOAT80U_IS_387_INVALID_EX(a_uMantissa, a_uExponent) \
(!((a_uMantissa) & RT_BIT_64(63)) && (a_uExponent) > 0)
/** @} */
/**
* A variant of RTFLOAT80U that may be larger than 80-bits depending on how the
* compiler implements long double.
*
* @note On AMD64 systems implementing the System V ABI, this will be 16 bytes!
* The last 6 bytes are unused padding taken up by the long double view.
*/
# pragma pack(1)
typedef union RTFLOAT80U2
{
/** Format using bitfields. */
RT_GCC_EXTENSION struct
{
# ifdef RT_BIG_ENDIAN /** @todo big endian mapping is wrong. */
/** The sign indicator. */
RT_GCC_EXTENSION uint16_t fSign : 1;
/** The exponent (offsetted by 16383). */
RT_GCC_EXTENSION uint16_t uExponent : 15;
/** The mantissa. */
uint64_t uMantissa;
# else
/** The mantissa. */
uint64_t uMantissa;
/** The exponent (offsetted by 16383). */
RT_GCC_EXTENSION uint16_t uExponent : 15;
/** The sign indicator. */
RT_GCC_EXTENSION uint16_t fSign : 1;
# endif
} s;
/** Format for accessing it as two separate components. */
RT_GCC_EXTENSION struct
{
# ifdef RT_BIG_ENDIAN /** @todo big endian mapping is wrong. */
/** The sign bit and exponent. */
uint16_t uSignAndExponent;
/** The mantissa. */
uint64_t uMantissa;
# else
/** The mantissa. */
uint64_t uMantissa;
/** The sign bit and exponent. */
uint16_t uSignAndExponent;
# endif
} s2;
/** Bitfield exposing the J bit and the fraction. */
RT_GCC_EXTENSION struct
{
# ifdef RT_BIG_ENDIAN /** @todo big endian mapping is wrong. */
/** The sign indicator. */
RT_GCC_EXTENSION uint16_t fSign : 1;
/** The exponent (offsetted by 16383). */
RT_GCC_EXTENSION uint16_t uExponent : 15;
/** The J bit, aka the integer bit. */
uint32_t fInteger : 1;
/** The fraction, bits 32 thru 62. */
uint32_t uFractionHigh : 31;
/** The fraction, bits 0 thru 31. */
uint32_t uFractionLow : 32;
# else
/** The fraction, bits 0 thru 31. */
uint32_t uFractionLow : 32;
/** The fraction, bits 32 thru 62. */
uint32_t uFractionHigh : 31;
/** The J bit, aka the integer bit. */
uint32_t fInteger : 1;
/** The exponent (offsetted by 16383). */
RT_GCC_EXTENSION uint16_t uExponent : 15;
/** The sign indicator. */
RT_GCC_EXTENSION uint16_t fSign : 1;
# endif
} sj;
# ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS
/** 64-bit bitfields exposing the J bit and the fraction. */
RT_GCC_EXTENSION struct
{
# ifdef RT_BIG_ENDIAN /** @todo big endian mapping is wrong. */
/** The sign indicator. */
RT_GCC_EXTENSION uint16_t fSign : 1;
/** The exponent (offsetted by 16383). */
RT_GCC_EXTENSION uint16_t uExponent : 15;
/** The J bit, aka the integer bit. */
RT_GCC_EXTENSION uint64_t fInteger : 1;
/** The fraction. */
RT_GCC_EXTENSION uint64_t uFraction : 63;
# else
/** The fraction. */
RT_GCC_EXTENSION uint64_t uFraction : 63;
/** The J bit, aka the integer bit. */
RT_GCC_EXTENSION uint64_t fInteger : 1;
/** The exponent (offsetted by 16383). */
RT_GCC_EXTENSION uint16_t uExponent : 15;
/** The sign indicator. */
RT_GCC_EXTENSION uint16_t fSign : 1;
# endif
} sj64;
# endif
# ifdef RT_COMPILER_WITH_80BIT_LONG_DOUBLE
/** Long double view. */
long double lrd, r;
# endif
/** 64-bit view. */
uint64_t au64[1];
/** 32-bit view. */
uint32_t au32[2];
/** 16-bit view. */
uint16_t au16[5];
/** 8-bit view. */
uint8_t au8[10];
} RTFLOAT80U2;
# pragma pack()
/** Pointer to a extended precision floating point format union, 2nd
* variant. */
typedef RTFLOAT80U2 RT_FAR *PRTFLOAT80U2;
/** Pointer to a const extended precision floating point format union, 2nd
* variant. */
typedef const RTFLOAT80U2 RT_FAR *PCRTFLOAT80U2;
#endif /* uint16_t bitfields doesn't work */
/**
* Quadruple precision floating point format (128-bit).
*/
typedef union RTFLOAT128U
{
/** Format using regular bitfields. */
struct
{
# ifdef RT_BIG_ENDIAN
/** The sign indicator. */
uint32_t fSign : 1;
/** The exponent (offsetted by 16383). */
uint32_t uExponent : 15;
/** The fraction, bits 96 thru 111. */
uint32_t uFractionHigh : 16;
/** The fraction, bits 64 thru 95. */
uint32_t uFractionMid;
/** The fraction, bits 0 thru 63. */
uint64_t uFractionLow;
# else
/** The fraction, bits 0 thru 63. */
uint64_t uFractionLow;
/** The fraction, bits 64 thru 95. */
uint32_t uFractionMid;
/** The fraction, bits 96 thru 111. */
uint32_t uFractionHigh : 16;
/** The exponent (offsetted by 16383). */
uint32_t uExponent : 15;
/** The sign indicator. */
uint32_t fSign : 1;
# endif
} s;
/** Format for accessing it as two separate components. */
struct
{
# ifdef RT_BIG_ENDIAN
/** The sign bit and exponent. */
uint16_t uSignAndExponent;
/** The fraction, bits 96 thru 111. */
uint16_t uFractionHigh;
/** The fraction, bits 64 thru 95. */
uint32_t uFractionMid;
/** The fraction, bits 0 thru 63. */
uint64_t uFractionLow;
# else
/** The fraction, bits 0 thru 63. */
uint64_t uFractionLow;
/** The fraction, bits 64 thru 95. */
uint32_t uFractionMid;
/** The fraction, bits 96 thru 111. */
uint16_t uFractionHigh;
/** The sign bit and exponent. */
uint16_t uSignAndExponent;
# endif
} s2;
#ifdef RT_COMPILER_GROKS_64BIT_BITFIELDS
/** Format using 64-bit bitfields. */
RT_GCC_EXTENSION struct
{
# ifdef RT_BIG_ENDIAN
/** The sign indicator. */
RT_GCC_EXTENSION uint64_t fSign : 1;
/** The exponent (offsetted by 16383). */
RT_GCC_EXTENSION uint64_t uExponent : 15;
/** The fraction, bits 64 thru 111. */
RT_GCC_EXTENSION uint64_t uFractionHi : 48;
/** The fraction, bits 0 thru 63. */
uint64_t uFractionLo;
# else
/** The fraction, bits 0 thru 63. */
uint64_t uFractionLo;
/** The fraction, bits 64 thru 111. */
RT_GCC_EXTENSION uint64_t uFractionHi : 48;
/** The exponent (offsetted by 16383). */
RT_GCC_EXTENSION uint64_t uExponent : 15;
/** The sign indicator. */
RT_GCC_EXTENSION uint64_t fSign : 1;
# endif
} s64;
#endif
#ifdef RT_COMPILER_WITH_128BIT_LONG_DOUBLE
/** Long double view. */
long double lrd, r;
#endif
/** 128-bit view. */
RTUINT128U u128;
/** 64-bit view. */
uint64_t au64[2];
/** 32-bit view. */
uint32_t au32[4];
/** 16-bit view. */
uint16_t au16[8];
/** 8-bit view. */
uint8_t au8[16];
} RTFLOAT128U;
/** Pointer to a quadruple precision floating point format union. */
typedef RTFLOAT128U RT_FAR *PRTFLOAT128U;
/** Pointer to a const quadruple precision floating point format union. */
typedef const RTFLOAT128U RT_FAR *PCRTFLOAT128U;
/** RTFLOAT128U initializer. */
#ifdef RT_BIG_ENDIAN
# define RTFLOAT128U_INIT(a_fSign, a_uFractionHi, a_uFractionLo, a_uExponent) \
{ { (a_fSign), (a_uExponent), (uint32_t)((a_uFractionHi) >> 32), (uint32_t)((a_uFractionHi) & UINT32_MAX), (a_uFractionLo) } }
#else
# define RTFLOAT128U_INIT(a_fSign, a_uFractionHi, a_uFractionLo, a_uExponent) \
{ { (a_uFractionLo), (uint32_t)((a_uFractionHi) & UINT32_MAX), (uint32_t)((a_uFractionHi) >> 32), (a_uExponent), (a_fSign) } }
#endif
#define RTFLOAT128U_INIT_C(a_fSign, a_uFractionHi, a_uFractionLo, a_uExponent) \
RTFLOAT128U_INIT((a_fSign), UINT64_C(a_uFractionHi), UINT64_C(a_uFractionLo), (a_uExponent))
#define RTFLOAT128U_INIT_ZERO(a_fSign) RTFLOAT128U_INIT((a_fSign), UINT64_C(0), UINT64_C(0), 0)
#define RTFLOAT128U_INIT_INF(a_fSign) RTFLOAT128U_INIT((a_fSign), UINT64_C(0), UINT64_C(0), RTFLOAT128U_EXP_MAX)
#define RTFLOAT128U_INIT_SNAN(a_fSign) RTFLOAT128U_INIT((a_fSign), UINT64_C(0), UINT64_C(1), RTFLOAT128U_EXP_MAX)
#define RTFLOAT128U_INIT_SNAN_EX(a_fSign, a_uValHi, a_uValLo) \
RTFLOAT128U_INIT((a_fSign), (a_uValHi), (a_uValHi) || (a_uValLo) ? (a_uValLo) : UINT64_C(1), RTFLOAT128U_EXP_MAX)
#define RTFLOAT128U_INIT_SIGNALLING_NAN(a_fSign) RTFLOAT128U_INIT_SNAN(a_fSign)
#define RTFLOAT128U_INIT_QNAN(a_fSign) \
RTFLOAT128U_INIT((a_fSign), RT_BIT_64(RTFLOAT128U_FRACTION_BITS - 1 - 64), UINT64_C(0), RTFLOAT128U_EXP_MAX)
#define RTFLOAT128U_INIT_QNAN_EX(a_fSign, a_uValHi, a_uValLo) \
RTFLOAT128U_INIT((a_fSign), RT_BIT_64(RTFLOAT128U_FRACTION_BITS - 1 - 64) | (a_uValHi), (a_uValLo), RTFLOAT128U_EXP_MAX)
#define RTFLOAT128U_INIT_QUIET_NAN(a_fSign) RTFLOAT128U_INIT_QNAN(a_fSign)
#define RTFLOAT128U_INIT_NAN_EX(a_fQuiet, a_fSign, a_uValHi, a_uValLo) \
RTFLOAT128U_INIT((a_fSign), \
((a_fQuiet) ? RT_BIT_64(RTFLOAT128U_FRACTION_BITS - 1 - 64) : 0) | (a_uValHi), \
(a_uValLo) || (a_uValHi) || (a_fQuiet) ? (a_uValLo) : UINT64_C(1), \
RTFLOAT128U_EXP_MAX)
/** The exponent bias for the RTFLOAT128U format. */
#define RTFLOAT128U_EXP_BIAS (16383)
/** The max exponent value for the RTFLOAT128U format. */
#define RTFLOAT128U_EXP_MAX (32767)
/** The exponent bias overflow/underflow adjust for the RTFLOAT128U format.
* @note This is stipulated based on RTFLOAT80U, it doesn't appear in any
* standard text as far as we know. */
#define RTFLOAT128U_EXP_BIAS_ADJUST (24576)
/** Fraction width (in bits) for the RTFLOAT128U format. */
#define RTFLOAT128U_FRACTION_BITS (112)
/** Check if two 128-bit floating values are identical (memcmp, not
* numerically). */
#define RTFLOAT128U_ARE_IDENTICAL(a_pLeft, a_pRight) \
( (a_pLeft)->au64[0] == (a_pRight)->au64[0] && (a_pLeft)->au64[1] == (a_pRight)->au64[1] )
/** @name RTFLOAT128U classification macros
* @{ */
#define RTFLOAT128U_IS_ZERO(a_pr128) ( (a_pr128)->u128.s.Lo == 0 \
&& ((a_pr128)->u128.s.Hi & (RT_BIT_64(63) - 1)) == 0)
#define RTFLOAT128U_IS_SUBNORMAL(a_pr128) ( (a_pr128)->s.uExponent == 0 \
&& ( (a_pr128)->s.uFractionLow != 0 \
|| (a_pr128)->s.uFractionMid != 0 \
|| (a_pr128)->s.uFractionHigh != 0 ) )
#define RTFLOAT128U_IS_INF(a_pr128) ( (a_pr128)->s.uExponent == RTFLOAT128U_EXP_MAX \
&& (a_pr128)->s.uFractionHigh == 0 \
&& (a_pr128)->s.uFractionMid == 0 \
&& (a_pr128)->s.uFractionLow == 0 )
#define RTFLOAT128U_IS_SIGNALLING_NAN(a_pr128) ( (a_pr128)->s.uExponent == RTFLOAT128U_EXP_MAX \
&& !((a_pr128)->s.uFractionHigh & RT_BIT_32(15)) \
&& ( (a_pr128)->s.uFractionHigh != 0 \
|| (a_pr128)->s.uFractionMid != 0 \
|| (a_pr128)->s.uFractionLow != 0) )
#define RTFLOAT128U_IS_QUIET_NAN(a_pr128) ( (a_pr128)->s.uExponent == RTFLOAT128U_EXP_MAX \
&& ((a_pr128)->s.uFractionHigh & RT_BIT_32(15)))
#define RTFLOAT128U_IS_NAN(a_pr128) ( (a_pr128)->s.uExponent == RTFLOAT128U_EXP_MAX \
&& ( (a_pr128)->s.uFractionLow != 0 \
|| (a_pr128)->s.uFractionMid != 0 \
|| (a_pr128)->s.uFractionHigh != 0) )
#define RTFLOAT128U_IS_NORMAL(a_pr128) ((a_pr128)->s.uExponent > 0 && (a_pr128)->s.uExponent < RTFLOAT128U_EXP_MAX)
/** @} */
/**
* Packed BCD 18-digit signed integer format (80-bit).
*/
#pragma pack(1)
typedef union RTPBCD80U
{
/** Format using bitfields. */
RT_GCC_EXTENSION struct
{
/** 18 packed BCD digits, two to a byte. */
uint8_t abPairs[9];
/** Padding, non-zero if indefinite. */
RT_GCC_EXTENSION uint8_t uPad : 7;
/** The sign indicator. */
RT_GCC_EXTENSION uint8_t fSign : 1;
} s;
/** 64-bit view. */
uint64_t au64[1];
/** 32-bit view. */
uint32_t au32[2];
/** 16-bit view. */
uint16_t au16[5];
/** 8-bit view. */
uint8_t au8[10];
} RTPBCD80U;
#pragma pack()
/** Pointer to a packed BCD integer format union. */
typedef RTPBCD80U RT_FAR *PRTPBCD80U;
/** Pointer to a const packed BCD integer format union. */
typedef const RTPBCD80U RT_FAR *PCRTPBCD80U;
/** RTPBCD80U initializer. */
#define RTPBCD80U_INIT_C(a_fSign, a_D17, a_D16, a_D15, a_D14, a_D13, a_D12, a_D11, a_D10, \
a_D9, a_D8, a_D7, a_D6, a_D5, a_D4, a_D3, a_D2, a_D1, a_D0) \
RTPBCD80U_INIT_EX_C(0, a_fSign, a_D17, a_D16, a_D15, a_D14, a_D13, a_D12, a_D11, a_D10, \
a_D9, a_D8, a_D7, a_D6, a_D5, a_D4, a_D3, a_D2, a_D1, a_D0)
/** Extended RTPBCD80U initializer. */
#define RTPBCD80U_INIT_EX_C(a_uPad, a_fSign, a_D17, a_D16, a_D15, a_D14, a_D13, a_D12, a_D11, a_D10, \
a_D9, a_D8, a_D7, a_D6, a_D5, a_D4, a_D3, a_D2, a_D1, a_D0) \
{ { { RTPBCD80U_MAKE_PAIR(a_D1, a_D0), \
RTPBCD80U_MAKE_PAIR(a_D3, a_D2), \
RTPBCD80U_MAKE_PAIR(a_D5, a_D4), \
RTPBCD80U_MAKE_PAIR(a_D7, a_D6), \
RTPBCD80U_MAKE_PAIR(a_D9, a_D8), \
RTPBCD80U_MAKE_PAIR(a_D11, a_D10), \
RTPBCD80U_MAKE_PAIR(a_D13, a_D12), \
RTPBCD80U_MAKE_PAIR(a_D15, a_D14), \
RTPBCD80U_MAKE_PAIR(a_D17, a_D16), }, (a_uPad), (a_fSign) } }
/** RTPBCD80U initializer for the zero value. */
#define RTPBCD80U_INIT_ZERO(a_fSign) RTPBCD80U_INIT_C(a_fSign, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0)
/** RTPBCD80U initializer for the indefinite value. */
#define RTPBCD80U_INIT_INDEFINITE() RTPBCD80U_INIT_EX_C(0x7f,1, 0xf,0xf, 0xc,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0)
/** RTPBCD80U initializer for the minimum value. */
#define RTPBCD80U_INIT_MIN() RTPBCD80U_INIT_C(1, 9,9, 9,9, 9,9, 9,9, 9,9, 9,9, 9,9, 9,9, 9,9)
/** RTPBCD80U initializer for the maximum value. */
#define RTPBCD80U_INIT_MAX() RTPBCD80U_INIT_C(0, 9,9, 9,9, 9,9, 9,9, 9,9, 9,9, 9,9, 9,9, 9,9)
/** RTPBCD80U minimum value. */
#define RTPBCD80U_MIN INT64_C(-999999999999999999)
/** RTPBCD80U maximum value. */
#define RTPBCD80U_MAX INT64_C(999999999999999999)
/** Makes a packs a pair of BCD digits. */
#define RTPBCD80U_MAKE_PAIR(a_D1, a_D0) ((a_D0) | ((a_D1) << 4))
/** Retrieves the lower digit of a BCD digit pair. */
#define RTPBCD80U_LO_DIGIT(a_bPair) ((a_bPair) & 0xf)
/** Retrieves the higher digit of a BCD digit pair. */
#define RTPBCD80U_HI_DIGIT(a_bPair) ((a_bPair) >> 4)
/** Checks if the packaged BCD number is representing indefinite. */
#define RTPBCD80U_IS_INDEFINITE(a_pd80) \
( (a_pd80)->s.uPad == 0x7f \
&& (a_pd80)->s.fSign == 1 \
&& (a_pd80)->s.abPairs[8] == 0xff \
&& (a_pd80)->s.abPairs[7] == RTPBCD80U_MAKE_PAIR(0xc, 0) \
&& (a_pd80)->s.abPairs[6] == 0 \
&& (a_pd80)->s.abPairs[5] == 0 \
&& (a_pd80)->s.abPairs[4] == 0 \
&& (a_pd80)->s.abPairs[3] == 0 \
&& (a_pd80)->s.abPairs[2] == 0 \
&& (a_pd80)->s.abPairs[1] == 0 \
&& (a_pd80)->s.abPairs[0] == 0)
/** Check if @a a_pd80Left and @a a_pd80Right are exactly the same. */
#define RTPBCD80U_ARE_IDENTICAL(a_pd80Left, a_pd80Right) \
( (a_pd80Left)->au64[0] == (a_pd80Right)->au64[0] && (a_pd80Left)->au16[4] == (a_pd80Right)->au16[4] )
/** Generic function type.
* @see PFNRT
*/
typedef DECLCALLBACKTYPE(void, FNRT,(void));
/** Generic function pointer.
* With -pedantic, gcc-4 complains when casting a function to a data object, for
* example:
*
* @code
* void foo(void)
* {
* }
*
* void *bar = (void *)foo;
* @endcode
*
* The compiler would warn with "ISO C++ forbids casting between
* pointer-to-function and pointer-to-object". The purpose of this warning is
* not to bother the programmer but to point out that he is probably doing
* something dangerous, assigning a pointer to executable code to a data object.
*/
typedef FNRT *PFNRT;
/** Variant on PFNRT that takes one pointer argument. */
typedef DECLCALLBACKTYPE(void, FNRT1,(void *pvArg));
/** Pointer to FNRT1. */
typedef FNRT1 *PFNRT1;
/** Millisecond interval. */
typedef uint32_t RTMSINTERVAL;
/** Pointer to a millisecond interval. */
typedef RTMSINTERVAL RT_FAR *PRTMSINTERVAL;
/** Pointer to a const millisecond interval. */
typedef const RTMSINTERVAL RT_FAR *PCRTMSINTERVAL;
/** Pointer to a time spec structure. */
typedef struct RTTIMESPEC RT_FAR *PRTTIMESPEC;
/** Pointer to a const time spec structure. */
typedef const struct RTTIMESPEC RT_FAR *PCRTTIMESPEC;
/** @defgroup grp_rt_types_both Common Guest and Host Context Basic Types
* @{
*/
/** Signed integer which can contain both GC and HC pointers. */
#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32) || (HC_ARCH_BITS == 16 || GC_ARCH_BITS == 16)
typedef int32_t RTINTPTR;
#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
typedef int64_t RTINTPTR;
#else
# error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
#endif
/** Pointer to signed integer which can contain both GC and HC pointers. */
typedef RTINTPTR RT_FAR *PRTINTPTR;
/** Pointer const to signed integer which can contain both GC and HC pointers. */
typedef const RTINTPTR RT_FAR *PCRTINTPTR;
/** The maximum value the RTINTPTR type can hold. */
#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32) || (HC_ARCH_BITS == 16 || GC_ARCH_BITS == 16)
# define RTINTPTR_MAX INT32_MAX
#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
# define RTINTPTR_MAX INT64_MAX
#else
# error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
#endif
/** The minimum value the RTINTPTR type can hold. */
#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32) || (HC_ARCH_BITS == 16 || GC_ARCH_BITS == 16)
# define RTINTPTR_MIN INT32_MIN
#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
# define RTINTPTR_MIN INT64_MIN
#else
# error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
#endif
/** Unsigned integer which can contain both GC and HC pointers. */
#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32) || (HC_ARCH_BITS == 16 || GC_ARCH_BITS == 16)
typedef uint32_t RTUINTPTR;
#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
typedef uint64_t RTUINTPTR;
#else
# error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
#endif
/** Pointer to unsigned integer which can contain both GC and HC pointers. */
typedef RTUINTPTR RT_FAR *PRTUINTPTR;
/** Pointer const to unsigned integer which can contain both GC and HC pointers. */
typedef const RTUINTPTR RT_FAR *PCRTUINTPTR;
/** The maximum value the RTUINTPTR type can hold. */
#if (HC_ARCH_BITS == 32 && GC_ARCH_BITS == 32) || (HC_ARCH_BITS == 16 || GC_ARCH_BITS == 16)
# define RTUINTPTR_MAX UINT32_MAX
#elif (HC_ARCH_BITS == 64 || GC_ARCH_BITS == 64)
# define RTUINTPTR_MAX UINT64_MAX
#else
# error Unsupported HC_ARCH_BITS and/or GC_ARCH_BITS values.
#endif
/** Signed integer. */
typedef int32_t RTINT;
/** Pointer to signed integer. */
typedef RTINT RT_FAR *PRTINT;
/** Pointer to const signed integer. */
typedef const RTINT RT_FAR *PCRTINT;
/** Unsigned integer. */
typedef uint32_t RTUINT;
/** Pointer to unsigned integer. */
typedef RTUINT RT_FAR *PRTUINT;
/** Pointer to const unsigned integer. */
typedef const RTUINT RT_FAR *PCRTUINT;
/** A file offset / size (off_t). */
typedef int64_t RTFOFF;
/** Pointer to a file offset / size. */
typedef RTFOFF RT_FAR *PRTFOFF;
/** The max value for RTFOFF. */
#define RTFOFF_MAX INT64_MAX
/** The min value for RTFOFF. */
#define RTFOFF_MIN INT64_MIN
/** File mode (see iprt/fs.h). */
typedef uint32_t RTFMODE;
/** Pointer to file mode. */
typedef RTFMODE RT_FAR *PRTFMODE;
/** Device unix number. */
typedef uint32_t RTDEV;
/** Pointer to a device unix number. */
typedef RTDEV RT_FAR *PRTDEV;
/** @name RTDEV Macros
* @{ */
/**
* Our makedev macro.
* @returns RTDEV
* @param uMajor The major device number.
* @param uMinor The minor device number.
*/
#define RTDEV_MAKE(uMajor, uMinor) ((RTDEV)( ((RTDEV)(uMajor) << 24) | (uMinor & UINT32_C(0x00ffffff)) ))
/**
* Get the major device node number from an RTDEV type.
* @returns The major device number of @a uDev
* @param uDev The device number.
*/
#define RTDEV_MAJOR(uDev) ((uDev) >> 24)
/**
* Get the minor device node number from an RTDEV type.
* @returns The minor device number of @a uDev
* @param uDev The device number.
*/
#define RTDEV_MINOR(uDev) ((uDev) & UINT32_C(0x00ffffff))
/** @} */
/** i-node number. */
typedef uint64_t RTINODE;
/** Pointer to a i-node number. */
typedef RTINODE RT_FAR *PRTINODE;
/** User id. */
typedef uint32_t RTUID;
/** Pointer to a user id. */
typedef RTUID RT_FAR *PRTUID;
/** NIL user id.
* @todo check this for portability! */
#define NIL_RTUID (~(RTUID)0)
/** Group id. */
typedef uint32_t RTGID;
/** Pointer to a group id. */
typedef RTGID RT_FAR *PRTGID;
/** NIL group id.
* @todo check this for portability! */
#define NIL_RTGID (~(RTGID)0)
/** I/O Port. */
typedef uint16_t RTIOPORT;
/** Pointer to I/O Port. */
typedef RTIOPORT RT_FAR *PRTIOPORT;
/** Pointer to const I/O Port. */
typedef const RTIOPORT RT_FAR *PCRTIOPORT;
/** Selector. */
typedef uint16_t RTSEL;
/** Pointer to selector. */
typedef RTSEL RT_FAR *PRTSEL;
/** Pointer to const selector. */
typedef const RTSEL RT_FAR *PCRTSEL;
/** Max selector value. */
#define RTSEL_MAX UINT16_MAX
/** Far 16-bit pointer. */
#pragma pack(1)
typedef struct RTFAR16
{
uint16_t off;
RTSEL sel;
} RTFAR16;
#pragma pack()
/** Pointer to Far 16-bit pointer. */
typedef RTFAR16 RT_FAR *PRTFAR16;
/** Pointer to const Far 16-bit pointer. */
typedef const RTFAR16 RT_FAR *PCRTFAR16;
/** Far 32-bit pointer. */
#pragma pack(1)
typedef struct RTFAR32
{
uint32_t off;
RTSEL sel;
} RTFAR32;
#pragma pack()
/** Pointer to Far 32-bit pointer. */
typedef RTFAR32 RT_FAR *PRTFAR32;
/** Pointer to const Far 32-bit pointer. */
typedef const RTFAR32 RT_FAR *PCRTFAR32;
/** Far 64-bit pointer. */
#pragma pack(1)
typedef struct RTFAR64
{
uint64_t off;
RTSEL sel;
} RTFAR64;
#pragma pack()
/** Pointer to Far 64-bit pointer. */
typedef RTFAR64 RT_FAR *PRTFAR64;
/** Pointer to const Far 64-bit pointer. */
typedef const RTFAR64 RT_FAR *PCRTFAR64;
/** @} */
/** @defgroup grp_rt_types_hc Host Context Basic Types
* @{
*/
/** HC Natural signed integer.
* @deprecated silly type. */
typedef int32_t RTHCINT;
/** Pointer to HC Natural signed integer.
* @deprecated silly type. */
typedef RTHCINT RT_FAR *PRTHCINT;
/** Pointer to const HC Natural signed integer.
* @deprecated silly type. */
typedef const RTHCINT RT_FAR *PCRTHCINT;
/** HC Natural unsigned integer.
* @deprecated silly type. */
typedef uint32_t RTHCUINT;
/** Pointer to HC Natural unsigned integer.
* @deprecated silly type. */
typedef RTHCUINT RT_FAR *PRTHCUINT;
/** Pointer to const HC Natural unsigned integer.
* @deprecated silly type. */
typedef const RTHCUINT RT_FAR *PCRTHCUINT;
/** Signed integer which can contain a HC pointer. */
#if HC_ARCH_BITS == 32 || HC_ARCH_BITS == 16
typedef int32_t RTHCINTPTR;
#elif HC_ARCH_BITS == 64
typedef int64_t RTHCINTPTR;
#else
# error Unsupported HC_ARCH_BITS value.
#endif
/** Pointer to signed integer which can contain a HC pointer. */
typedef RTHCINTPTR RT_FAR *PRTHCINTPTR;
/** Pointer to const signed integer which can contain a HC pointer. */
typedef const RTHCINTPTR RT_FAR *PCRTHCINTPTR;
/** Max RTHCINTPTR value. */
#if HC_ARCH_BITS == 32
# define RTHCINTPTR_MAX INT32_MAX
#elif HC_ARCH_BITS == 64
# define RTHCINTPTR_MAX INT64_MAX
#else
# define RTHCINTPTR_MAX INT16_MAX
#endif
/** Min RTHCINTPTR value. */
#if HC_ARCH_BITS == 32
# define RTHCINTPTR_MIN INT32_MIN
#elif HC_ARCH_BITS == 64
# define RTHCINTPTR_MIN INT64_MIN
#else
# define RTHCINTPTR_MIN INT16_MIN
#endif
/** Signed integer which can contain a HC ring-3 pointer. */
#if R3_ARCH_BITS == 32 || R3_ARCH_BITS == 16
typedef int32_t RTR3INTPTR;
#elif R3_ARCH_BITS == 64
typedef int64_t RTR3INTPTR;
#else
# error Unsupported R3_ARCH_BITS value.
#endif
/** Pointer to signed integer which can contain a HC ring-3 pointer. */
typedef RTR3INTPTR RT_FAR *PRTR3INTPTR;
/** Pointer to const signed integer which can contain a HC ring-3 pointer. */
typedef const RTR3INTPTR RT_FAR *PCRTR3INTPTR;
/** Max RTR3INTPTR value. */
#if R3_ARCH_BITS == 32 || R3_ARCH_BITS == 16
# define RTR3INTPTR_MAX INT32_MAX
#else
# define RTR3INTPTR_MAX INT64_MAX
#endif
/** Min RTR3INTPTR value. */
#if R3_ARCH_BITS == 32 || R3_ARCH_BITS == 16
# define RTR3INTPTR_MIN INT32_MIN
#else
# define RTR3INTPTR_MIN INT64_MIN
#endif
/** Signed integer which can contain a HC ring-0 pointer. */
#if R0_ARCH_BITS == 32 || R0_ARCH_BITS == 16
typedef int32_t RTR0INTPTR;
#elif R0_ARCH_BITS == 64
typedef int64_t RTR0INTPTR;
#else
# error Unsupported R0_ARCH_BITS value.
#endif
/** Pointer to signed integer which can contain a HC ring-0 pointer. */
typedef RTR0INTPTR RT_FAR *PRTR0INTPTR;
/** Pointer to const signed integer which can contain a HC ring-0 pointer. */
typedef const RTR0INTPTR RT_FAR *PCRTR0INTPTR;
/** Max RTR0INTPTR value. */
#if R0_ARCH_BITS == 32 || R0_ARCH_BITS == 16
# define RTR0INTPTR_MAX INT32_MAX
#else
# define RTR0INTPTR_MAX INT64_MAX
#endif
/** Min RTHCINTPTR value. */
#if R0_ARCH_BITS == 32 || R0_ARCH_BITS == 16
# define RTR0INTPTR_MIN INT32_MIN
#else
# define RTR0INTPTR_MIN INT64_MIN
#endif
/** Unsigned integer which can contain a HC pointer. */
#if HC_ARCH_BITS == 32 || HC_ARCH_BITS == 16
typedef uint32_t RTHCUINTPTR;
#elif HC_ARCH_BITS == 64
typedef uint64_t RTHCUINTPTR;
#else
# error Unsupported HC_ARCH_BITS value.
#endif
/** Pointer to unsigned integer which can contain a HC pointer. */
typedef RTHCUINTPTR RT_FAR *PRTHCUINTPTR;
/** Pointer to unsigned integer which can contain a HC pointer. */
typedef const RTHCUINTPTR RT_FAR *PCRTHCUINTPTR;
/** Max RTHCUINTTPR value. */
#if HC_ARCH_BITS == 32 || HC_ARCH_BITS == 16
# define RTHCUINTPTR_MAX UINT32_MAX
#else
# define RTHCUINTPTR_MAX UINT64_MAX
#endif
/** Unsigned integer which can contain a HC ring-3 pointer. */
#if R3_ARCH_BITS == 32 || R3_ARCH_BITS == 16
typedef uint32_t RTR3UINTPTR;
#elif R3_ARCH_BITS == 64
typedef uint64_t RTR3UINTPTR;
#else
# error Unsupported R3_ARCH_BITS value.
#endif
/** Pointer to unsigned integer which can contain a HC ring-3 pointer. */
typedef RTR3UINTPTR RT_FAR *PRTR3UINTPTR;
/** Pointer to unsigned integer which can contain a HC ring-3 pointer. */
typedef const RTR3UINTPTR RT_FAR *PCRTR3UINTPTR;
/** Max RTHCUINTTPR value. */
#if R3_ARCH_BITS == 32 || R3_ARCH_BITS == 16
# define RTR3UINTPTR_MAX UINT32_MAX
#else
# define RTR3UINTPTR_MAX UINT64_MAX
#endif
/** Unsigned integer which can contain a HC ring-0 pointer. */
#if R0_ARCH_BITS == 32 || R0_ARCH_BITS == 16
typedef uint32_t RTR0UINTPTR;
#elif R0_ARCH_BITS == 64
typedef uint64_t RTR0UINTPTR;
#else
# error Unsupported R0_ARCH_BITS value.
#endif
/** Pointer to unsigned integer which can contain a HC ring-0 pointer. */
typedef RTR0UINTPTR RT_FAR *PRTR0UINTPTR;
/** Pointer to unsigned integer which can contain a HC ring-0 pointer. */
typedef const RTR0UINTPTR RT_FAR *PCRTR0UINTPTR;
/** Max RTR0UINTTPR value. */
#if R0_ARCH_BITS == 32 || R0_ARCH_BITS == 16
# define RTR0UINTPTR_MAX UINT32_MAX
#else
# define RTR0UINTPTR_MAX UINT64_MAX
#endif
/** Host Physical Memory Address. */
typedef uint64_t RTHCPHYS;
/** Pointer to Host Physical Memory Address. */
typedef RTHCPHYS RT_FAR *PRTHCPHYS;
/** Pointer to const Host Physical Memory Address. */
typedef const RTHCPHYS RT_FAR *PCRTHCPHYS;
/** @def NIL_RTHCPHYS
* NIL HC Physical Address.
* NIL_RTHCPHYS is used to signal an invalid physical address, similar
* to the NULL pointer.
*/
#define NIL_RTHCPHYS (~(RTHCPHYS)0)
/** Max RTHCPHYS value. */
#define RTHCPHYS_MAX UINT64_MAX
/** HC pointer. */
#if !defined(IN_RC) || defined(DOXYGEN_RUNNING)
typedef void RT_FAR *RTHCPTR;
#else
typedef RTHCUINTPTR RTHCPTR;
#endif
/** Pointer to HC pointer. */
typedef RTHCPTR RT_FAR *PRTHCPTR;
/** Pointer to const HC pointer. */
typedef const RTHCPTR *PCRTHCPTR;
/** @def NIL_RTHCPTR
* NIL HC pointer.
*/
#define NIL_RTHCPTR ((RTHCPTR)0)
/** Max RTHCPTR value. */
#define RTHCPTR_MAX ((RTHCPTR)RTHCUINTPTR_MAX)
/** HC ring-3 pointer. */
#ifdef IN_RING3
typedef void RT_FAR *RTR3PTR;
#else
typedef RTR3UINTPTR RTR3PTR;
#endif
/** Pointer to HC ring-3 pointer. */
typedef RTR3PTR RT_FAR *PRTR3PTR;
/** Pointer to const HC ring-3 pointer. */
typedef const RTR3PTR *PCRTR3PTR;
/** @def NIL_RTR3PTR
* NIL HC ring-3 pointer.
*/
#ifndef IN_RING3
# define NIL_RTR3PTR ((RTR3PTR)0)
#else
# define NIL_RTR3PTR (NULL)
#endif
/** Max RTR3PTR value. */
#define RTR3PTR_MAX ((RTR3PTR)RTR3UINTPTR_MAX)
/** HC ring-0 pointer. */
#ifdef IN_RING0
typedef void RT_FAR *RTR0PTR;
#else
typedef RTR0UINTPTR RTR0PTR;
#endif
/** Pointer to HC ring-0 pointer. */
typedef RTR0PTR RT_FAR *PRTR0PTR;
/** Pointer to const HC ring-0 pointer. */
typedef const RTR0PTR *PCRTR0PTR;
/** @def NIL_RTR0PTR
* NIL HC ring-0 pointer.
*/
#ifndef IN_RING0
# define NIL_RTR0PTR ((RTR0PTR)0)
#else
# define NIL_RTR0PTR (NULL)
#endif
/** Max RTR3PTR value. */
#define RTR0PTR_MAX ((RTR0PTR)RTR0UINTPTR_MAX)
/** Unsigned integer register in the host context. */
#if HC_ARCH_BITS == 32
typedef uint32_t RTHCUINTREG;
#elif HC_ARCH_BITS == 64
typedef uint64_t RTHCUINTREG;
#elif HC_ARCH_BITS == 16
typedef uint16_t RTHCUINTREG;
#else
# error "Unsupported HC_ARCH_BITS!"
#endif
/** Pointer to an unsigned integer register in the host context. */
typedef RTHCUINTREG RT_FAR *PRTHCUINTREG;
/** Pointer to a const unsigned integer register in the host context. */
typedef const RTHCUINTREG RT_FAR *PCRTHCUINTREG;
/** Unsigned integer register in the host ring-3 context. */
#if R3_ARCH_BITS == 32
typedef uint32_t RTR3UINTREG;
#elif R3_ARCH_BITS == 64
typedef uint64_t RTR3UINTREG;
#elif R3_ARCH_BITS == 16
typedef uint16_t RTR3UINTREG;
#else
# error "Unsupported R3_ARCH_BITS!"
#endif
/** Pointer to an unsigned integer register in the host ring-3 context. */
typedef RTR3UINTREG RT_FAR *PRTR3UINTREG;
/** Pointer to a const unsigned integer register in the host ring-3 context. */
typedef const RTR3UINTREG RT_FAR *PCRTR3UINTREG;
/** Unsigned integer register in the host ring-3 context. */
#if R0_ARCH_BITS == 32
typedef uint32_t RTR0UINTREG;
#elif R0_ARCH_BITS == 64
typedef uint64_t RTR0UINTREG;
#elif R0_ARCH_BITS == 16
typedef uint16_t RTR0UINTREG;
#else
# error "Unsupported R3_ARCH_BITS!"
#endif
/** Pointer to an unsigned integer register in the host ring-3 context. */
typedef RTR0UINTREG RT_FAR *PRTR0UINTREG;
/** Pointer to a const unsigned integer register in the host ring-3 context. */
typedef const RTR0UINTREG RT_FAR *PCRTR0UINTREG;
/** @} */
/** @defgroup grp_rt_types_gc Guest Context Basic Types
* @{
*/
/** Natural signed integer in the GC.
* @deprecated silly type. */
#if GC_ARCH_BITS == 32
typedef int32_t RTGCINT;
#elif GC_ARCH_BITS == 64 /** @todo this isn't right, natural int is 32-bit, see RTHCINT. */
typedef int64_t RTGCINT;
#endif
/** Pointer to natural signed integer in GC.
* @deprecated silly type. */
typedef RTGCINT RT_FAR *PRTGCINT;
/** Pointer to const natural signed integer in GC.
* @deprecated silly type. */
typedef const RTGCINT RT_FAR *PCRTGCINT;
/** Natural unsigned integer in the GC.
* @deprecated silly type. */
#if GC_ARCH_BITS == 32
typedef uint32_t RTGCUINT;
#elif GC_ARCH_BITS == 64 /** @todo this isn't right, natural int is 32-bit, see RTHCUINT. */
typedef uint64_t RTGCUINT;
#endif
/** Pointer to natural unsigned integer in GC.
* @deprecated silly type. */
typedef RTGCUINT RT_FAR *PRTGCUINT;
/** Pointer to const natural unsigned integer in GC.
* @deprecated silly type. */
typedef const RTGCUINT RT_FAR *PCRTGCUINT;
/** Signed integer which can contain a GC pointer. */
#if GC_ARCH_BITS == 32
typedef int32_t RTGCINTPTR;
#elif GC_ARCH_BITS == 64
typedef int64_t RTGCINTPTR;
#endif
/** Pointer to signed integer which can contain a GC pointer. */
typedef RTGCINTPTR RT_FAR *PRTGCINTPTR;
/** Pointer to const signed integer which can contain a GC pointer. */
typedef const RTGCINTPTR RT_FAR *PCRTGCINTPTR;
/** Unsigned integer which can contain a GC pointer. */
#if GC_ARCH_BITS == 32
typedef uint32_t RTGCUINTPTR;
#elif GC_ARCH_BITS == 64
typedef uint64_t RTGCUINTPTR;
#else
# error Unsupported GC_ARCH_BITS value.
#endif
/** Pointer to unsigned integer which can contain a GC pointer. */
typedef RTGCUINTPTR RT_FAR *PRTGCUINTPTR;
/** Pointer to unsigned integer which can contain a GC pointer. */
typedef const RTGCUINTPTR RT_FAR *PCRTGCUINTPTR;
/** Unsigned integer which can contain a 32 bits GC pointer. */
typedef uint32_t RTGCUINTPTR32;
/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
typedef RTGCUINTPTR32 RT_FAR *PRTGCUINTPTR32;
/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
typedef const RTGCUINTPTR32 RT_FAR *PCRTGCUINTPTR32;
/** Unsigned integer which can contain a 64 bits GC pointer. */
typedef uint64_t RTGCUINTPTR64;
/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
typedef RTGCUINTPTR64 RT_FAR *PRTGCUINTPTR64;
/** Pointer to unsigned integer which can contain a 32 bits GC pointer. */
typedef const RTGCUINTPTR64 RT_FAR *PCRTGCUINTPTR64;
/** Guest Physical Memory Address.*/
typedef uint64_t RTGCPHYS;
/** Pointer to Guest Physical Memory Address. */
typedef RTGCPHYS RT_FAR *PRTGCPHYS;
/** Pointer to const Guest Physical Memory Address. */
typedef const RTGCPHYS RT_FAR *PCRTGCPHYS;
/** @def NIL_RTGCPHYS
* NIL GC Physical Address.
* NIL_RTGCPHYS is used to signal an invalid physical address, similar
* to the NULL pointer. Note that this value may actually be valid in
* some contexts.
*/
#define NIL_RTGCPHYS (~(RTGCPHYS)0U)
/** Max guest physical memory address value. */
#define RTGCPHYS_MAX UINT64_MAX
/** Guest Physical Memory Address; limited to 32 bits.*/
typedef uint32_t RTGCPHYS32;
/** Pointer to Guest Physical Memory Address. */
typedef RTGCPHYS32 RT_FAR *PRTGCPHYS32;
/** Pointer to const Guest Physical Memory Address. */
typedef const RTGCPHYS32 RT_FAR *PCRTGCPHYS32;
/** @def NIL_RTGCPHYS32
* NIL GC Physical Address.
* NIL_RTGCPHYS32 is used to signal an invalid physical address, similar
* to the NULL pointer. Note that this value may actually be valid in
* some contexts.
*/
#define NIL_RTGCPHYS32 (~(RTGCPHYS32)0)
/** Guest Physical Memory Address; limited to 64 bits.*/
typedef uint64_t RTGCPHYS64;
/** Pointer to Guest Physical Memory Address. */
typedef RTGCPHYS64 RT_FAR *PRTGCPHYS64;
/** Pointer to const Guest Physical Memory Address. */
typedef const RTGCPHYS64 RT_FAR *PCRTGCPHYS64;
/** @def NIL_RTGCPHYS64
* NIL GC Physical Address.
* NIL_RTGCPHYS64 is used to signal an invalid physical address, similar
* to the NULL pointer. Note that this value may actually be valid in
* some contexts.
*/
#define NIL_RTGCPHYS64 (~(RTGCPHYS64)0)
/** Guest context pointer, 32 bits.
* Keep in mind that this type is an unsigned integer in
* HC and void pointer in GC.
*/
typedef RTGCUINTPTR32 RTGCPTR32;
/** Pointer to a guest context pointer. */
typedef RTGCPTR32 RT_FAR *PRTGCPTR32;
/** Pointer to a const guest context pointer. */
typedef const RTGCPTR32 RT_FAR *PCRTGCPTR32;
/** @def NIL_RTGCPTR32
* NIL GC pointer.
*/
#define NIL_RTGCPTR32 ((RTGCPTR32)0)
/** Guest context pointer, 64 bits.
*/
typedef RTGCUINTPTR64 RTGCPTR64;
/** Pointer to a guest context pointer. */
typedef RTGCPTR64 RT_FAR *PRTGCPTR64;
/** Pointer to a const guest context pointer. */
typedef const RTGCPTR64 RT_FAR *PCRTGCPTR64;
/** @def NIL_RTGCPTR64
* NIL GC pointer.
*/
#define NIL_RTGCPTR64 ((RTGCPTR64)0)
/** @typedef RTGCPTR
* Guest context pointer.
* Keep in mind that this type is an unsigned integer in HC and void pointer in GC. */
/** @typedef PRTGCPTR
* Pointer to a guest context pointer. */
/** @typedef PCRTGCPTR
* Pointer to a const guest context pointer. */
/** @def NIL_RTGCPTR
* NIL GC pointer. */
/** @def RTGCPTR_MAX
* Max RTGCPTR value. */
#if GC_ARCH_BITS == 64 || defined(DOXYGEN_RUNNING)
typedef RTGCPTR64 RTGCPTR;
typedef PRTGCPTR64 PRTGCPTR;
typedef PCRTGCPTR64 PCRTGCPTR;
# define NIL_RTGCPTR NIL_RTGCPTR64
# define RTGCPTR_MAX UINT64_MAX
#elif GC_ARCH_BITS == 32
typedef RTGCPTR32 RTGCPTR;
typedef PRTGCPTR32 PRTGCPTR;
typedef PCRTGCPTR32 PCRTGCPTR;
# define NIL_RTGCPTR NIL_RTGCPTR32
# define RTGCPTR_MAX UINT32_MAX
#else
# error "Unsupported GC_ARCH_BITS!"
#endif
/** Unsigned integer register in the guest context. */
typedef uint32_t RTGCUINTREG32;
/** Pointer to an unsigned integer register in the guest context. */
typedef RTGCUINTREG32 RT_FAR *PRTGCUINTREG32;
/** Pointer to a const unsigned integer register in the guest context. */
typedef const RTGCUINTREG32 RT_FAR *PCRTGCUINTREG32;
typedef uint64_t RTGCUINTREG64;
/** Pointer to an unsigned integer register in the guest context. */
typedef RTGCUINTREG64 RT_FAR *PRTGCUINTREG64;
/** Pointer to a const unsigned integer register in the guest context. */
typedef const RTGCUINTREG64 RT_FAR *PCRTGCUINTREG64;
#if GC_ARCH_BITS == 64
typedef RTGCUINTREG64 RTGCUINTREG;
#elif GC_ARCH_BITS == 32
typedef RTGCUINTREG32 RTGCUINTREG;
#else
# error "Unsupported GC_ARCH_BITS!"
#endif
/** Pointer to an unsigned integer register in the guest context. */
typedef RTGCUINTREG RT_FAR *PRTGCUINTREG;
/** Pointer to a const unsigned integer register in the guest context. */
typedef const RTGCUINTREG RT_FAR *PCRTGCUINTREG;
/** @} */
/** @defgroup grp_rt_types_rc Raw mode Context Basic Types
* @{
*/
/** Raw mode context pointer; a 32 bits guest context pointer.
* Keep in mind that this type is an unsigned integer in
* HC and void pointer in RC.
*/
#ifdef IN_RC
typedef void RT_FAR *RTRCPTR;
#else
typedef uint32_t RTRCPTR;
#endif
/** Pointer to a raw mode context pointer. */
typedef RTRCPTR RT_FAR *PRTRCPTR;
/** Pointer to a const raw mode context pointer. */
typedef const RTRCPTR RT_FAR *PCRTRCPTR;
/** @def NIL_RTRCPTR
* NIL RC pointer. */
#ifdef IN_RC
# define NIL_RTRCPTR (NULL)
#else
# define NIL_RTRCPTR ((RTRCPTR)0)
#endif
/** @def RTRCPTR_MAX
* The maximum value a RTRCPTR can have. Mostly used as INVALID value.
*/
#define RTRCPTR_MAX ((RTRCPTR)UINT32_MAX)
/** Raw mode context pointer, unsigned integer variant. */
typedef int32_t RTRCINTPTR;
/** @def RTRCUINTPTR_MAX
* The maximum value a RTRCUINPTR can have.
*/
#define RTRCUINTPTR_MAX ((RTRCUINTPTR)UINT32_MAX)
/** Raw mode context pointer, signed integer variant. */
typedef uint32_t RTRCUINTPTR;
/** @def RTRCINTPTR_MIN
* The minimum value a RTRCINPTR can have.
*/
#define RTRCINTPTR_MIN ((RTRCINTPTR)INT32_MIN)
/** @def RTRCINTPTR_MAX
* The maximum value a RTRCINPTR can have.
*/
#define RTRCINTPTR_MAX ((RTRCINTPTR)INT32_MAX)
/* The following are only temporarily while we clean up RTRCPTR usage: */
#ifdef IN_RC
typedef void RT_FAR *RTRGPTR;
#else
typedef uint64_t RTRGPTR;
#endif
typedef RTRGPTR RT_FAR *PRTRGPTR;
typedef const RTRGPTR RT_FAR *PCRTRGPTR;
#ifdef IN_RC
# define NIL_RTRGPTR (NULL)
#else
# define NIL_RTRGPTR ((RTRGPTR)0)
#endif
/** @} */
/** @defgroup grp_rt_types_cc Current Context Basic Types
* @{
*/
/** Current Context Physical Memory Address.*/
#ifdef IN_RC
typedef RTGCPHYS RTCCPHYS;
#else
typedef RTHCPHYS RTCCPHYS;
#endif
/** Pointer to Current Context Physical Memory Address. */
typedef RTCCPHYS RT_FAR *PRTCCPHYS;
/** Pointer to const Current Context Physical Memory Address. */
typedef const RTCCPHYS RT_FAR *PCRTCCPHYS;
/** @def NIL_RTCCPHYS
* NIL CC Physical Address.
* NIL_RTCCPHYS is used to signal an invalid physical address, similar
* to the NULL pointer.
*/
#ifdef IN_RC
# define NIL_RTCCPHYS NIL_RTGCPHYS
#else
# define NIL_RTCCPHYS NIL_RTHCPHYS
#endif
/** Unsigned integer register in the current context. */
#if ARCH_BITS == 32
typedef uint32_t RTCCUINTREG;
#elif ARCH_BITS == 64
typedef uint64_t RTCCUINTREG;
#elif ARCH_BITS == 16
typedef uint16_t RTCCUINTREG;
#else
# error "Unsupported ARCH_BITS!"
#endif
/** Pointer to an unsigned integer register in the current context. */
typedef RTCCUINTREG RT_FAR *PRTCCUINTREG;
/** Pointer to a const unsigned integer register in the current context. */
typedef RTCCUINTREG const RT_FAR *PCRTCCUINTREG;
/** Signed integer register in the current context. */
#if ARCH_BITS == 32
typedef int32_t RTCCINTREG;
#elif ARCH_BITS == 64
typedef int64_t RTCCINTREG;
#elif ARCH_BITS == 16
typedef int16_t RTCCINTREG;
#endif
/** Pointer to a signed integer register in the current context. */
typedef RTCCINTREG RT_FAR *PRTCCINTREG;
/** Pointer to a const signed integer register in the current context. */
typedef RTCCINTREG const RT_FAR *PCRTCCINTREG;
/** Unsigned integer register in the current context.
* @remarks This is for dealing with EAX in 16-bit mode. */
#if ARCH_BITS == 16 && defined(RT_ARCH_X86)
typedef uint32_t RTCCUINTXREG;
#else
typedef RTCCUINTREG RTCCUINTXREG;
#endif
/** Pointer to an unsigned integer register in the current context. */
typedef RTCCUINTREG RT_FAR *PRTCCUINTXREG;
/** Pointer to a const unsigned integer register in the current context. */
typedef RTCCUINTREG const RT_FAR *PCRTCCUINTXREG;
/** Signed integer extended register in the current context.
* @remarks This is for dealing with EAX in 16-bit mode. */
#if ARCH_BITS == 16 && defined(RT_ARCH_X86)
typedef int32_t RTCCINTXREG;
#else
typedef RTCCINTREG RTCCINTXREG;
#endif
/** Pointer to a signed integer extended register in the current context. */
typedef RTCCINTXREG RT_FAR *PRTCCINTXREG;
/** Pointer to a const signed integer extended register in the current
* context. */
typedef RTCCINTXREG const RT_FAR *PCRTCCINTXREG;
/** @def RTCCUINTREG_C
* Defines a constant of RTCCUINTREG type.
* @param a_Value Constant value */
/** @def RTCCUINTREG_MAX
* Max value that RTCCUINTREG can hold. */
/** @def RTCCUINTREG_FMT
* Generic IPRT format specifier for RTCCUINTREG. */
/** @def RTCCUINTREG_XFMT
* Generic IPRT format specifier for RTCCUINTREG, hexadecimal. */
/** @def RTCCINTREG_C
* Defines a constant of RTCCINTREG type.
* @param a_Value Constant value */
/** @def RTCCINTREG_MAX
* Max value that RTCCINTREG can hold. */
/** @def RTCCINTREG_MIN
* Min value that RTCCINTREG can hold. */
/** @def RTCCINTREG_XFMT
* Generic IPRT format specifier for RTCCINTREG, hexadecimal. */
#if ARCH_BITS == 32
# define RTCCUINTREG_C(a_Value) UINT32_C(a_Value)
# define RTCCUINTREG_MAX UINT32_MAX
# define RTCCUINTREG_FMT "RU32"
# define RTCCUINTREG_XFMT "RX32"
# define RTCCINTREG_C(a_Value) INT32_C(a_Value)
# define RTCCINTREG_MAX INT32_MAX
# define RTCCINTREG_MIN INT32_MIN
# define RTCCINTREG_FMT "RI32"
# define RTCCINTREG_XFMT "RX32"
#elif ARCH_BITS == 64
# define RTCCUINTREG_C(a_Value) UINT64_C(a_Value)
# define RTCCUINTREG_MAX UINT64_MAX
# define RTCCUINTREG_FMT "RU64"
# define RTCCUINTREG_XFMT "RX64"
# define RTCCINTREG_C(a_Value) INT64_C(a_Value)
# define RTCCINTREG_MAX INT64_MAX
# define RTCCINTREG_MIN INT64_MIN
# define RTCCINTREG_FMT "RI64"
# define RTCCINTREG_XFMT "RX64"
#elif ARCH_BITS == 16
# define RTCCUINTREG_C(a_Value) UINT16_C(a_Value)
# define RTCCUINTREG_MAX UINT16_MAX
# define RTCCUINTREG_FMT "RU16"
# define RTCCUINTREG_XFMT "RX16"
# define RTCCINTREG_C(a_Value) INT16_C(a_Value)
# define RTCCINTREG_MAX INT16_MAX
# define RTCCINTREG_MIN INT16_MIN
# define RTCCINTREG_FMT "RI16"
# define RTCCINTREG_XFMT "RX16"
#else
# error "Unsupported ARCH_BITS!"
#endif
/** @def RTCCUINTXREG_C
* Defines a constant of RTCCUINTXREG type.
* @param a_Value Constant value */
/** @def RTCCUINTXREG_MAX
* Max value that RTCCUINTXREG can hold. */
/** @def RTCCUINTXREG_FMT
* Generic IPRT format specifier for RTCCUINTXREG. */
/** @def RTCCUINTXREG_XFMT
* Generic IPRT format specifier for RTCCUINTXREG, hexadecimal. */
/** @def RTCCINTXREG_C
* Defines a constant of RTCCINTXREG type.
* @param a_Value Constant value */
/** @def RTCCINTXREG_MAX
* Max value that RTCCINTXREG can hold. */
/** @def RTCCINTXREG_MIN
* Min value that RTCCINTXREG can hold. */
/** @def RTCCINTXREG_FMT
* Generic IPRT format specifier for RTCCINTXREG. */
/** @def RTCCINTXREG_XFMT
* Generic IPRT format specifier for RTCCINTXREG, hexadecimal. */
/** @def RTCCINTXREG_BITS
* The width of RTCCINTXREG in bits (32 or 64). */
#if ARCH_BITS == 16 && defined(RT_ARCH_X86)
# define RTCCUINTXREG_C(a_Value) UINT32_C(a_Value)
# define RTCCUINTXREG_MAX UINT32_MAX
# define RTCCUINTXREG_FMT "RU32"
# define RTCCUINTXREG_XFMT "RX32"
# define RTCCINTXREG_C(a_Value) INT32_C(a_Value)
# define RTCCINTXREG_MAX INT32_MAX
# define RTCCINTXREG_MIN INT32_MIN
# define RTCCINTXREG_FMT "RI32"
# define RTCCINTXREG_XFMT "RX32"
# define RTCCINTXREG_BITS 32
#else
# define RTCCUINTXREG_C(a_Value) RTCCUINTREG_C(a_Value)
# define RTCCUINTXREG_MAX RTCCUINTREG_MAX
# define RTCCUINTXREG_FMT RTCCUINTREG_FMT
# define RTCCUINTXREG_XFMT RTCCUINTREG_XFMT
# define RTCCINTXREG_C(a_Value) RTCCINTREG_C(a_Value)
# define RTCCINTXREG_MAX RTCCINTREG_MAX
# define RTCCINTXREG_MIN RTCCINTREG_MIN
# define RTCCINTXREG_FMT RTCCINTREG_FMT
# define RTCCINTXREG_XFMT RTCCINTREG_XFMT
# define RTCCINTXREG_BITS ARCH_BITS
#endif
/** @} */
/** Pointer to a big integer number. */
typedef struct RTBIGNUM RT_FAR *PRTBIGNUM;
/** Pointer to a const big integer number. */
typedef struct RTBIGNUM const RT_FAR *PCRTBIGNUM;
/** Pointer to a critical section. */
typedef struct RTCRITSECT RT_FAR *PRTCRITSECT;
/** Pointer to a const critical section. */
typedef const struct RTCRITSECT RT_FAR *PCRTCRITSECT;
/** Pointer to a read/write critical section. */
typedef struct RTCRITSECTRW RT_FAR *PRTCRITSECTRW;
/** Pointer to a const read/write critical section. */
typedef const struct RTCRITSECTRW RT_FAR *PCRTCRITSECTRW;
/** Condition variable handle. */
typedef R3PTRTYPE(struct RTCONDVARINTERNAL RT_FAR *) RTCONDVAR;
/** Pointer to a condition variable handle. */
typedef RTCONDVAR RT_FAR *PRTCONDVAR;
/** Nil condition variable handle. */
#define NIL_RTCONDVAR 0
/** Cryptographic (certificate) store handle. */
typedef R3R0PTRTYPE(struct RTCRSTOREINT RT_FAR *) RTCRSTORE;
/** Pointer to a Cryptographic (certificate) store handle. */
typedef RTCRSTORE RT_FAR *PRTCRSTORE;
/** Nil Cryptographic (certificate) store handle. */
#define NIL_RTCRSTORE 0
/** Pointer to a const (store) certificate context. */
typedef struct RTCRCERTCTX const RT_FAR *PCRTCRCERTCTX;
/** Cryptographic message digest handle. */
typedef R3R0PTRTYPE(struct RTCRDIGESTINT RT_FAR *) RTCRDIGEST;
/** Pointer to a cryptographic message digest handle. */
typedef RTCRDIGEST RT_FAR *PRTCRDIGEST;
/** NIL cryptographic message digest handle. */
#define NIL_RTCRDIGEST (0)
/** Cryptographic key handle. */
typedef R3R0PTRTYPE(struct RTCRKEYINT RT_FAR *) RTCRKEY;
/** Pointer to a cryptographic key handle. */
typedef RTCRKEY RT_FAR *PRTCRKEY;
/** Cryptographic key handle nil value. */
#define NIL_RTCRKEY (0)
/** Public key encryption schema handle. */
typedef R3R0PTRTYPE(struct RTCRPKIXENCRYPTIONINT RT_FAR *) RTCRPKIXENCRYPTION;
/** Pointer to a public key encryption schema handle. */
typedef RTCRPKIXENCRYPTION RT_FAR *PRTCRPKIXENCRYPTION;
/** NIL public key encryption schema handle */
#define NIL_RTCRPKIXENCRYPTION (0)
/** Public key signature schema handle. */
typedef R3R0PTRTYPE(struct RTCRPKIXSIGNATUREINT RT_FAR *) RTCRPKIXSIGNATURE;
/** Pointer to a public key signature schema handle. */
typedef RTCRPKIXSIGNATURE RT_FAR *PRTCRPKIXSIGNATURE;
/** NIL public key signature schema handle */
#define NIL_RTCRPKIXSIGNATURE (0)
/** X.509 certificate paths builder & validator handle. */
typedef R3R0PTRTYPE(struct RTCRX509CERTPATHSINT RT_FAR *) RTCRX509CERTPATHS;
/** Pointer to a certificate paths builder & validator handle. */
typedef RTCRX509CERTPATHS RT_FAR *PRTCRX509CERTPATHS;
/** Nil certificate paths builder & validator handle. */
#define NIL_RTCRX509CERTPATHS 0
/** Directory handle. */
typedef struct RTDIRINTERNAL *RTDIR;
/** Pointer to directory handle. */
typedef RTDIR *PRTDIR;
/** NIL directory handle. */
#define NIL_RTDIR ((RTDIR)0)
/** File handle. */
typedef R3R0PTRTYPE(struct RTFILEINT RT_FAR *) RTFILE;
/** Pointer to file handle. */
typedef RTFILE RT_FAR *PRTFILE;
/** Nil file handle. */
#define NIL_RTFILE ((RTFILE)~(RTHCINTPTR)0)
/** Async I/O request handle. */
typedef R3PTRTYPE(struct RTFILEAIOREQINTERNAL RT_FAR *) RTFILEAIOREQ;
/** Pointer to an async I/O request handle. */
typedef RTFILEAIOREQ RT_FAR *PRTFILEAIOREQ;
/** Nil request handle. */
#define NIL_RTFILEAIOREQ 0
/** Async I/O completion context handle. */
typedef R3PTRTYPE(struct RTFILEAIOCTXINTERNAL RT_FAR *) RTFILEAIOCTX;
/** Pointer to an async I/O completion context handle. */
typedef RTFILEAIOCTX RT_FAR *PRTFILEAIOCTX;
/** Nil context handle. */
#define NIL_RTFILEAIOCTX 0
/** ISO image maker handle. */
typedef struct RTFSISOMAKERINT RT_FAR *RTFSISOMAKER;
/** Pointer to an ISO image maker handle. */
typedef RTFSISOMAKER RT_FAR *PRTFSISOMAKER;
/** NIL ISO maker handle. */
#define NIL_RTFSISOMAKER ((RTFSISOMAKER)0)
/** INI-file handle. */
typedef struct RTINIFILEINT RT_FAR *RTINIFILE;
/** Pointer to an INI-file handle. */
typedef RTINIFILE RT_FAR *PRTINIFILE;
/** NIL INI-file handle. */
#define NIL_RTINIFILE ((RTINIFILE)0)
/** Loader module handle. */
typedef R3R0PTRTYPE(struct RTLDRMODINTERNAL RT_FAR *) RTLDRMOD;
/** Pointer to a loader module handle. */
typedef RTLDRMOD RT_FAR *PRTLDRMOD;
/** Nil loader module handle. */
#define NIL_RTLDRMOD 0
/** Lock validator class handle. */
typedef R3R0PTRTYPE(struct RTLOCKVALCLASSINT RT_FAR *) RTLOCKVALCLASS;
/** Pointer to a lock validator class handle. */
typedef RTLOCKVALCLASS RT_FAR *PRTLOCKVALCLASS;
/** Nil lock validator class handle. */
#define NIL_RTLOCKVALCLASS ((RTLOCKVALCLASS)0)
/** Ring-0 memory object handle. */
typedef R0PTRTYPE(struct RTR0MEMOBJINTERNAL RT_FAR *) RTR0MEMOBJ;
/** Pointer to a Ring-0 memory object handle. */
typedef RTR0MEMOBJ RT_FAR *PRTR0MEMOBJ;
/** Nil ring-0 memory object handle. */
#define NIL_RTR0MEMOBJ 0
/** Native thread handle. */
typedef RTHCUINTPTR RTNATIVETHREAD;
/** Pointer to an native thread handle. */
typedef RTNATIVETHREAD RT_FAR *PRTNATIVETHREAD;
/** Nil native thread handle. */
#define NIL_RTNATIVETHREAD (~(RTNATIVETHREAD)0)
/** Pipe handle. */
typedef R3R0PTRTYPE(struct RTPIPEINTERNAL RT_FAR *) RTPIPE;
/** Pointer to a pipe handle. */
typedef RTPIPE RT_FAR *PRTPIPE;
/** Nil pipe handle.
* @remarks This is not 0 because of UNIX and OS/2 handle values. Take care! */
#define NIL_RTPIPE ((RTPIPE)RTHCUINTPTR_MAX)
/** @typedef RTPOLLSET
* Poll set handle. */
typedef R3R0PTRTYPE(struct RTPOLLSETINTERNAL RT_FAR *) RTPOLLSET;
/** Pointer to a poll set handle. */
typedef RTPOLLSET RT_FAR *PRTPOLLSET;
/** Nil poll set handle handle. */
#define NIL_RTPOLLSET ((RTPOLLSET)0)
/** Process identifier. */
typedef uint32_t RTPROCESS;
/** Pointer to a process identifier. */
typedef RTPROCESS RT_FAR *PRTPROCESS;
/** Nil process identifier. */
#define NIL_RTPROCESS (~(RTPROCESS)0)
/** Process ring-0 handle. */
typedef RTR0UINTPTR RTR0PROCESS;
/** Pointer to a ring-0 process handle. */
typedef RTR0PROCESS RT_FAR *PRTR0PROCESS;
/** Nil ring-0 process handle. */
#define NIL_RTR0PROCESS (~(RTR0PROCESS)0)
/** @typedef RTSEMEVENT
* Event Semaphore handle. */
typedef R3R0PTRTYPE(struct RTSEMEVENTINTERNAL RT_FAR *) RTSEMEVENT;
/** Pointer to an event semaphore handle. */
typedef RTSEMEVENT RT_FAR *PRTSEMEVENT;
/** Nil event semaphore handle. */
#define NIL_RTSEMEVENT 0
/** @typedef RTSEMEVENTMULTI
* Event Multiple Release Semaphore handle. */
typedef R3R0PTRTYPE(struct RTSEMEVENTMULTIINTERNAL RT_FAR *) RTSEMEVENTMULTI;
/** Pointer to an event multiple release semaphore handle. */
typedef RTSEMEVENTMULTI RT_FAR *PRTSEMEVENTMULTI;
/** Nil multiple release event semaphore handle. */
#define NIL_RTSEMEVENTMULTI 0
/** @typedef RTSEMFASTMUTEX
* Fast mutex Semaphore handle. */
typedef R3R0PTRTYPE(struct RTSEMFASTMUTEXINTERNAL RT_FAR *) RTSEMFASTMUTEX;
/** Pointer to a fast mutex semaphore handle. */
typedef RTSEMFASTMUTEX RT_FAR *PRTSEMFASTMUTEX;
/** Nil fast mutex semaphore handle. */
#define NIL_RTSEMFASTMUTEX 0
/** @typedef RTSEMMUTEX
* Mutex Semaphore handle. */
typedef R3R0PTRTYPE(struct RTSEMMUTEXINTERNAL RT_FAR *) RTSEMMUTEX;
/** Pointer to a mutex semaphore handle. */
typedef RTSEMMUTEX RT_FAR *PRTSEMMUTEX;
/** Nil mutex semaphore handle. */
#define NIL_RTSEMMUTEX 0
/** @typedef RTSEMSPINMUTEX
* Spinning mutex Semaphore handle. */
typedef R3R0PTRTYPE(struct RTSEMSPINMUTEXINTERNAL RT_FAR *) RTSEMSPINMUTEX;
/** Pointer to a spinning mutex semaphore handle. */
typedef RTSEMSPINMUTEX RT_FAR *PRTSEMSPINMUTEX;
/** Nil spinning mutex semaphore handle. */
#define NIL_RTSEMSPINMUTEX 0
/** @typedef RTSEMRW
* Read/Write Semaphore handle. */
typedef R3R0PTRTYPE(struct RTSEMRWINTERNAL RT_FAR *) RTSEMRW;
/** Pointer to a read/write semaphore handle. */
typedef RTSEMRW RT_FAR *PRTSEMRW;
/** Nil read/write semaphore handle. */
#define NIL_RTSEMRW 0
/** @typedef RTSEMXROADS
* Crossroads semaphore handle. */
typedef R3R0PTRTYPE(struct RTSEMXROADSINTERNAL RT_FAR *) RTSEMXROADS;
/** Pointer to a crossroads semaphore handle. */
typedef RTSEMXROADS RT_FAR *PRTSEMXROADS;
/** Nil crossroads semaphore handle. */
#define NIL_RTSEMXROADS ((RTSEMXROADS)0)
/** Spinlock handle. */
typedef R3R0PTRTYPE(struct RTSPINLOCKINTERNAL RT_FAR *) RTSPINLOCK;
/** Pointer to a spinlock handle. */
typedef RTSPINLOCK RT_FAR *PRTSPINLOCK;
/** Nil spinlock handle. */
#define NIL_RTSPINLOCK 0
/** Socket handle. */
typedef R3R0PTRTYPE(struct RTSOCKETINT RT_FAR *) RTSOCKET;
/** Pointer to socket handle. */
typedef RTSOCKET RT_FAR *PRTSOCKET;
/** Nil socket handle. */
#define NIL_RTSOCKET ((RTSOCKET)0)
/** Pointer to a RTTCPSERVER handle. */
typedef struct RTTCPSERVER RT_FAR *PRTTCPSERVER;
/** Pointer to a RTTCPSERVER handle. */
typedef PRTTCPSERVER RT_FAR *PPRTTCPSERVER;
/** Nil RTTCPSERVER handle. */
#define NIL_RTTCPSERVER ((PRTTCPSERVER)0)
/** Pointer to a RTUDPSERVER handle. */
typedef struct RTUDPSERVER RT_FAR *PRTUDPSERVER;
/** Pointer to a RTUDPSERVER handle. */
typedef PRTUDPSERVER RT_FAR *PPRTUDPSERVER;
/** Nil RTUDPSERVER handle. */
#define NIL_RTUDPSERVER ((PRTUDPSERVER)0)
/** Thread handle.*/
typedef R3R0PTRTYPE(struct RTTHREADINT RT_FAR *) RTTHREAD;
/** Pointer to thread handle. */
typedef RTTHREAD RT_FAR *PRTTHREAD;
/** Nil thread handle. */
#define NIL_RTTHREAD 0
/** Thread context switching hook handle. */
typedef R0PTRTYPE(struct RTTHREADCTXHOOKINT RT_FAR *) RTTHREADCTXHOOK;
/** Pointer to Thread context switching hook handle. */
typedef RTTHREADCTXHOOK RT_FAR *PRTTHREADCTXHOOK;
/** Nil Thread context switching hook handle. */
#define NIL_RTTHREADCTXHOOK ((RTTHREADCTXHOOK)0)
/** A TLS index. */
typedef RTHCINTPTR RTTLS;
/** Pointer to a TLS index. */
typedef RTTLS RT_FAR *PRTTLS;
/** Pointer to a const TLS index. */
typedef RTTLS const RT_FAR *PCRTTLS;
/** NIL TLS index value. */
#define NIL_RTTLS ((RTTLS)-1)
/** Trace buffer handle.
* @remarks This is not a R3/R0 type like most other handles!
*/
typedef struct RTTRACEBUFINT RT_FAR *RTTRACEBUF;
/** Pointer to a trace buffer handle. */
typedef RTTRACEBUF RT_FAR *PRTTRACEBUF;
/** Nil trace buffer handle. */
#define NIL_RTTRACEBUF ((RTTRACEBUF)0)
/** The handle of the default trace buffer.
* This can be used with any of the RTTraceBufAdd APIs. */
#define RTTRACEBUF_DEFAULT ((RTTRACEBUF)-2)
/** Handle to a simple heap. */
typedef R3R0PTRTYPE(struct RTHEAPSIMPLEINTERNAL RT_FAR *) RTHEAPSIMPLE;
/** Pointer to a handle to a simple heap. */
typedef RTHEAPSIMPLE RT_FAR *PRTHEAPSIMPLE;
/** NIL simple heap handle. */
#define NIL_RTHEAPSIMPLE ((RTHEAPSIMPLE)0)
/** Handle to an offset based heap. */
typedef R3R0PTRTYPE(struct RTHEAPOFFSETINTERNAL RT_FAR *) RTHEAPOFFSET;
/** Pointer to a handle to an offset based heap. */
typedef RTHEAPOFFSET RT_FAR *PRTHEAPOFFSET;
/** NIL offset based heap handle. */
#define NIL_RTHEAPOFFSET ((RTHEAPOFFSET)0)
/** Handle to an environment block. */
typedef R3PTRTYPE(struct RTENVINTERNAL RT_FAR *) RTENV;
/** Pointer to a handle to an environment block. */
typedef RTENV RT_FAR *PRTENV;
/** NIL simple heap handle. */
#define NIL_RTENV ((RTENV)0)
/** A CPU identifier.
* @remarks This doesn't have to correspond to the APIC ID (intel/amd). Nor
* does it have to correspond to the bits in the affinity mask, at
* least not until we've sorted out Windows NT. */
typedef uint32_t RTCPUID;
/** Pointer to a CPU identifier. */
typedef RTCPUID RT_FAR *PRTCPUID;
/** Pointer to a const CPU identifier. */
typedef RTCPUID const RT_FAR *PCRTCPUID;
/** Nil CPU Id. */
#define NIL_RTCPUID ((RTCPUID)~0)
/** The maximum number of CPUs a set can contain and IPRT is able
* to reference. (Should be max of support arch/platforms.)
* @remarks Must be a power of two and multiple of 64 (see RTCPUSET). */
#if defined(RT_ARCH_X86) || defined(RT_ARCH_AMD64)
# if defined(RT_OS_OS2)
# define RTCPUSET_MAX_CPUS 64
# elif defined(RT_OS_DARWIN) || defined(RT_ARCH_X86)
# define RTCPUSET_MAX_CPUS 256
# else
# define RTCPUSET_MAX_CPUS 1024
# endif
#elif defined(RT_ARCH_SPARC) || defined(RT_ARCH_SPARC64)
# define RTCPUSET_MAX_CPUS 1024
#else
# define RTCPUSET_MAX_CPUS 64
#endif
/** A CPU set.
* @note Treat this as an opaque type and always use RTCpuSet* for
* manipulating it. */
typedef struct RTCPUSET
{
/** The bitmap. */
uint64_t bmSet[RTCPUSET_MAX_CPUS / 64];
} RTCPUSET;
/** Pointer to a CPU set. */
typedef RTCPUSET RT_FAR *PRTCPUSET;
/** Pointer to a const CPU set. */
typedef RTCPUSET const RT_FAR *PCRTCPUSET;
/** A handle table handle. */
typedef R3R0PTRTYPE(struct RTHANDLETABLEINT RT_FAR *) RTHANDLETABLE;
/** A pointer to a handle table handle. */
typedef RTHANDLETABLE RT_FAR *PRTHANDLETABLE;
/** @def NIL_RTHANDLETABLE
* NIL handle table handle. */
#define NIL_RTHANDLETABLE ((RTHANDLETABLE)0)
/** A handle to a low resolution timer. */
typedef R3R0PTRTYPE(struct RTTIMERLRINT RT_FAR *) RTTIMERLR;
/** A pointer to a low resolution timer handle. */
typedef RTTIMERLR RT_FAR *PRTTIMERLR;
/** @def NIL_RTTIMERLR
* NIL low resolution timer handle value. */
#define NIL_RTTIMERLR ((RTTIMERLR)0)
/** Handle to a random number generator. */
typedef R3R0PTRTYPE(struct RTRANDINT RT_FAR *) RTRAND;
/** Pointer to a random number generator handle. */
typedef RTRAND RT_FAR *PRTRAND;
/** NIL random number generator handle value. */
#define NIL_RTRAND ((RTRAND)0)
/** Debug address space handle. */
typedef R3R0PTRTYPE(struct RTDBGASINT RT_FAR *) RTDBGAS;
/** Pointer to a debug address space handle. */
typedef RTDBGAS RT_FAR *PRTDBGAS;
/** NIL debug address space handle. */
#define NIL_RTDBGAS ((RTDBGAS)0)
/** Debug module handle. */
typedef R3R0PTRTYPE(struct RTDBGMODINT RT_FAR *) RTDBGMOD;
/** Pointer to a debug module handle. */
typedef RTDBGMOD RT_FAR *PRTDBGMOD;
/** NIL debug module handle. */
#define NIL_RTDBGMOD ((RTDBGMOD)0)
/** Pointer to an unwind machine state. */
typedef struct RTDBGUNWINDSTATE RT_FAR *PRTDBGUNWINDSTATE;
/** Pointer to a const unwind machine state. */
typedef struct RTDBGUNWINDSTATE const RT_FAR *PCRTDBGUNWINDSTATE;
/** Manifest handle. */
typedef struct RTMANIFESTINT RT_FAR *RTMANIFEST;
/** Pointer to a manifest handle. */
typedef RTMANIFEST RT_FAR *PRTMANIFEST;
/** NIL manifest handle. */
#define NIL_RTMANIFEST ((RTMANIFEST)~(uintptr_t)0)
/** Memory pool handle. */
typedef R3R0PTRTYPE(struct RTMEMPOOLINT RT_FAR *) RTMEMPOOL;
/** Pointer to a memory pool handle. */
typedef RTMEMPOOL RT_FAR *PRTMEMPOOL;
/** NIL memory pool handle. */
#define NIL_RTMEMPOOL ((RTMEMPOOL)0)
/** The default memory pool handle. */
#define RTMEMPOOL_DEFAULT ((RTMEMPOOL)-2)
/** String cache handle. */
typedef R3R0PTRTYPE(struct RTSTRCACHEINT RT_FAR *) RTSTRCACHE;
/** Pointer to a string cache handle. */
typedef RTSTRCACHE RT_FAR *PRTSTRCACHE;
/** NIL string cache handle. */
#define NIL_RTSTRCACHE ((RTSTRCACHE)0)
/** The default string cache handle. */
#define RTSTRCACHE_DEFAULT ((RTSTRCACHE)-2)
/** Virtual Filesystem handle. */
typedef struct RTVFSINTERNAL RT_FAR *RTVFS;
/** Pointer to a VFS handle. */
typedef RTVFS RT_FAR *PRTVFS;
/** A NIL VFS handle. */
#define NIL_RTVFS ((RTVFS)~(uintptr_t)0)
/** Virtual Filesystem base object handle. */
typedef struct RTVFSOBJINTERNAL RT_FAR *RTVFSOBJ;
/** Pointer to a VFS base object handle. */
typedef RTVFSOBJ RT_FAR *PRTVFSOBJ;
/** A NIL VFS base object handle. */
#define NIL_RTVFSOBJ ((RTVFSOBJ)~(uintptr_t)0)
/** Virtual Filesystem directory handle. */
typedef struct RTVFSDIRINTERNAL RT_FAR *RTVFSDIR;
/** Pointer to a VFS directory handle. */
typedef RTVFSDIR RT_FAR *PRTVFSDIR;
/** A NIL VFS directory handle. */
#define NIL_RTVFSDIR ((RTVFSDIR)~(uintptr_t)0)
/** Virtual Filesystem filesystem stream handle. */
typedef struct RTVFSFSSTREAMINTERNAL RT_FAR *RTVFSFSSTREAM;
/** Pointer to a VFS filesystem stream handle. */
typedef RTVFSFSSTREAM RT_FAR *PRTVFSFSSTREAM;
/** A NIL VFS filesystem stream handle. */
#define NIL_RTVFSFSSTREAM ((RTVFSFSSTREAM)~(uintptr_t)0)
/** Virtual Filesystem I/O stream handle. */
typedef struct RTVFSIOSTREAMINTERNAL RT_FAR *RTVFSIOSTREAM;
/** Pointer to a VFS I/O stream handle. */
typedef RTVFSIOSTREAM RT_FAR *PRTVFSIOSTREAM;
/** A NIL VFS I/O stream handle. */
#define NIL_RTVFSIOSTREAM ((RTVFSIOSTREAM)~(uintptr_t)0)
/** Virtual Filesystem file handle. */
typedef struct RTVFSFILEINTERNAL RT_FAR *RTVFSFILE;
/** Pointer to a VFS file handle. */
typedef RTVFSFILE RT_FAR *PRTVFSFILE;
/** A NIL VFS file handle. */
#define NIL_RTVFSFILE ((RTVFSFILE)~(uintptr_t)0)
/** Virtual Filesystem symbolic link handle. */
typedef struct RTVFSSYMLINKINTERNAL RT_FAR *RTVFSSYMLINK;
/** Pointer to a VFS symbolic link handle. */
typedef RTVFSSYMLINK RT_FAR *PRTVFSSYMLINK;
/** A NIL VFS symbolic link handle. */
#define NIL_RTVFSSYMLINK ((RTVFSSYMLINK)~(uintptr_t)0)
/** Async I/O manager handle. */
typedef struct RTAIOMGRINT RT_FAR *RTAIOMGR;
/** Pointer to a async I/O manager handle. */
typedef RTAIOMGR RT_FAR *PRTAIOMGR;
/** A NIL async I/O manager handle. */
#define NIL_RTAIOMGR ((RTAIOMGR)~(uintptr_t)0)
/** Async I/O manager file handle. */
typedef struct RTAIOMGRFILEINT RT_FAR *RTAIOMGRFILE;
/** Pointer to a async I/O manager file handle. */
typedef RTAIOMGRFILE RT_FAR *PRTAIOMGRFILE;
/** A NIL async I/O manager file handle. */
#define NIL_RTAIOMGRFILE ((RTAIOMGRFILE)~(uintptr_t)0)
/** Kernel module information record handle. */
typedef struct RTKRNLMODINFOINT RT_FAR *RTKRNLMODINFO;
/** Pointer to a kernel information record handle. */
typedef RTKRNLMODINFO RT_FAR *PRTKRNLMODINFO;
/** A NIL kernel module information record handle. */
#define NIL_RTKRNLMODINFO ((RTKRNLMODINFO)~(uintptr_t)0);
/** Shared memory object handle. */
typedef struct RTSHMEMINT RT_FAR *RTSHMEM;
/** Pointer to a shared memory object handle. */
typedef RTSHMEM RT_FAR *PRTSHMEM;
/** A NIL shared memory object handle. */
#define NIL_RTSHMEM ((RTSHMEM)~(uintptr_t)0)
/** EFI signature database handle. */
typedef struct RTEFISIGDBINT RT_FAR *RTEFISIGDB;
/** Pointer to a EFI signature database handle. */
typedef RTEFISIGDB RT_FAR *PRTEFISIGDB;
/** A NIL EFI signature database handle. */
#define NIL_RTEFISIGDB ((RTEFISIGDB)~(uintptr_t)0)
/** Flattened Devicetree handle. */
typedef struct RTFDTINT RT_FAR *RTFDT;
/** Pointer to a Flattened Devicetree handle. */
typedef RTFDT RT_FAR *PRTFDT;
/** A NIL Flattened Devicetree handle. */
#define NIL_RTFDT ((RTFDT)~(uintptr_t)0)
/** ACPI table handle. */
typedef struct RTACPITBLINT RT_FAR *RTACPITBL;
/** Pointer to an ACPI table handle. */
typedef RTACPITBL RT_FAR *PRTACPITBL;
/** A NIL ACPI table handle. */
#define NIL_RTACPITBL ((RTACPITBL)~(uintptr_t)0)
/** ACPI resource handle. */
typedef struct RTACPIRESINT RT_FAR *RTACPIRES;
/** Pointer to an ACPI resource handle. */
typedef RTACPIRES RT_FAR *PRTACPIRES;
/** A NIL ACPI resource handle. */
#define NIL_RTACPIRES ((RTACPIRES)~(uintptr_t)0)
/**
* Handle type.
*
* This is usually used together with RTHANDLEUNION.
*/
typedef enum RTHANDLETYPE
{
/** The invalid zero value. */
RTHANDLETYPE_INVALID = 0,
/** File handle. */
RTHANDLETYPE_FILE,
/** Pipe handle */
RTHANDLETYPE_PIPE,
/** Socket handle. */
RTHANDLETYPE_SOCKET,
/** Thread handle. */
RTHANDLETYPE_THREAD,
/** The end of the valid values. */
RTHANDLETYPE_END,
/** The 32-bit type blow up. */
RTHANDLETYPE_32BIT_HACK = 0x7fffffff
} RTHANDLETYPE;
/** Pointer to a handle type. */
typedef RTHANDLETYPE RT_FAR *PRTHANDLETYPE;
/**
* Handle union.
*
* This is usually used together with RTHANDLETYPE or as RTHANDLE.
*/
typedef union RTHANDLEUNION
{
RTFILE hFile; /**< File handle. */
RTPIPE hPipe; /**< Pipe handle. */
RTSOCKET hSocket; /**< Socket handle. */
RTTHREAD hThread; /**< Thread handle. */
/** Generic integer handle value.
* Note that RTFILE is not yet pointer sized, so accessing it via this member
* isn't necessarily safe or fully portable. */
RTHCUINTPTR uInt;
} RTHANDLEUNION;
/** Pointer to a handle union. */
typedef RTHANDLEUNION RT_FAR *PRTHANDLEUNION;
/** Pointer to a const handle union. */
typedef RTHANDLEUNION const RT_FAR *PCRTHANDLEUNION;
/**
* Generic handle.
*/
typedef struct RTHANDLE
{
/** The handle type. */
RTHANDLETYPE enmType;
/** The handle value. */
RTHANDLEUNION u;
} RTHANDLE;
/** Pointer to a generic handle. */
typedef RTHANDLE RT_FAR *PRTHANDLE;
/** Pointer to a const generic handle. */
typedef RTHANDLE const RT_FAR *PCRTHANDLE;
/**
* Standard handles.
*
* @remarks These have the correct file descriptor values for unixy systems and
* can be used directly in code specific to those platforms.
*/
typedef enum RTHANDLESTD
{
/** Invalid standard handle. */
RTHANDLESTD_INVALID = -1,
/** The standard input handle. */
RTHANDLESTD_INPUT = 0,
/** The standard output handle. */
RTHANDLESTD_OUTPUT,
/** The standard error handle. */
RTHANDLESTD_ERROR,
/** The typical 32-bit type hack. */
RTHANDLESTD_32BIT_HACK = 0x7fffffff
} RTHANDLESTD;
/**
* Error info.
*
* See RTErrInfo*.
*/
typedef struct RTERRINFO
{
/** Flags, see RTERRINFO_FLAGS_XXX. */
uint32_t fFlags;
/** The status code. */
int32_t rc;
/** The size of the message buffer pointed to by pszMsg. */
size_t cbMsg;
/** The error buffer. */
char *pszMsg;
/** Reserved for future use. */
void *apvReserved[2];
} RTERRINFO;
/** Pointer to an error info structure. */
typedef RTERRINFO RT_FAR *PRTERRINFO;
/** Pointer to a const error info structure. */
typedef RTERRINFO const RT_FAR *PCRTERRINFO;
/**
* Static error info structure, see RTErrInfoInitStatic.
*/
typedef struct RTERRINFOSTATIC
{
/** The core error info. */
RTERRINFO Core;
/** The static message buffer. */
char szMsg[3072];
} RTERRINFOSTATIC;
/** Pointer to a error info buffer. */
typedef RTERRINFOSTATIC RT_FAR *PRTERRINFOSTATIC;
/** Pointer to a const static error info buffer. */
typedef RTERRINFOSTATIC const RT_FAR *PCRTERRINFOSTATIC;
/**
* UUID data type.
*
* See RTUuid*.
*
* @remarks IPRT defines that the first three integers in the @c Gen struct
* interpretation are in little endian representation. This is
* different to many other UUID implementation, and requires
* conversion if you need to achieve consistent results.
*/
typedef union RTUUID
{
/** 8-bit view. */
uint8_t au8[16];
/** 16-bit view. */
uint16_t au16[8];
/** 32-bit view. */
uint32_t au32[4];
/** 64-bit view. */
uint64_t au64[2];
/** The way the UUID is declared by the DCE specification. */
struct
{
uint32_t u32TimeLow;
uint16_t u16TimeMid;
uint16_t u16TimeHiAndVersion;
uint8_t u8ClockSeqHiAndReserved;
uint8_t u8ClockSeqLow;
uint8_t au8Node[6];
} Gen;
} RTUUID;
/** Pointer to UUID data. */
typedef RTUUID RT_FAR *PRTUUID;
/** Pointer to readonly UUID data. */
typedef const RTUUID RT_FAR *PCRTUUID;
/** Initializes a RTUUID structure with all zeros (RTUuidIsNull() true). */
#define RTUUID_INITIALIZE_NULL { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }
/** UUID string maximum length. */
#define RTUUID_STR_LENGTH 37
/** Compression handle. */
typedef struct RTZIPCOMP RT_FAR *PRTZIPCOMP;
/** Decompressor handle. */
typedef struct RTZIPDECOMP RT_FAR *PRTZIPDECOMP;
/**
* Unicode Code Point.
*/
typedef uint32_t RTUNICP;
/** Pointer to an Unicode Code Point. */
typedef RTUNICP RT_FAR *PRTUNICP;
/** Pointer to an Unicode Code Point. */
typedef const RTUNICP RT_FAR *PCRTUNICP;
/** Max value a RTUNICP type can hold. */
#define RTUNICP_MAX ( ~(RTUNICP)0 )
/** Invalid code point.
* This is returned when encountered invalid encodings or invalid
* unicode code points. */
#define RTUNICP_INVALID ( UINT32_C(0xfffffffe) )
/**
* UTF-16 character.
*
* @remark wchar_t is not usable since it's compiler defined and can be 8 thru
* 64 bit wide. On Windows it is 16-bit, though, and for various
* reasons of convenience we need to use the native compiler type when
* compling without the /Zc:wchar_t- option (only relevant for C++ and
* _NATIVE_WCHAR_T_DEFINED indicates the absense of /Zc:wchar_t-).
*
* @remark When we use the term character we're not talking about unicode code point, but
* the basic unit of the string encoding. Thus cwc - count of wide chars - means
* count of RTUTF16; cuc - count of unicode chars - means count of RTUNICP;
* and cch means count of the typedef 'char', which is assumed to be an octet.
*/
#if defined(_MSC_VER) && defined(__cplusplus) && defined(_NATIVE_WCHAR_T_DEFINED)
typedef __wchar_t RTUTF16;
#else
typedef uint16_t RTUTF16;
#endif
/** Pointer to a UTF-16 character. */
typedef RTUTF16 RT_FAR *PRTUTF16;
/** Pointer to a const UTF-16 character. */
typedef const RTUTF16 RT_FAR *PCRTUTF16;
/**
* String tuple to go with the RT_STR_TUPLE macro.
*/
typedef struct RTSTRTUPLE
{
/** The string. */
const char *psz;
/** The string length. */
size_t cch;
} RTSTRTUPLE;
/** Pointer to a string tuple. */
typedef RTSTRTUPLE RT_FAR *PRTSTRTUPLE;
/** Pointer to a const string tuple. */
typedef RTSTRTUPLE const RT_FAR *PCRTSTRTUPLE;
/**
* Wait for ever if we have to.
*/
#define RT_INDEFINITE_WAIT (~0U)
/**
* Generic process callback.
*
* @returns VBox status code. Failure will cancel the operation.
* @param uPercentage The percentage of the operation which has been completed.
* @param pvUser The user specified argument.
*/
typedef DECLCALLBACKTYPE(int, FNRTPROGRESS,(unsigned uPercentage, void *pvUser));
/** Pointer to a generic progress callback function, FNRTPROCESS(). */
typedef FNRTPROGRESS *PFNRTPROGRESS;
/**
* Generic vprintf-like callback function for dumpers.
*
* @param pvUser User argument.
* @param pszFormat The format string.
* @param va Arguments for the format string.
*/
typedef DECLCALLBACKTYPE(void, FNRTDUMPPRINTFV,(void *pvUser, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(2, 0));
/** Pointer to a generic printf-like function for dumping. */
typedef FNRTDUMPPRINTFV *PFNRTDUMPPRINTFV;
/**
* A point in a two dimentional coordinate system.
*/
typedef struct RTPOINT
{
/** X coordinate. */
int32_t x;
/** Y coordinate. */
int32_t y;
} RTPOINT;
/** Pointer to a point. */
typedef RTPOINT RT_FAR *PRTPOINT;
/** Pointer to a const point. */
typedef const RTPOINT RT_FAR *PCRTPOINT;
/**
* Rectangle data type, double point.
*/
typedef struct RTRECT
{
/** left X coordinate. */
int32_t xLeft;
/** top Y coordinate. */
int32_t yTop;
/** right X coordinate. (exclusive) */
int32_t xRight;
/** bottom Y coordinate. (exclusive) */
int32_t yBottom;
} RTRECT;
/** Pointer to a double point rectangle. */
typedef RTRECT RT_FAR *PRTRECT;
/** Pointer to a const double point rectangle. */
typedef const RTRECT RT_FAR *PCRTRECT;
/**
* Rectangle data type, point + size.
*/
typedef struct RTRECT2
{
/** X coordinate.
* Unless stated otherwise, this is the top left corner. */
int32_t x;
/** Y coordinate.
* Unless stated otherwise, this is the top left corner. */
int32_t y;
/** The width.
* Unless stated otherwise, this is to the right of (x,y) and will not
* be a negative number. */
int32_t cx;
/** The height.
* Unless stated otherwise, this is down from (x,y) and will not be a
* negative number. */
int32_t cy;
} RTRECT2;
/** Pointer to a point + size rectangle. */
typedef RTRECT2 RT_FAR *PRTRECT2;
/** Pointer to a const point + size rectangle. */
typedef const RTRECT2 RT_FAR *PCRTRECT2;
/**
* The size of a rectangle.
*/
typedef struct RTRECTSIZE
{
/** The width (along the x-axis). */
uint32_t cx;
/** The height (along the y-axis). */
uint32_t cy;
} RTRECTSIZE;
/** Pointer to a rectangle size. */
typedef RTRECTSIZE RT_FAR *PRTRECTSIZE;
/** Pointer to a const rectangle size. */
typedef const RTRECTSIZE RT_FAR *PCRTRECTSIZE;
/**
* Ethernet MAC address.
*
* The first 24 bits make up the Organisationally Unique Identifier (OUI),
* where the first bit (little endian) indicates multicast (set) / unicast,
* and the second bit indicates locally (set) / global administered. If all
* bits are set, it's a broadcast.
*/
typedef union RTMAC
{
/** @todo add a bitfield view of this stuff. */
/** 8-bit view. */
uint8_t au8[6];
/** 16-bit view. */
uint16_t au16[3];
} RTMAC;
/** Pointer to a MAC address. */
typedef RTMAC RT_FAR *PRTMAC;
/** Pointer to a readonly MAC address. */
typedef const RTMAC RT_FAR *PCRTMAC;
/** Pointer to a lock validator record.
* The structure definition is found in iprt/lockvalidator.h. */
typedef struct RTLOCKVALRECEXCL RT_FAR *PRTLOCKVALRECEXCL;
/** Pointer to a record of one ownership share.
* The structure definition is found in iprt/lockvalidator.h. */
typedef struct RTLOCKVALRECSHRD RT_FAR *PRTLOCKVALRECSHRD;
/** Pointer to a lock validator source position.
* The structure definition is found in iprt/lockvalidator.h. */
typedef struct RTLOCKVALSRCPOS RT_FAR *PRTLOCKVALSRCPOS;
/** Pointer to a const lock validator source position.
* The structure definition is found in iprt/lockvalidator.h. */
typedef struct RTLOCKVALSRCPOS const RT_FAR *PCRTLOCKVALSRCPOS;
/** @name Special sub-class values.
* The range 16..UINT32_MAX is available to the user, the range 0..15 is
* reserved for the lock validator. In the user range the locks can only be
* taking in ascending order.
* @{ */
/** Invalid value. */
#define RTLOCKVAL_SUB_CLASS_INVALID UINT32_C(0)
/** Not allowed to be taken with any other locks in the same class.
* This is the recommended value. */
#define RTLOCKVAL_SUB_CLASS_NONE UINT32_C(1)
/** Any order is allowed within the class. */
#define RTLOCKVAL_SUB_CLASS_ANY UINT32_C(2)
/** The first user value. */
#define RTLOCKVAL_SUB_CLASS_USER UINT32_C(16)
/** @} */
/**
* Digest types.
*/
typedef enum RTDIGESTTYPE
{
/** Invalid digest value. */
RTDIGESTTYPE_INVALID = 0,
/** Unknown digest type. */
RTDIGESTTYPE_UNKNOWN,
/** CRC32 checksum. */
RTDIGESTTYPE_CRC32,
/** CRC64 checksum. */
RTDIGESTTYPE_CRC64,
/** MD2 checksum (unsafe!). */
RTDIGESTTYPE_MD2,
/** MD4 checksum (unsafe!!). */
RTDIGESTTYPE_MD4,
/** MD5 checksum (unsafe!). */
RTDIGESTTYPE_MD5,
/** SHA-1 checksum (unsafe!). */
RTDIGESTTYPE_SHA1,
/** SHA-224 checksum. */
RTDIGESTTYPE_SHA224,
/** SHA-256 checksum. */
RTDIGESTTYPE_SHA256,
/** SHA-384 checksum. */
RTDIGESTTYPE_SHA384,
/** SHA-512 checksum. */
RTDIGESTTYPE_SHA512,
/** SHA-512/224 checksum. */
RTDIGESTTYPE_SHA512T224,
/** SHA-512/256 checksum. */
RTDIGESTTYPE_SHA512T256,
/** SHA3-224 checksum. */
RTDIGESTTYPE_SHA3_224,
/** SHA3-256 checksum. */
RTDIGESTTYPE_SHA3_256,
/** SHA3-384 checksum. */
RTDIGESTTYPE_SHA3_384,
/** SHA3-512 checksum. */
RTDIGESTTYPE_SHA3_512,
#if 0
/** SHAKE128 checksum. */
RTDIGESTTYPE_SHAKE128,
/** SHAKE256 checksum. */
RTDIGESTTYPE_SHAKE256,
#endif
/** End of valid types. */
RTDIGESTTYPE_END,
/** Usual 32-bit type blowup. */
RTDIGESTTYPE_32BIT_HACK = 0x7fffffff
} RTDIGESTTYPE;
/**
* Process exit codes.
*/
typedef enum RTEXITCODE
{
/** Success. */
RTEXITCODE_SUCCESS = 0,
/** General failure. */
RTEXITCODE_FAILURE = 1,
/** Invalid arguments. */
RTEXITCODE_SYNTAX = 2,
/** Initialization failure (usually IPRT, but could be used for other
* components as well). */
RTEXITCODE_INIT = 3,
/** Test skipped. */
RTEXITCODE_SKIPPED = 4,
/** The end of valid exit codes. */
RTEXITCODE_END,
/** The usual 32-bit type hack. */
RTEXITCODE_32BIT_HACK = 0x7fffffff
} RTEXITCODE;
/**
* Range descriptor.
*/
typedef struct RTRANGE
{
/** Start offset. */
uint64_t offStart;
/** Range size. */
size_t cbRange;
} RTRANGE;
/** Pointer to a range descriptor. */
typedef RTRANGE RT_FAR *PRTRANGE;
/** Pointer to a readonly range descriptor. */
typedef const RTRANGE RT_FAR *PCRTRANGE;
/**
* Generic pointer union.
*/
typedef union RTPTRUNION
{
/** Pointer into the void. */
void RT_FAR *pv;
/** As a signed integer. */
intptr_t i;
/** As an unsigned integer. */
uintptr_t u;
/** Pointer to char value. */
char RT_FAR *pch;
/** Pointer to char value. */
unsigned char RT_FAR *puch;
/** Pointer to a int value. */
int RT_FAR *pi;
/** Pointer to a unsigned int value. */
unsigned int RT_FAR *pu;
/** Pointer to a long value. */
long RT_FAR *pl;
/** Pointer to a long value. */
unsigned long RT_FAR *pul;
/** Pointer to a byte value. */
uint8_t RT_FAR *pb;
/** Pointer to a 8-bit unsigned value. */
uint8_t RT_FAR *pu8;
/** Pointer to a 16-bit unsigned value. */
uint16_t RT_FAR *pu16;
/** Pointer to a 32-bit unsigned value. */
uint32_t RT_FAR *pu32;
/** Pointer to a 64-bit unsigned value. */
uint64_t RT_FAR *pu64;
/** Pointer to a 8-bit signed value. */
int8_t RT_FAR *pi8;
/** Pointer to a 16-bit signed value. */
int16_t RT_FAR *pi16;
/** Pointer to a 32-bit signed value. */
int32_t RT_FAR *pi32;
/** Pointer to a 64-bit signed value. */
int64_t RT_FAR *pi64;
/** Pointer to a UTF-16 character. */
PRTUTF16 pwc;
/** Pointer to a UUID character. */
PRTUUID pUuid;
} RTPTRUNION;
/** Pointer to a pointer union. */
typedef RTPTRUNION RT_FAR *PRTPTRUNION;
/**
* Generic const pointer union.
*/
typedef union RTCPTRUNION
{
/** Pointer into the void. */
void const RT_FAR *pv;
/** As a signed integer. */
intptr_t i;
/** As an unsigned integer. */
uintptr_t u;
/** Pointer to char value. */
char const RT_FAR *pch;
/** Pointer to char value. */
unsigned char const RT_FAR *puch;
/** Pointer to a int value. */
int const RT_FAR *pi;
/** Pointer to a unsigned int value. */
unsigned int const RT_FAR *pu;
/** Pointer to a long value. */
long const RT_FAR *pl;
/** Pointer to a long value. */
unsigned long const RT_FAR *pul;
/** Pointer to a byte value. */
uint8_t const RT_FAR *pb;
/** Pointer to a 8-bit unsigned value. */
uint8_t const RT_FAR *pu8;
/** Pointer to a 16-bit unsigned value. */
uint16_t const RT_FAR *pu16;
/** Pointer to a 32-bit unsigned value. */
uint32_t const RT_FAR *pu32;
/** Pointer to a 64-bit unsigned value. */
uint64_t const RT_FAR *pu64;
/** Pointer to a 8-bit signed value. */
int8_t const RT_FAR *pi8;
/** Pointer to a 16-bit signed value. */
int16_t const RT_FAR *pi16;
/** Pointer to a 32-bit signed value. */
int32_t const RT_FAR *pi32;
/** Pointer to a 64-bit signed value. */
int64_t const RT_FAR *pi64;
/** Pointer to a UTF-16 character. */
PCRTUTF16 pwc;
/** Pointer to a UUID character. */
PCRTUUID pUuid;
} RTCPTRUNION;
/** Pointer to a const pointer union. */
typedef RTCPTRUNION RT_FAR *PRTCPTRUNION;
/**
* Generic volatile pointer union.
*/
typedef union RTVPTRUNION
{
/** Pointer into the void. */
void volatile RT_FAR *pv;
/** As a signed integer. */
intptr_t i;
/** As an unsigned integer. */
uintptr_t u;
/** Pointer to char value. */
char volatile RT_FAR *pch;
/** Pointer to char value. */
unsigned char volatile RT_FAR *puch;
/** Pointer to a int value. */
int volatile RT_FAR *pi;
/** Pointer to a unsigned int value. */
unsigned int volatile RT_FAR *pu;
/** Pointer to a long value. */
long volatile RT_FAR *pl;
/** Pointer to a long value. */
unsigned long volatile RT_FAR *pul;
/** Pointer to a byte value. */
uint8_t volatile RT_FAR *pb;
/** Pointer to a 8-bit unsigned value. */
uint8_t volatile RT_FAR *pu8;
/** Pointer to a 16-bit unsigned value. */
uint16_t volatile RT_FAR *pu16;
/** Pointer to a 32-bit unsigned value. */
uint32_t volatile RT_FAR *pu32;
/** Pointer to a 64-bit unsigned value. */
uint64_t volatile RT_FAR *pu64;
/** Pointer to a 8-bit signed value. */
int8_t volatile RT_FAR *pi8;
/** Pointer to a 16-bit signed value. */
int16_t volatile RT_FAR *pi16;
/** Pointer to a 32-bit signed value. */
int32_t volatile RT_FAR *pi32;
/** Pointer to a 64-bit signed value. */
int64_t volatile RT_FAR *pi64;
/** Pointer to a UTF-16 character. */
RTUTF16 volatile RT_FAR *pwc;
/** Pointer to a UUID character. */
RTUUID volatile RT_FAR *pUuid;
} RTVPTRUNION;
/** Pointer to a const pointer union. */
typedef RTVPTRUNION RT_FAR *PRTVPTRUNION;
/**
* Generic const volatile pointer union.
*/
typedef union RTCVPTRUNION
{
/** Pointer into the void. */
void const volatile RT_FAR *pv;
/** As a signed integer. */
intptr_t i;
/** As an unsigned integer. */
uintptr_t u;
/** Pointer to char value. */
char const volatile RT_FAR *pch;
/** Pointer to char value. */
unsigned char const volatile RT_FAR *puch;
/** Pointer to a int value. */
int const volatile RT_FAR *pi;
/** Pointer to a unsigned int value. */
unsigned int const volatile RT_FAR *pu;
/** Pointer to a long value. */
long const volatile RT_FAR *pl;
/** Pointer to a long value. */
unsigned long const volatile RT_FAR *pul;
/** Pointer to a byte value. */
uint8_t const volatile RT_FAR *pb;
/** Pointer to a 8-bit unsigned value. */
uint8_t const volatile RT_FAR *pu8;
/** Pointer to a 16-bit unsigned value. */
uint16_t const volatile RT_FAR *pu16;
/** Pointer to a 32-bit unsigned value. */
uint32_t const volatile RT_FAR *pu32;
/** Pointer to a 64-bit unsigned value. */
uint64_t const volatile RT_FAR *pu64;
/** Pointer to a 8-bit signed value. */
int8_t const volatile RT_FAR *pi8;
/** Pointer to a 16-bit signed value. */
int16_t const volatile RT_FAR *pi16;
/** Pointer to a 32-bit signed value. */
int32_t const volatile RT_FAR *pi32;
/** Pointer to a 64-bit signed value. */
int64_t const volatile RT_FAR *pi64;
/** Pointer to a UTF-16 character. */
RTUTF16 const volatile RT_FAR *pwc;
/** Pointer to a UUID character. */
RTUUID const volatile RT_FAR *pUuid;
} RTCVPTRUNION;
/** Pointer to a const pointer union. */
typedef RTCVPTRUNION RT_FAR *PRTCVPTRUNION;
#ifdef __cplusplus
/**
* Strict type validation helper class.
*
* See RTErrStrictType and RT_SUCCESS_NP.
*/
class RTErrStrictType2
{
protected:
/** The status code. */
int32_t m_rc;
public:
/**
* Constructor.
* @param rc IPRT style status code.
*/
RTErrStrictType2(int32_t rc) : m_rc(rc)
{
}
/**
* Get the status code.
* @returns IPRT style status code.
*/
int32_t getValue() const
{
return m_rc;
}
};
#endif /* __cplusplus */
/** @} */
#define IPRT_COMPLETED_types_h /* hack for watcom and nocrt headers depending on this one. */
#endif /* !IPRT_INCLUDED_types_h */
|