stdlib: move all mslibc functions to SDL_mslibc.c This allows disabling LTO on them by only specifying a single file.
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
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ec9ddda..f2eec85 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -678,7 +678,8 @@ endif()
if(MSVC)
# Due to a limitation of Microsoft's LTO implementation, LTO must be disabled for memcpy and memset.
- set_property(SOURCE src/stdlib/SDL_memcpy.c src/stdlib/SDL_memset.c APPEND PROPERTY COMPILE_FLAGS /GL-)
+ # The same applies to various functions normally belonging in the C library (for x86 architecture).
+ set_property(SOURCE src/stdlib/SDL_mslibc.c APPEND PROPERTY COMPILE_FLAGS /GL-)
endif()
if(SDL_ASSEMBLY)
diff --git a/Makefile.os2 b/Makefile.os2
index f68755f..af6f1f0 100644
--- a/Makefile.os2
+++ b/Makefile.os2
@@ -68,7 +68,7 @@ CFLAGS_DLL+= -DSDL_BUILD_MINOR_VERSION=$(MINOR_VERSION)
CFLAGS_DLL+= -DSDL_BUILD_MICRO_VERSION=$(MICRO_VERSION)
SRCS = SDL.c SDL_assert.c SDL_error.c SDL_guid.c SDL_log.c SDL_dataqueue.c SDL_hints.c SDL_list.c SDL_utils.c
-SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_memcpy.c SDL_memset.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.c SDL_crc32.c
+SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.c SDL_crc32.c
SRCS+= SDL_cpuinfo.c SDL_atomic.c SDL_spinlock.c SDL_thread.c SDL_timer.c
SRCS+= SDL_rwops.c SDL_power.c
SRCS+= SDL_audio.c SDL_audiocvt.c SDL_audiodev.c SDL_audiotypecvt.c SDL_mixer.c SDL_wave.c
diff --git a/Makefile.w32 b/Makefile.w32
index feacca8..299567b 100644
--- a/Makefile.w32
+++ b/Makefile.w32
@@ -44,7 +44,7 @@ CFLAGS_DLL+= -DSDL_BUILD_MICRO_VERSION=$(MICRO_VERSION)
RCFLAGS = -q -r -bt=nt $(INCPATH)
SRCS = SDL.c SDL_assert.c SDL_error.c SDL_guid.c SDL_log.c SDL_dataqueue.c SDL_hints.c SDL_list.c SDL_utils.c
-SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_memcpy.c SDL_memset.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.c SDL_crc32.c
+SRCS+= SDL_getenv.c SDL_iconv.c SDL_malloc.c SDL_qsort.c SDL_stdlib.c SDL_string.c SDL_strtokr.c SDL_crc32.c
SRCS+= SDL_cpuinfo.c SDL_atomic.c SDL_spinlock.c SDL_thread.c SDL_timer.c
SRCS+= SDL_rwops.c SDL_power.c
SRCS+= SDL_audio.c SDL_audiocvt.c SDL_audiodev.c SDL_audiotypecvt.c SDL_mixer.c SDL_wave.c
diff --git a/VisualC-GDK/SDL/SDL.vcxproj b/VisualC-GDK/SDL/SDL.vcxproj
index 25478f3..e5565f8 100644
--- a/VisualC-GDK/SDL/SDL.vcxproj
+++ b/VisualC-GDK/SDL/SDL.vcxproj
@@ -697,8 +697,7 @@
<ClCompile Include="..\..\src\stdlib\SDL_getenv.c" />
<ClCompile Include="..\..\src\stdlib\SDL_iconv.c" />
<ClCompile Include="..\..\src\stdlib\SDL_malloc.c" />
- <ClCompile Include="..\..\src\stdlib\SDL_memcpy.c" />
- <ClCompile Include="..\..\src\stdlib\SDL_memset.c" />
+ <ClCompile Include="..\..\src\stdlib\SDL_mslibc.c" />
<ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
<ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
<ClCompile Include="..\..\src\stdlib\SDL_string.c" />
diff --git a/VisualC-GDK/SDL/SDL.vcxproj.filters b/VisualC-GDK/SDL/SDL.vcxproj.filters
index dfbce65..a6e0f4e 100644
--- a/VisualC-GDK/SDL/SDL.vcxproj.filters
+++ b/VisualC-GDK/SDL/SDL.vcxproj.filters
@@ -1352,10 +1352,7 @@
<ClCompile Include="..\..\src\render\direct3d12\SDL_shaders_d3d12.c">
<Filter>render\direct3d12</Filter>
</ClCompile>
- <ClCompile Include="..\..\src\stdlib\SDL_memcpy.c">
- <Filter>stdlib</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\stdlib\SDL_memset.c">
+ <ClCompile Include="..\..\src\stdlib\SDL_mslibc.c">
<Filter>stdlib</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\gdk\SDL_gdk.cpp">
diff --git a/VisualC-WinRT/SDL-UWP.vcxproj b/VisualC-WinRT/SDL-UWP.vcxproj
index 9ae6930..31b182b 100644
--- a/VisualC-WinRT/SDL-UWP.vcxproj
+++ b/VisualC-WinRT/SDL-UWP.vcxproj
@@ -311,8 +311,7 @@
<ClCompile Include="..\src\stdlib\SDL_getenv.c" />
<ClCompile Include="..\src\stdlib\SDL_iconv.c" />
<ClCompile Include="..\src\stdlib\SDL_malloc.c" />
- <ClCompile Include="..\src\stdlib\SDL_memcpy.c" />
- <ClCompile Include="..\src\stdlib\SDL_memset.c" />
+ <ClCompile Include="..\src\stdlib\SDL_mslibc.c" />
<ClCompile Include="..\src\stdlib\SDL_qsort.c" />
<ClCompile Include="..\src\stdlib\SDL_stdlib.c" />
<ClCompile Include="..\src\stdlib\SDL_string.c" />
diff --git a/VisualC/SDL/SDL.vcxproj b/VisualC/SDL/SDL.vcxproj
index 07e5042..64c07ba 100644
--- a/VisualC/SDL/SDL.vcxproj
+++ b/VisualC/SDL/SDL.vcxproj
@@ -565,8 +565,7 @@
<ClCompile Include="..\..\src\stdlib\SDL_getenv.c" />
<ClCompile Include="..\..\src\stdlib\SDL_iconv.c" />
<ClCompile Include="..\..\src\stdlib\SDL_malloc.c" />
- <ClCompile Include="..\..\src\stdlib\SDL_memcpy.c" />
- <ClCompile Include="..\..\src\stdlib\SDL_memset.c" />
+ <ClCompile Include="..\..\src\stdlib\SDL_mslibc.c" />
<ClCompile Include="..\..\src\stdlib\SDL_qsort.c" />
<ClCompile Include="..\..\src\stdlib\SDL_stdlib.c" />
<ClCompile Include="..\..\src\stdlib\SDL_string.c" />
diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj
index 6b9297c..fa671c1 100644
--- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj
+++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj
@@ -3382,24 +3382,6 @@
DB31407017554B71006C0E22 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; };
DB31407217554B71006C0E22 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007317C10858E15000B2BC32 /* Carbon.framework */; };
DB31408D17554D3C006C0E22 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; };
- F3249B1E285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; };
- F3249B1F285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; };
- F3249B20285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; };
- F3249B21285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; };
- F3249B22285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; };
- F3249B23285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; };
- F3249B24285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; };
- F3249B25285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; };
- F3249B26285A85FF00DB9B5C /* SDL_memset.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1C285A85FF00DB9B5C /* SDL_memset.c */; };
- F3249B27285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; };
- F3249B28285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; };
- F3249B29285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; };
- F3249B2A285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; };
- F3249B2B285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; };
- F3249B2C285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; };
- F3249B2D285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; };
- F3249B2E285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; };
- F3249B2F285A85FF00DB9B5C /* SDL_memcpy.c in Sources */ = {isa = PBXBuildFile; fileRef = F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */; };
F3631C6424884ACF004F28EA /* SDL_locale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26792462701100718109 /* SDL_locale.h */; settings = {ATTRIBUTES = (Public, ); }; };
F3631C652488534E004F28EA /* SDL_locale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26792462701100718109 /* SDL_locale.h */; settings = {ATTRIBUTES = (Public, ); }; };
F376F6192559B29300CFC0BC /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F376F6182559B29300CFC0BC /* OpenGLES.framework */; platformFilter = ios; };
@@ -4072,8 +4054,6 @@
BECDF6B30761BA81005FE872 /* libSDL2.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL2.a; sourceTree = BUILT_PRODUCTS_DIR; };
BECDF6BE0761BA81005FE872 /* SDL2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = SDL2; sourceTree = BUILT_PRODUCTS_DIR; };
DB31407717554B71006C0E22 /* libSDL2.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSDL2.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
- F3249B1C285A85FF00DB9B5C /* SDL_memset.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_memset.c; sourceTree = "<group>"; };
- F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_memcpy.c; sourceTree = "<group>"; };
F376F6182559B29300CFC0BC /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.1.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; };
F376F61A2559B2AF00CFC0BC /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/iOSSupport/System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
F376F6312559B31D00CFC0BC /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/iOSSupport/System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; };
@@ -5139,8 +5119,6 @@
A7D8A8D423E2514000DCD162 /* SDL_getenv.c */,
A7D8A8D323E2514000DCD162 /* SDL_iconv.c */,
A7D8A8D923E2514000DCD162 /* SDL_malloc.c */,
- F3249B1D285A85FF00DB9B5C /* SDL_memcpy.c */,
- F3249B1C285A85FF00DB9B5C /* SDL_memset.c */,
A7D8A8D723E2514000DCD162 /* SDL_qsort.c */,
A7D8A8D823E2514000DCD162 /* SDL_stdlib.c */,
A7D8A8D523E2514000DCD162 /* SDL_string.c */,
@@ -7711,7 +7689,6 @@
A75FCE5023E25AB700529352 /* SDL_syspower.m in Sources */,
A75FCE5123E25AB700529352 /* e_log10.c in Sources */,
A75FCE5223E25AB700529352 /* SDL_uikitopenglview.m in Sources */,
- F3249B2E285A85FF00DB9B5C /* SDL_memcpy.c in Sources */,
A75FCE5323E25AB700529352 /* SDL_mixer.c in Sources */,
5616CA64252BB35F005D5928 /* SDL_url.c in Sources */,
A75FCE5423E25AB700529352 /* SDL_events.c in Sources */,
@@ -7767,7 +7744,6 @@
F3F07D61269640160074468B /* SDL_hidapi_luna.c in Sources */,
A75FCE8923E25AB700529352 /* SDL_rwopsbundlesupport.m in Sources */,
A75FCE8A23E25AB700529352 /* SDL_video.c in Sources */,
- F3249B25285A85FF00DB9B5C /* SDL_memset.c in Sources */,
A75FCE8B23E25AB700529352 /* SDL_offscreenopengl.c in Sources */,
A75FCE8C23E25AB700529352 /* SDL_uikitmetalview.m in Sources */,
A75FCE8D23E25AB700529352 /* SDL_steamcontroller.c in Sources */,
@@ -7905,7 +7881,6 @@
A75FD00923E25AC700529352 /* SDL_syspower.m in Sources */,
A75FD00A23E25AC700529352 /* e_log10.c in Sources */,
A75FD00B23E25AC700529352 /* SDL_uikitopenglview.m in Sources */,
- F3249B2F285A85FF00DB9B5C /* SDL_memcpy.c in Sources */,
A75FD00C23E25AC700529352 /* SDL_mixer.c in Sources */,
5616CA67252BB361005D5928 /* SDL_url.c in Sources */,
A75FD00D23E25AC700529352 /* SDL_events.c in Sources */,
@@ -7961,7 +7936,6 @@
F3F07D62269640160074468B /* SDL_hidapi_luna.c in Sources */,
A75FD04223E25AC700529352 /* SDL_rwopsbundlesupport.m in Sources */,
A75FD04323E25AC700529352 /* SDL_video.c in Sources */,
- F3249B26285A85FF00DB9B5C /* SDL_memset.c in Sources */,
A75FD04423E25AC700529352 /* SDL_offscreenopengl.c in Sources */,
A75FD04523E25AC700529352 /* SDL_uikitmetalview.m in Sources */,
A75FD04623E25AC700529352 /* SDL_steamcontroller.c in Sources */,
@@ -8089,7 +8063,6 @@
A769B1D523E259AE00872273 /* SDL_render.c in Sources */,
A769B1D623E259AE00872273 /* SDL_stretch.c in Sources */,
A769B1D723E259AE00872273 /* s_floor.c in Sources */,
- F3249B23285A85FF00DB9B5C /* SDL_memset.c in Sources */,
A769B1D823E259AE00872273 /* SDL_blit_copy.c in Sources */,
A769B1D923E259AE00872273 /* e_fmod.c in Sources */,
A769B1DA23E259AE00872273 /* SDL_syspower.m in Sources */,
@@ -8152,7 +8125,6 @@
A769B21123E259AE00872273 /* SDL_quit.c in Sources */,
A769B21223E259AE00872273 /* SDL_cocoawindow.m in Sources */,
A769B21323E259AE00872273 /* SDL_sysmutex.c in Sources */,
- F3249B2C285A85FF00DB9B5C /* SDL_memcpy.c in Sources */,
A769B21423E259AE00872273 /* SDL_syshaptic.c in Sources */,
A769B21523E259AE00872273 /* SDL_rwopsbundlesupport.m in Sources */,
A769B21623E259AE00872273 /* SDL_video.c in Sources */,
@@ -8294,7 +8266,6 @@
A7D8AC7023E2514100DCD162 /* SDL_uikitopenglview.m in Sources */,
A7D8B76523E2514300DCD162 /* SDL_mixer.c in Sources */,
A7D8BB5823E2514500DCD162 /* SDL_events.c in Sources */,
- F3249B28285A85FF00DB9B5C /* SDL_memcpy.c in Sources */,
A7D8ADE723E2514100DCD162 /* SDL_blit_0.c in Sources */,
A7D8BB0A23E2514500DCD162 /* k_tan.c in Sources */,
A75FDBCF23EA380300529352 /* SDL_hidapi_rumble.c in Sources */,
@@ -8350,7 +8321,6 @@
F3F07D5B269640160074468B /* SDL_hidapi_luna.c in Sources */,
A7D8AB5623E2514100DCD162 /* SDL_offscreenopengl.c in Sources */,
A7D8ACC423E2514100DCD162 /* SDL_uikitmetalview.m in Sources */,
- F3249B1F285A85FF00DB9B5C /* SDL_memset.c in Sources */,
A7D8BA5C23E2514400DCD162 /* SDL_shaders_gles2.c in Sources */,
A7D8B14123E2514200DCD162 /* SDL_blit_1.c in Sources */,
5605720F2473688000B46B66 /* SDL_locale.c in Sources */,
@@ -8488,7 +8458,6 @@
A7D8AC7123E2514100DCD162 /* SDL_uikitopenglview.m in Sources */,
A7D8B76623E2514300DCD162 /* SDL_mixer.c in Sources */,
A7D8BB5923E2514500DCD162 /* SDL_events.c in Sources */,
- F3249B29285A85FF00DB9B5C /* SDL_memcpy.c in Sources */,
A7D8ADE823E2514100DCD162 /* SDL_blit_0.c in Sources */,
A7D8BB0B23E2514500DCD162 /* k_tan.c in Sources */,
A75FDBD023EA380300529352 /* SDL_hidapi_rumble.c in Sources */,
@@ -8544,7 +8513,6 @@
F3F07D5C269640160074468B /* SDL_hidapi_luna.c in Sources */,
A7D8AB5723E2514100DCD162 /* SDL_offscreenopengl.c in Sources */,
A7D8ACC523E2514100DCD162 /* SDL_uikitmetalview.m in Sources */,
- F3249B20285A85FF00DB9B5C /* SDL_memset.c in Sources */,
A7D8BA5D23E2514400DCD162 /* SDL_shaders_gles2.c in Sources */,
A7D8B14223E2514200DCD162 /* SDL_blit_1.c in Sources */,
560572102473688000B46B66 /* SDL_locale.c in Sources */,
@@ -8672,7 +8640,6 @@
A7D8B97E23E2514400DCD162 /* SDL_render.c in Sources */,
A7D8ABD723E2514100DCD162 /* SDL_stretch.c in Sources */,
A7D8BB0123E2514500DCD162 /* s_floor.c in Sources */,
- F3249B22285A85FF00DB9B5C /* SDL_memset.c in Sources */,
A7D8AC3D23E2514100DCD162 /* SDL_blit_copy.c in Sources */,
A7D8BAE323E2514500DCD162 /* e_fmod.c in Sources */,
A7D8B5D323E2514300DCD162 /* SDL_syspower.m in Sources */,
@@ -8735,7 +8702,6 @@
A7D8BB8523E2514500DCD162 /* SDL_quit.c in Sources */,
A7D8AEAA23E2514100DCD162 /* SDL_cocoawindow.m in Sources */,
A7D8B43E23E2514300DCD162 /* SDL_sysmutex.c in Sources */,
- F3249B2B285A85FF00DB9B5C /* SDL_memcpy.c in Sources */,
A7D8AAB423E2514100DCD162 /* SDL_syshaptic.c in Sources */,
A7D8B5CD23E2514300DCD162 /* SDL_rwopsbundlesupport.m in Sources */,
A7D8AC1323E2514100DCD162 /* SDL_video.c in Sources */,
@@ -8831,7 +8797,6 @@
F3984CD025BCC92900374F43 /* SDL_hidapi_stadia.c in Sources */,
A7D8AAB623E2514100DCD162 /* SDL_haptic.c in Sources */,
A7D8AF2423E2514100DCD162 /* SDL_cocoametalview.m in Sources */,
- F3249B1E285A85FF00DB9B5C /* SDL_memset.c in Sources */,
A7D8B86023E2514400DCD162 /* SDL_audiotypecvt.c in Sources */,
A7D8BBC523E2561500DCD162 /* SDL_steamcontroller.c in Sources */,
A7D8AD3223E2514100DCD162 /* SDL_blit_N.c in Sources */,
@@ -8902,7 +8867,6 @@
A7D8B4DC23E2514300DCD162 /* SDL_joystick.c in Sources */,
A7D8BA4923E2514400DCD162 /* SDL_render_gles2.c in Sources */,
A7D8AC2D23E2514100DCD162 /* SDL_surface.c in Sources */,
- F3249B27285A85FF00DB9B5C /* SDL_memcpy.c in Sources */,
A7D8B54B23E2514300DCD162 /* SDL_hidapi_xboxone.c in Sources */,
A7D8AD2323E2514100DCD162 /* SDL_blit_auto.c in Sources */,
F3A4909E2554D38600E92A8B /* SDL_hidapi_ps5.c in Sources */,
@@ -9023,7 +8987,6 @@
A7D8AF2723E2514100DCD162 /* SDL_cocoametalview.m in Sources */,
A7D8B86323E2514400DCD162 /* SDL_audiotypecvt.c in Sources */,
A7D8AD3523E2514100DCD162 /* SDL_blit_N.c in Sources */,
- F3249B21285A85FF00DB9B5C /* SDL_memset.c in Sources */,
A7D8BB7E23E2514500DCD162 /* SDL_dropevents.c in Sources */,
A7D8BBFA23E2574800DCD162 /* SDL_uikitopengles.m in Sources */,
A7D8BAD023E2514500DCD162 /* e_atan2.c in Sources */,
@@ -9094,7 +9057,6 @@
A7D8BA4C23E2514400DCD162 /* SDL_render_gles2.c in Sources */,
A7D8AC3023E2514100DCD162 /* SDL_surface.c in Sources */,
A7D8B54E23E2514300DCD162 /* SDL_hidapi_xboxone.c in Sources */,
- F3249B2A285A85FF00DB9B5C /* SDL_memcpy.c in Sources */,
A7D8AD2623E2514100DCD162 /* SDL_blit_auto.c in Sources */,
A7D8BB6C23E2514500DCD162 /* SDL_keyboard.c in Sources */,
A7D8ACEA23E2514100DCD162 /* SDL_rect.c in Sources */,
@@ -9215,7 +9177,6 @@
A7D8AF2923E2514100DCD162 /* SDL_cocoametalview.m in Sources */,
A7D8B86523E2514400DCD162 /* SDL_audiotypecvt.c in Sources */,
A7D8AC5C23E2514100DCD162 /* SDL_uikitevents.m in Sources */,
- F3249B24285A85FF00DB9B5C /* SDL_memset.c in Sources */,
A7D8ACBC23E2514100DCD162 /* SDL_uikitmodes.m in Sources */,
A7D8AD3723E2514100DCD162 /* SDL_blit_N.c in Sources */,
A7D8BB8023E2514500DCD162 /* SDL_dropevents.c in Sources */,
@@ -9286,7 +9247,6 @@
A7D8B4E123E2514300DCD162 /* SDL_joystick.c in Sources */,
A7D8BA4E23E2514400DCD162 /* SDL_render_gles2.c in Sources */,
A7D8AC3223E2514100DCD162 /* SDL_surface.c in Sources */,
- F3249B2D285A85FF00DB9B5C /* SDL_memcpy.c in Sources */,
A7D8B55023E2514300DCD162 /* SDL_hidapi_xboxone.c in Sources */,
A7D8AD2823E2514100DCD162 /* SDL_blit_auto.c in Sources */,
A7D8BB6E23E2514500DCD162 /* SDL_keyboard.c in Sources */,
diff --git a/src/stdlib/SDL_memcpy.c b/src/stdlib/SDL_memcpy.c
deleted file mode 100644
index bedbce8..0000000
--- a/src/stdlib/SDL_memcpy.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "../SDL_internal.h"
-
-/* This file contains a portable memcpy manipulation function for SDL */
-
-void *
-SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len)
-{
-#ifdef __GNUC__
- /* Presumably this is well tuned for speed.
- On my machine this is twice as fast as the C code below.
- */
- return __builtin_memcpy(dst, src, len);
-#elif defined(HAVE_MEMCPY)
- return memcpy(dst, src, len);
-#elif defined(HAVE_BCOPY)
- bcopy(src, dst, len);
- return dst;
-#else
- /* GCC 4.9.0 with -O3 will generate movaps instructions with the loop
- using Uint32* pointers, so we need to make sure the pointers are
- aligned before we loop using them.
- */
- if (((uintptr_t)src & 0x3) || ((uintptr_t)dst & 0x3)) {
- /* Do an unaligned byte copy */
- Uint8 *srcp1 = (Uint8 *)src;
- Uint8 *dstp1 = (Uint8 *)dst;
-
- while (len--) {
- *dstp1++ = *srcp1++;
- }
- } else {
- size_t left = (len % 4);
- Uint32 *srcp4, *dstp4;
- Uint8 *srcp1, *dstp1;
-
- srcp4 = (Uint32 *) src;
- dstp4 = (Uint32 *) dst;
- len /= 4;
- while (len--) {
- *dstp4++ = *srcp4++;
- }
-
- srcp1 = (Uint8 *) srcp4;
- dstp1 = (Uint8 *) dstp4;
- switch (left) {
- case 3:
- *dstp1++ = *srcp1++;
- case 2:
- *dstp1++ = *srcp1++;
- case 1:
- *dstp1++ = *srcp1++;
- }
- }
- return dst;
-#endif /* __GNUC__ */
-}
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/stdlib/SDL_memset.c b/src/stdlib/SDL_memset.c
deleted file mode 100644
index c2a4875..0000000
--- a/src/stdlib/SDL_memset.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- Simple DirectMedia Layer
- Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "../SDL_internal.h"
-
-/* This file contains a portable memset manipulation function for SDL */
-
-void *
-SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len)
-{
-#if defined(HAVE_MEMSET)
- return memset(dst, c, len);
-#else
- size_t left;
- Uint32 *dstp4;
- Uint8 *dstp1 = (Uint8 *) dst;
- Uint8 value1;
- Uint32 value4;
-
- /* The value used in memset() is a byte, passed as an int */
- c &= 0xff;
-
- /* The destination pointer needs to be aligned on a 4-byte boundary to
- * execute a 32-bit set. Set first bytes manually if needed until it is
- * aligned. */
- value1 = (Uint8)c;
- while ((uintptr_t)dstp1 & 0x3) {
- if (len--) {
- *dstp1++ = value1;
- } else {
- return dst;
- }
- }
-
- value4 = ((Uint32)c | ((Uint32)c << 8) | ((Uint32)c << 16) | ((Uint32)c << 24));
- dstp4 = (Uint32 *) dstp1;
- left = (len % 4);
- len /= 4;
- while (len--) {
- *dstp4++ = value4;
- }
-
- dstp1 = (Uint8 *) dstp4;
- switch (left) {
- case 3:
- *dstp1++ = value1;
- case 2:
- *dstp1++ = value1;
- case 1:
- *dstp1++ = value1;
- }
-
- return dst;
-#endif /* HAVE_MEMSET */
-}
-
-/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/stdlib/SDL_mslibc.c b/src/stdlib/SDL_mslibc.c
new file mode 100644
index 0000000..fe623cc
--- /dev/null
+++ b/src/stdlib/SDL_mslibc.c
@@ -0,0 +1,717 @@
+/*
+ Simple DirectMedia Layer
+ Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+*/
+
+#if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS)
+#define SDL_DISABLE_ANALYZE_MACROS 1
+#endif
+
+#include "../SDL_internal.h"
+
+/* This file contains SDL replacements for functions in the C library */
+
+#ifndef HAVE_LIBC
+/* These are some C runtime intrinsics that need to be defined */
+
+#if defined(_MSC_VER)
+
+#ifndef __FLTUSED__
+#define __FLTUSED__
+__declspec(selectany) int _fltused = 1;
+#endif
+
+/* The optimizer on Visual Studio 2005 and later generates memcpy() and memset() calls.
+ Always provide it for the SDL2 DLL, but skip it when building static lib w/ static runtime. */
+#if (_MSC_VER >= 1400) && (!defined(_MT) || defined(DLL_EXPORT))
+extern void *memcpy(void* dst, const void* src, size_t len);
+#pragma intrinsic(memcpy)
+
+#pragma function(memcpy)
+void *
+memcpy(void *dst, const void *src, size_t len)
+{
+ return SDL_memcpy(dst, src, len);
+}
+
+extern void *memset(void* dst, int c, size_t len);
+#pragma intrinsic(memset)
+
+#pragma function(memset)
+void *
+memset(void *dst, int c, size_t len)
+{
+ return SDL_memset(dst, c, len);
+}
+#endif /* (_MSC_VER >= 1400) && (!defined(_MT) || defined(DLL_EXPORT)) */
+
+#ifdef _M_IX86
+
+/* Float to long */
+void
+__declspec(naked)
+_ftol()
+{
+ /* *INDENT-OFF* */
+ __asm {
+ push ebp
+ mov ebp,esp
+ sub esp,20h
+ and esp,0FFFFFFF0h
+ fld st(0)
+ fst dword ptr [esp+18h]
+ fistp qword ptr [esp+10h]
+ fild qword ptr [esp+10h]
+ mov edx,dword ptr [esp+18h]
+ mov eax,dword ptr [esp+10h]
+ test eax,eax
+ je integer_QnaN_or_zero
+arg_is_not_integer_QnaN:
+ fsubp st(1),st
+ test edx,edx
+ jns positive
+ fstp dword ptr [esp]
+ mov ecx,dword ptr [esp]
+ xor ecx,80000000h
+ add ecx,7FFFFFFFh
+ adc eax,0
+ mov edx,dword ptr [esp+14h]
+ adc edx,0
+ jmp localexit
+positive:
+ fstp dword ptr [esp]
+ mov ecx,dword ptr [esp]
+ add ecx,7FFFFFFFh
+ sbb eax,0
+ mov edx,dword ptr [esp+14h]
+ sbb edx,0
+ jmp localexit
+integer_QnaN_or_zero:
+ mov edx,dword ptr [esp+14h]
+ test edx,7FFFFFFFh
+ jne arg_is_not_integer_QnaN
+ fstp dword ptr [esp+18h]
+ fstp dword ptr [esp+18h]
+localexit:
+ leave
+ ret
+ }
+ /* *INDENT-ON* */
+}
+
+void
+_ftol2_sse()
+{
+ _ftol();
+}
+
+/* 64-bit math operators for 32-bit systems */
+void
+__declspec(naked)
+_allmul()
+{
+ /* *INDENT-OFF* */
+ __asm {
+ mov eax, dword ptr[esp+8]
+ mov ecx, dword ptr[esp+10h]
+ or ecx, eax
+ mov ecx, dword ptr[esp+0Ch]
+ jne hard
+ mov eax, dword ptr[esp+4]
+ mul ecx
+ ret 10h
+hard:
+ push ebx
+ mul ecx
+ mov ebx, eax
+ mov eax, dword ptr[esp+8]
+ mul dword ptr[esp+14h]
+ add ebx, eax
+ mov eax, dword ptr[esp+8]
+ mul ecx
+ add edx, ebx
+ pop ebx
+ ret 10h
+ }
+ /* *INDENT-ON* */
+}
+
+void
+__declspec(naked)
+_alldiv()
+{
+ /* *INDENT-OFF* */
+ __asm {
+ push edi
+ push esi
+ push ebx
+ xor edi,edi
+ mov eax,dword ptr [esp+14h]
+ or eax,eax
+ jge L1
+ inc edi
+ mov edx,dword ptr [esp+10h]
+ neg eax
+ neg edx
+ sbb eax,0
+ mov dword ptr [esp+14h],eax
+ mov dword ptr [esp+10h],edx
+L1:
+ mov eax,dword ptr [esp+1Ch]
+ or eax,eax
+ jge L2
+ inc edi
+ mov edx,dword ptr [esp+18h]
+ neg eax
+ neg edx
+ sbb eax,0
+ mov dword ptr [esp+1Ch],eax
+ mov dword ptr [esp+18h],edx
+L2:
+ or eax,eax
+ jne L3
+ mov ecx,dword ptr [esp+18h]
+ mov eax,dword ptr [esp+14h]
+ xor edx,edx
+ div ecx
+ mov ebx,eax
+ mov eax,dword ptr [esp+10h]
+ div ecx
+ mov edx,ebx
+ jmp L4
+L3:
+ mov ebx,eax
+ mov ecx,dword ptr [esp+18h]
+ mov edx,dword ptr [esp+14h]
+ mov eax,dword ptr [esp+10h]
+L5:
+ shr ebx,1
+ rcr ecx,1
+ shr edx,1
+ rcr eax,1
+ or ebx,ebx
+ jne L5
+ div ecx
+ mov esi,eax
+ mul dword ptr [esp+1Ch]
+ mov ecx,eax
+ mov eax,dword ptr [esp+18h]
+ mul esi
+ add edx,ecx
+ jb L6
+ cmp edx,dword ptr [esp+14h]
+ ja L6
+ jb L7
+ cmp eax,dword ptr [esp+10h]
+ jbe L7
+L6:
+ dec esi
+L7:
+ xor edx,edx
+ mov eax,esi
+L4:
+ dec edi
+ jne L8
+ neg edx
+ neg eax
+ sbb edx,0
+L8:
+ pop ebx
+ pop esi
+ pop edi
+ ret 10h
+ }
+ /* *INDENT-ON* */
+}
+
+void
+__declspec(naked)
+_aulldiv()
+{
+ /* *INDENT-OFF* */
+ __asm {
+ push ebx
+ push esi
+ mov eax,dword ptr [esp+18h]
+ or eax,eax
+ jne L1
+ mov ecx,dword ptr [esp+14h]
+ mov eax,dword ptr [esp+10h]
+ xor edx,edx
+ div ecx
+ mov ebx,eax
+ mov eax,dword ptr [esp+0Ch]
+ div ecx
+ mov edx,ebx
+ jmp L2
+L1:
+ mov ecx,eax
+ mov ebx,dword ptr [esp+14h]
+ mov edx,dword ptr [esp+10h]
+ mov eax,dword ptr [esp+0Ch]
+L3:
+ shr ecx,1
+ rcr ebx,1
+ shr edx,1
+ rcr eax,1
+ or ecx,ecx
+ jne L3
+ div ebx
+ mov esi,eax
+ mul dword ptr [esp+18h]
+ mov ecx,eax
+ mov eax,dword ptr [esp+14h]
+ mul esi
+ add edx,ecx
+ jb L4
+ cmp edx,dword ptr [esp+10h]
+ ja L4
+ jb L5
+ cmp eax,dword ptr [esp+0Ch]
+ jbe L5
+L4:
+ dec esi
+L5:
+ xor edx,edx
+ mov eax,esi
+L2:
+ pop esi
+ pop ebx
+ ret 10h
+ }
+ /* *INDENT-ON* */
+}
+
+void
+__declspec(naked)
+_allrem()
+{
+ /* *INDENT-OFF* */
+ __asm {
+ push ebx
+ push edi
+ xor edi,edi
+ mov eax,dword ptr [esp+10h]
+ or eax,eax
+ jge L1
+ inc edi
+ mov edx,dword ptr [esp+0Ch]
+ neg eax
+ neg edx
+ sbb eax,0
+ mov dword ptr [esp+10h],eax
+ mov dword ptr [esp+0Ch],edx
+L1:
+ mov eax,dword ptr [esp+18h]
+ or eax,eax
+ jge L2
+ mov edx,dword ptr [esp+14h]
+ neg eax
+ neg edx
+ sbb eax,0
+ mov dword ptr [esp+18h],eax
+ mov dword ptr [esp+14h],edx
+L2:
+ or eax,eax
+ jne L3
+ mov ecx,dword ptr [esp+14h]
+ mov eax,dword ptr [esp+10h]
+ xor edx,edx
+ div ecx
+ mov eax,dword ptr [esp+0Ch]
+ div ecx
+ mov eax,edx
+ xor edx,edx
+ dec edi
+ jns L4
+ jmp L8
+L3:
+ mov ebx,eax
+ mov ecx,dword ptr [esp+14h]
+ mov edx,dword ptr [esp+10h]
+ mov eax,dword ptr [esp+0Ch]
+L5:
+ shr ebx,1
+ rcr ecx,1
+ shr edx,1
+ rcr eax,1
+ or ebx,ebx
+ jne L5
+ div ecx
+ mov ecx,eax
+ mul dword ptr [esp+18h]
+ xchg eax,ecx
+ mul dword ptr [esp+14h]
+ add edx,ecx
+ jb L6
+ cmp edx,dword ptr [esp+10h]
+ ja L6
+ jb L7
+ cmp eax,dword ptr [esp+0Ch]
+ jbe L7
+L6:
+ sub eax,dword ptr [esp+14h]
+ sbb edx,dword ptr [esp+18h]
+L7:
+ sub eax,dword ptr [esp+0Ch]
+ sbb edx,dword ptr [esp+10h]
+ dec edi
+ jns L8
+L4:
+ neg edx
+ neg eax
+ sbb edx,0
+L8:
+ pop edi
+ pop ebx
+ ret 10h
+ }
+ /* *INDENT-ON* */
+}
+
+void
+__declspec(naked)
+_aullrem()
+{
+ /* *INDENT-OFF* */
+ __asm {
+ push ebx
+ mov eax,dword ptr [esp+14h]
+ or eax,eax
+ jne L1
+ mov ecx,dword ptr [esp+10h]
+ mov eax,dword ptr [esp+0Ch]
+ xor edx,edx
+ div ecx
+ mov eax,dword ptr [esp+8]
+ div ecx
+ mov eax,edx
+ xor edx,edx
+ jmp L2
+L1:
+ mov ecx,eax
+ mov ebx,dword ptr [esp+10h]
+ mov edx,dword ptr [esp+0Ch]
+ mov eax,dword ptr [esp+8]
+L3:
+ shr ecx,1
+ rcr ebx,1
+ shr edx,1
+ rcr eax,1
+ or ecx,ecx
+ jne L3
+ div ebx
+ mov ecx,eax
+ mul dword ptr [esp+14h]
+ xchg eax,ecx
+ mul dword ptr [esp+10h]
+ add edx,ecx
+ jb L4
+ cmp edx,dword ptr [esp+0Ch]
+ ja L4
+ jb L5
+ cmp eax,dword ptr [esp+8]
+ jbe L5
+L4:
+ sub eax,dword ptr [esp+10h]
+ sbb edx,dword ptr [esp+14h]
+L5:
+ sub eax,dword ptr [esp+8]
+ sbb edx,dword ptr [esp+0Ch]
+ neg edx
+ neg eax
+ sbb edx,0
+L2:
+ pop ebx
+ ret 10h
+ }
+ /* *INDENT-ON* */
+}
+
+void
+__declspec(naked)
+_alldvrm()
+{
+ /* *INDENT-OFF* */
+ __asm {
+ push edi
+ push esi
+ push ebp
+ xor edi,edi
+ xor ebp,ebp
+ mov eax,dword ptr [esp+14h]
+ or eax,eax
+ jge L1
+ inc edi
+ inc ebp
+ mov edx,dword ptr [esp+10h]
+ neg eax
+ neg edx
+ sbb eax,0
+ mov dword ptr [esp+14h],eax
+ mov dword ptr [esp+10h],edx
+L1:
+ mov eax,dword ptr [esp+1Ch]
+ or eax,eax
+ jge L2
+ inc edi
+ mov edx,dword ptr [esp+18h]
+ neg eax
+ neg edx
+ sbb eax,0
+ mov dword ptr [esp+1Ch],eax
+ mov dword ptr [esp+18h],edx
+L2:
+ or eax,eax
+ jne L3
+ mov ecx,dword ptr [esp+18h]
+ mov eax,dword ptr [esp+14h]
+ xor edx,edx
+ div ecx
+ mov ebx,eax
+ mov eax,dword ptr [esp+10h]
+ div ecx
+ mov esi,eax
+ mov eax,ebx
+ mul dword ptr [esp+18h]
+ mov ecx,eax
+ mov eax,esi
+ mul dword ptr [esp+18h]
+ add edx,ecx
+ jmp L4
+L3:
+ mov ebx,eax
+ mov ecx,dword ptr [esp+18h]
+ mov edx,dword ptr [esp+14h]
+ mov eax,dword ptr [esp+10h]
+L5:
+ shr ebx,1
+ rcr ecx,1
+ shr edx,1
+ rcr eax,1
+ or ebx,ebx
+ jne L5
+ div ecx
+ mov esi,eax
+ mul dword ptr [esp+1Ch]
+ mov ecx,eax
+ mov eax,dword ptr [esp+18h]
+ mul esi
+ add edx,ecx
+ jb L6
+ cmp edx,dword ptr [esp+14h]
+ ja L6
+ jb L7
+ cmp eax,dword ptr [esp+10h]
+ jbe L7
+L6:
+ dec esi
+ sub eax,dword ptr [esp+18h]
+ sbb edx,dword ptr [esp+1Ch]
+L7:
+ xor ebx,ebx
+L4:
+ sub eax,dword ptr [esp+10h]
+ sbb edx,dword ptr [esp+14h]
+ dec ebp
+ jns L9
+ neg edx
+ neg eax
+ sbb edx,0
+L9:
+ mov ecx,edx
+ mov edx,ebx
+ mov ebx,ecx
+ mov ecx,eax
+ mov eax,esi
+ dec edi
+ jne L8
+ neg edx
+ neg eax
+ sbb edx,0
+L8:
+ pop ebp
+ pop esi
+ pop edi
+ ret 10h
+ }
+ /* *INDENT-ON* */
+}
+
+void
+__declspec(naked)
+_aulldvrm()
+{
+ /* *INDENT-OFF* */
+ __asm {
+ push esi
+ mov eax,dword ptr [esp+14h]
+ or eax,eax
+ jne L1
+ mov ecx,dword ptr [esp+10h]
+ mov eax,dword ptr [esp+0Ch]
+ xor edx,edx
+ div ecx
+ mov ebx,eax
+ mov eax,dword ptr [esp+8]
+ div ecx
+ mov esi,eax
+ mov eax,ebx
+ mul dword ptr [esp+10h]
+ mov ecx,eax
+ mov eax,esi
+ mul dword ptr [esp+10h]
+ add edx,ecx
+ jmp L2
+L1:
+ mov ecx,eax
+ mov ebx,dword ptr [esp+10h]
+ mov edx,dword ptr [esp+0Ch]
+ mov eax,dword ptr [esp+8]
+L3:
+ shr ecx,1
+ rcr ebx,1
+ shr edx,1
+ rcr eax,1
+ or ecx,ecx
+ jne L3
+ div ebx
+ mov esi,eax
+ mul dword ptr [esp+14h]
+ mov ecx,eax
+ mov eax,dword ptr [esp+10h]
+ mul esi
+ add edx,ecx
+ jb L4
+ cmp edx,dword ptr [esp+0Ch]
+ ja L4
+ jb L5
+ cmp eax,dword ptr [esp+8]
+ jbe L5
+L4:
+ dec esi
+ sub eax,dword ptr [esp+10h]
+ sbb edx,dword ptr [esp+14h]
+L5:
+ xor ebx,ebx
+L2:
+ sub eax,dword ptr [esp+8]
+ sbb edx,dword ptr [esp+0Ch]
+ neg edx
+ neg eax
+ sbb edx,0
+ mov ecx,edx
+ mov edx,ebx
+ mov ebx,ecx
+ mov ecx,eax
+ mov eax,esi
+ pop esi
+ ret 10h
+ }
+ /* *INDENT-ON* */
+}
+
+void
+__declspec(naked)
+_allshl()
+{
+ /* *INDENT-OFF* */
+ __asm {
+ cmp cl,40h
+ jae RETZERO
+ cmp cl,20h
+ jae MORE32
+ shld edx,eax,cl
+ shl eax,cl
+ ret
+MORE32:
+ mov edx,eax
+ xor eax,eax
+ and cl,1Fh
+ shl edx,cl
+ ret
+RETZERO:
+ xor eax,eax
+ xor edx,edx
+ ret
+ }
+ /* *INDENT-ON* */
+}
+
+void
+__declspec(naked)
+_allshr()
+{
+ /* *INDENT-OFF* */
+ __asm {
+ cmp cl,3Fh
+ jae RETSIGN
+ cmp cl,20h
+ jae MORE32
+ shrd eax,edx,cl
+ sar edx,cl
+ ret
+MORE32:
+ mov eax,edx
+ sar edx,1Fh
+ and cl,1Fh
+ sar eax,cl
+ ret
+RETSIGN:
+ sar edx,1Fh
+ mov eax,edx
+ ret
+ }
+ /* *INDENT-ON* */
+}
+
+void
+__declspec(naked)
+_aullshr()
+{
+ /* *INDENT-OFF* */
+ __asm {
+ cmp cl,40h
+ jae RETZERO
+ cmp cl,20h
+ jae MORE32
+ shrd eax,edx,cl
+ shr edx,cl
+ ret
+MORE32:
+ mov eax,edx
+ xor edx,edx
+ and cl,1Fh
+ shr eax,cl
+ ret
+RETZERO:
+ xor eax,eax
+ xor edx,edx
+ ret
+ }
+ /* *INDENT-ON* */
+}
+
+#endif /* _M_IX86 */
+
+#endif /* MSC_VER */
+
+#endif /* !HAVE_LIBC */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/stdlib/SDL_stdlib.c b/src/stdlib/SDL_stdlib.c
index 62cbef8..2af18b1 100644
--- a/src/stdlib/SDL_stdlib.c
+++ b/src/stdlib/SDL_stdlib.c
@@ -533,697 +533,114 @@ int SDL_toupper(int x) { return ((x) >= 'a') && ((x) <= 'z') ? ('A'+((x)-'a')) :
int SDL_tolower(int x) { return ((x) >= 'A') && ((x) <= 'Z') ? ('a'+((x)-'A')) : (x); }
#endif
-#if defined(HAVE_CTYPE_H) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-int SDL_isblank(int x) { return isblank(x); }
-#else
-int SDL_isblank(int x) { return ((x) == ' ') || ((x) == '\t'); }
-#endif
-
-#ifndef HAVE_LIBC
-/* These are some C runtime intrinsics that need to be defined */
-
-#if defined(_MSC_VER)
-
-#ifndef __FLTUSED__
-#define __FLTUSED__
-__declspec(selectany) int _fltused = 1;
-#endif
+/* This file contains a portable memcpy manipulation function for SDL */
-/* The optimizer on Visual Studio 2005 and later generates memcpy() and memset() calls.
- Always provide it for the SDL2 DLL, but skip it when building static lib w/ static runtime. */
-#if (_MSC_VER >= 1400) && (!defined(_MT) || defined(DLL_EXPORT))
-extern void *memcpy(void* dst, const void* src, size_t len);
-#pragma intrinsic(memcpy)
-
-#pragma function(memcpy)
-void *
-memcpy(void *dst, const void *src, size_t len)
-{
- return SDL_memcpy(dst, src, len);
-}
-
-extern void *memset(void* dst, int c, size_t len);
-#pragma intrinsic(memset)
-
-#pragma function(memset)
void *
-memset(void *dst, int c, size_t len)
-{
- return SDL_memset(dst, c, len);
-}
-#endif /* (_MSC_VER >= 1400) && (!defined(_MT) || defined(DLL_EXPORT)) */
-
-#ifdef _M_IX86
-
-/* Float to long */
-void
-__declspec(naked)
-_ftol()
-{
- /* *INDENT-OFF* */
- __asm {
- push ebp
- mov ebp,esp
- sub esp,20h
- and esp,0FFFFFFF0h
- fld st(0)
- fst dword ptr [esp+18h]
- fistp qword ptr [esp+10h]
- fild qword ptr [esp+10h]
- mov edx,dword ptr [esp+18h]
- mov eax,dword ptr [esp+10h]
- test eax,eax
- je integer_QnaN_or_zero
-arg_is_not_integer_QnaN:
- fsubp st(1),st
- test edx,edx
- jns positive
- fstp dword ptr [esp]
- mov ecx,dword ptr [esp]
- xor ecx,80000000h
- add ecx,7FFFFFFFh
- adc eax,0
- mov edx,dword ptr [esp+14h]
- adc edx,0
- jmp localexit
-positive:
- fstp dword ptr [esp]
- mov ecx,dword ptr [esp]
- add ecx,7FFFFFFFh
- sbb eax,0
- mov edx,dword ptr [esp+14h]
- sbb edx,0
- jmp localexit
-integer_QnaN_or_zero:
- mov edx,dword ptr [esp+14h]
- test edx,7FFFFFFFh
- jne arg_is_not_integer_QnaN
- fstp dword ptr [esp+18h]
- fstp dword ptr [esp+18h]
-localexit:
- leave
- ret
- }
- /* *INDENT-ON* */
-}
-
-void
-_ftol2_sse()
-{
- _ftol();
-}
-
-/* 64-bit math operators for 32-bit systems */
-void
-__declspec(naked)
-_allmul()
-{
- /* *INDENT-OFF* */
- __asm {
- mov eax, dword ptr[esp+8]
- mov ecx, dword ptr[esp+10h]
- or ecx, eax
- mov ecx, dword ptr[esp+0Ch]
- jne hard
- mov eax, dword ptr[esp+4]
- mul ecx
- ret 10h
-hard:
- push ebx
- mul ecx
- mov ebx, eax
- mov eax, dword ptr[esp+8]
- mul dword ptr[esp+14h]
- add ebx, eax
- mov eax, dword ptr[esp+8]
- mul ecx
- add edx, ebx
- pop ebx
- ret 10h
- }
- /* *INDENT-ON* */
-}
-
-void
-__declspec(naked)
-_alldiv()
-{
- /* *INDENT-OFF* */
- __asm {
- push edi
- push esi
- push ebx
- xor edi,edi
- mov eax,dword ptr [esp+14h]
- or eax,eax
- jge L1
- inc edi
- mov edx,dword ptr [esp+10h]
- neg eax
- neg edx
- sbb eax,0
- mov dword ptr [esp+14h],eax
- mov dword ptr [esp+10h],edx
-L1:
- mov eax,dword ptr [esp+1Ch]
- or eax,eax
- jge L2
- inc edi
- mov edx,dword ptr [esp+18h]
- neg eax
- neg edx
- sbb eax,0
- mov dword ptr [esp+1Ch],eax
- mov dword ptr [esp+18h],edx
-L2:
- or eax,eax
- jne L3
- mov ecx,dword ptr [esp+18h]
- mov eax,dword ptr [esp+14h]
- xor edx,edx
- div ecx
- mov ebx,eax
- mov eax,dword ptr [esp+10h]
- div ecx
- mov edx,ebx
- jmp L4
-L3:
- mov ebx,eax
- mov ecx,dword ptr [esp+18h]
- mov edx,dword ptr [esp+14h]
- mov eax,dword ptr [esp+10h]
-L5:
- shr ebx,1
- rcr ecx,1
- shr edx,1
- rcr eax,1
- or ebx,ebx
- jne L5
- div ecx
- mov esi,eax
- mul dword ptr [esp+1Ch]
- mov ecx,eax
- mov eax,dword ptr [esp+18h]
- mul esi
- add edx,ecx
- jb L6
- cmp edx,dword ptr [esp+14h]
- ja L6
- jb L7
- cmp eax,dword ptr [esp+10h]
- jbe L7
-L6:
- dec esi
-L7:
- xor edx,edx
- mov eax,esi
-L4:
- dec edi
- jne L8
- neg edx
- neg eax
- sbb edx,0
-L8:
- pop ebx
- pop esi
- pop edi
- ret 10h
- }
- /* *INDENT-ON* */
-}
-
-void
-__declspec(naked)
-_aulldiv()
-{
- /* *INDENT-OFF* */
- __asm {
- push ebx
- push esi
- mov eax,dword ptr [esp+18h]
- or eax,eax
- jne L1
- mov ecx,dword ptr [esp+14h]
- mov eax,dword ptr [esp+10h]
- xor edx,edx
- div ecx
- mov ebx,eax
- mov eax,dword ptr [esp+0Ch]
- div ecx
- mov edx,ebx
- jmp L2
-L1:
- mov ecx,eax
- mov ebx,dword ptr [esp+14h]
- mov edx,dword ptr [esp+10h]
- mov eax,dword ptr [esp+0Ch]
-L3:
- shr ecx,1
- rcr ebx,1
- shr edx,1
- rcr eax,1
- or ecx,ecx
- jne L3
- div ebx
- mov esi,eax
- mul dword ptr [esp+18h]
- mov ecx,eax
- mov eax,dword ptr [esp+14h]
- mul esi
- add edx,ecx
- jb L4
- cmp edx,dword ptr [esp+10h]
- ja L4
- jb L5
- cmp eax,dword ptr [esp+0Ch]
- jbe L5
-L4:
- dec esi
-L5:
- xor edx,edx
- mov eax,esi
-L2:
- pop esi
- pop ebx
- ret 10h
- }
- /* *INDENT-ON* */
-}
-
-void
-__declspec(naked)
-_allrem()
-{
- /* *INDENT-OFF* */
- __asm {
- push ebx
- push edi
- xor edi,edi
- mov eax,dword ptr [esp+10h]
- or eax,eax
- jge L1
- inc edi
- mov edx,dword ptr [esp+0Ch]
- neg eax
- neg edx
- sbb eax,0
- mov dword ptr [esp+10h],eax
- mov dword ptr [esp+0Ch],edx
-L1:
- mov eax,dword ptr [esp+18h]
- or eax,eax
- jge L2
- mov edx,dword ptr [esp+14h]
- neg eax
- neg edx
- sbb eax,0
- mov dword ptr [esp+18h],eax
- mov dword ptr [esp+14h],edx
-L2:
- or eax,eax
- jne L3
- mov ecx,dword ptr [esp+14h]
- mov eax,dword ptr [esp+10h]
- xor edx,edx
- div ecx
- mov eax,dword ptr [esp+0Ch]
- div ecx
- mov eax,edx
- xor edx,edx
- dec edi
- jns L4
- jmp L8
-L3:
- mov ebx,eax
- mov ecx,dword ptr [esp+14h]
- mov edx,dword ptr [esp+10h]
- mov eax,dword ptr [esp+0Ch]
-L5:
- shr ebx,1
- rcr ecx,1
- shr edx,1
- rcr eax,1
- or ebx,ebx
- jne L5
- div ecx
- mov ecx,eax
- mul dword ptr [esp+18h]
- xchg eax,ecx
- mul dword ptr [esp+14h]
- add edx,ecx
- jb L6
- cmp edx,dword ptr [esp+10h]
- ja L6
- jb L7
- cmp eax,dword ptr [esp+0Ch]
- jbe L7
-L6:
- sub eax,dword ptr [esp+14h]
- sbb edx,dword ptr [esp+18h]
-L7:
- sub eax,dword ptr [esp+0Ch]
- sbb edx,dword ptr [esp+10h]
- dec edi
- jns L8
-L4:
- neg edx
- neg eax
- sbb edx,0
-L8:
- pop edi
- pop ebx
- ret 10h
- }
- /* *INDENT-ON* */
-}
-
-void
-__declspec(naked)
-_aullrem()
-{
- /* *INDENT-OFF* */
- __asm {
- push ebx
- mov eax,dword ptr [esp+14h]
- or eax,eax
- jne L1
- mov ecx,dword ptr [esp+10h]
- mov eax,dword ptr [esp+0Ch]
- xor edx,edx
- div ecx
- mov eax,dword ptr [esp+8]
- div ecx
- mov eax,edx
- xor edx,edx
- jmp L2
-L1:
- mov ecx,eax
- mov ebx,dword ptr [esp+10h]
- mov edx,dword ptr [esp+0Ch]
- mov eax,dword ptr [esp+8]
-L3:
- shr ecx,1
- rcr ebx,1
- shr edx,1
- rcr eax,1
- or ecx,ecx
- jne L3
- div ebx
- mov ecx,eax
- mul dword ptr [esp+14h]
- xchg eax,ecx
- mul dword ptr [esp+10h]
- add edx,ecx
- jb L4
- cmp edx,dword ptr [esp+0Ch]
- ja L4
- jb L5
- cmp eax,dword ptr [esp+8]
- jbe L5
-L4:
- sub eax,dword ptr [esp+10h]
- sbb edx,dword ptr [esp+14h]
-L5:
- sub eax,dword ptr [esp+8]
- sbb edx,dword ptr [esp+0Ch]
- neg edx
- neg eax
- sbb edx,0
-L2:
- pop ebx
- ret 10h
- }
- /* *INDENT-ON* */
-}
+SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len)
+{
+#ifdef __GNUC__
+ /* Presumably this is well tuned for speed.
+ On my machine this is twice as fast as the C code below.
+ */
+ return __builtin_memcpy(dst, src, len);
+#elif defined(HAVE_MEMCPY)
+ return memcpy(dst, src, len);
+#elif defined(HAVE_BCOPY)
+ bcopy(src, dst, len);
+ return dst;
+#else
+ /* GCC 4.9.0 with -O3 will generate movaps instructions with the loop
+ using Uint32* pointers, so we need to make sure the pointers are
+ aligned before we loop using them.
+ */
+ if (((uintptr_t)src & 0x3) || ((uintptr_t)dst & 0x3)) {
+ /* Do an unaligned byte copy */
+ Uint8 *srcp1 = (Uint8 *)src;
+ Uint8 *dstp1 = (Uint8 *)dst;
+
+ while (len--) {
+ *dstp1++ = *srcp1++;
+ }
+ } else {
+ size_t left = (len % 4);
+ Uint32 *srcp4, *dstp4;
+ Uint8 *srcp1, *dstp1;
+
+ srcp4 = (Uint32 *) src;
+ dstp4 = (Uint32 *) dst;
+ len /= 4;
+ while (len--) {
+ *dstp4++ = *srcp4++;
+ }
-void
-__declspec(naked)
-_alldvrm()
-{
- /* *INDENT-OFF* */
- __asm {
- push edi
- push esi
- push ebp
- xor edi,edi
- xor ebp,ebp
- mov eax,dword ptr [esp+14h]
- or eax,eax
- jge L1
- inc edi
- inc ebp
- mov edx,dword ptr [esp+10h]
- neg eax
- neg edx
- sbb eax,0
- mov dword ptr [esp+14h],eax
- mov dword ptr [esp+10h],edx
-L1:
- mov eax,dword ptr [esp+1Ch]
- or eax,eax
- jge L2
- inc edi
- mov edx,dword ptr [esp+18h]
- neg eax
- neg edx
- sbb eax,0
- mov dword ptr [esp+1Ch],eax
- mov dword ptr [esp+18h],edx
-L2:
- or eax,eax
- jne L3
- mov ecx,dword ptr [esp+18h]
- mov eax,dword ptr [esp+14h]
- xor edx,edx
- div ecx
- mov ebx,eax
- mov eax,dword ptr [esp+10h]
- div ecx
- mov esi,eax
- mov eax,ebx
- mul dword ptr [esp+18h]
- mov ecx,eax
- mov eax,esi
- mul dword ptr [esp+18h]
- add edx,ecx
- jmp L4
-L3:
- mov ebx,eax
- mov ecx,dword ptr [esp+18h]
- mov edx,dword ptr [esp+14h]
- mov eax,dword ptr [esp+10h]
-L5:
- shr ebx,1
- rcr ecx,1
- shr edx,1
- rcr eax,1
- or ebx,ebx
- jne L5
- div ecx
- mov esi,eax
- mul dword ptr [esp+1Ch]
- mov ecx,eax
- mov eax,dword ptr [esp+18h]
- mul esi
- add edx,ecx
- jb L6
- cmp edx,dword ptr [esp+14h]
- ja L6
- jb L7
- cmp eax,dword ptr [esp+10h]
- jbe L7
-L6:
- dec esi
- sub eax,dword ptr [esp+18h]
- sbb edx,dword ptr [esp+1Ch]
-L7:
- xor ebx,ebx
-L4:
- sub eax,dword ptr [esp+10h]
- sbb edx,dword ptr [esp+14h]
- dec ebp
- jns L9
- neg edx
- neg eax
- sbb edx,0
-L9:
- mov ecx,edx
- mov edx,ebx
- mov ebx,ecx
- mov ecx,eax
- mov eax,esi
- dec edi
- jne L8
- neg edx
- neg eax
- sbb edx,0
-L8:
- pop ebp
- pop esi
- pop edi
- ret 10h
+ srcp1 = (Uint8 *) srcp4;
+ dstp1 = (Uint8 *) dstp4;
+ switch (left) {
+ case 3:
+ *dstp1++ = *srcp1++;
+ case 2:
+ *dstp1++ = *srcp1++;
+ case 1:
+ *dstp1++ = *srcp1++;
+ }
}
- /* *INDENT-ON* */
+ return dst;
+#endif /* __GNUC__ */
}
-void
-__declspec(naked)
-_aulldvrm()
-{
- /* *INDENT-OFF* */
- __asm {
- push esi
- mov eax,dword ptr [esp+14h]
- or eax,eax
- jne L1
- mov ecx,dword ptr [esp+10h]
- mov eax,dword ptr [esp+0Ch]
- xor edx,edx
- div ecx
- mov ebx,eax
- mov eax,dword ptr [esp+8]
- div ecx
- mov esi,eax
- mov eax,ebx
- mul dword ptr [esp+10h]
- mov ecx,eax
- mov eax,esi
- mul dword ptr [esp+10h]
- add edx,ecx
- jmp L2
-L1:
- mov ecx,eax
- mov ebx,dword ptr [esp+10h]
- mov edx,dword ptr [esp+0Ch]
- mov eax,dword ptr [esp+8]
-L3:
- shr ecx,1
- rcr ebx,1
- shr edx,1
- rcr eax,1
- or ecx,ecx
- jne L3
- div ebx
- mov esi,eax
- mul dword ptr [esp+14h]
- mov ecx,eax
- mov eax,dword ptr [esp+10h]
- mul esi
- add edx,ecx
- jb L4
- cmp edx,dword ptr [esp+0Ch]
- ja L4
- jb L5
- cmp eax,dword ptr [esp+8]
- jbe L5
-L4:
- dec esi
- sub eax,dword ptr [esp+10h]
- sbb edx,dword ptr [esp+14h]
-L5:
- xor ebx,ebx
-L2:
- sub eax,dword ptr [esp+8]
- sbb edx,dword ptr [esp+0Ch]
- neg edx
- neg eax
- sbb edx,0
- mov ecx,edx
- mov edx,ebx
- mov ebx,ecx
- mov ecx,eax
- mov eax,esi
- pop esi
- ret 10h
+void *
+SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len)
+{
+#if defined(HAVE_MEMSET)
+ return memset(dst, c, len);
+#else
+ size_t left;
+ Uint32 *dstp4;
+ Uint8 *dstp1 = (Uint8 *) dst;
+ Uint8 value1;
+ Uint32 value4;
+
+ /* The value used in memset() is a byte, passed as an int */
+ c &= 0xff;
+
+ /* The destination pointer needs to be aligned on a 4-byte boundary to
+ * execute a 32-bit set. Set first bytes manually if needed until it is
+ * aligned. */
+ value1 = (Uint8)c;
+ while ((uintptr_t)dstp1 & 0x3) {
+ if (len--) {
+ *dstp1++ = value1;
+ } else {
+ return dst;
+ }
}
- /* *INDENT-ON* */
-}
-void
-__declspec(naked)
-_allshl()
-{
- /* *INDENT-OFF* */
- __asm {
- cmp cl,40h
- jae RETZERO
- cmp cl,20h
- jae MORE32
- shld edx,eax,cl
- shl eax,cl
- ret
-MORE32:
- mov edx,eax
- xor eax,eax
- and cl,1Fh
- shl edx,cl
- ret
-RETZERO:
- xor eax,eax
- xor edx,edx
- ret
+ value4 = ((Uint32)c | ((Uint32)c << 8) | ((Uint32)c << 16) | ((Uint32)c << 24));
+ dstp4 = (Uint32 *) dstp1;
+ left = (len % 4);
+ len /= 4;
+ while (len--) {
+ *dstp4++ = value4;
}
- /* *INDENT-ON* */
-}
-void
-__declspec(naked)
-_allshr()
-{
- /* *INDENT-OFF* */
- __asm {
- cmp cl,3Fh
- jae RETSIGN
- cmp cl,20h
- jae MORE32
- shrd eax,edx,cl
- sar edx,cl
- ret
-MORE32:
- mov eax,edx
- sar edx,1Fh
- and cl,1Fh
- sar eax,cl
- ret
-RETSIGN:
- sar edx,1Fh
- mov eax,edx
- ret
+ dstp1 = (Uint8 *) dstp4;
+ switch (left) {
+ case 3:
+ *dstp1++ = value1;
+ case 2:
+ *dstp1++ = value1;
+ case 1:
+ *dstp1++ = value1;
}
- /* *INDENT-ON* */
-}
-void
-__declspec(naked)
-_aullshr()
-{
- /* *INDENT-OFF* */
- __asm {
- cmp cl,40h
- jae RETZERO
- cmp cl,20h
- jae MORE32
- shrd eax,edx,cl
- shr edx,cl
- ret
-MORE32:
- mov eax,edx
- xor edx,edx
- and cl,1Fh
- shr eax,cl
- ret
-RETZERO:
- xor eax,eax
- xor edx,edx
- ret
- }
- /* *INDENT-ON* */
+ return dst;
+#endif /* HAVE_MEMSET */
}
-#endif /* _M_IX86 */
-
-#endif /* MSC_VER */
-
-#endif /* !HAVE_LIBC */
+#if defined(HAVE_CTYPE_H) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+int SDL_isblank(int x) { return isblank(x); }
+#else
+int SDL_isblank(int x) { return ((x) == ' ') || ((x) == '\t'); }
+#endif
/* vi: set ts=4 sw=4 expandtab: */