Compare commits
2852 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a00f9e4211 | |||
| 3cb9cd7724 | |||
| 9632d0ab8a | |||
| 68b68e676b | |||
| c7ced46707 | |||
| ecc194cb62 | |||
| a1b4ffcf52 | |||
| ae809ad320 | |||
| 7d1c18a569 | |||
| 71f034c4ea | |||
| b156b40f8f | |||
| 8d5a9dc722 | |||
| 06dc6909c4 | |||
| c639b7d5f4 | |||
| a38e144320 | |||
| 059c45f202 | |||
| eccceea7fb | |||
| ad340c3007 | |||
| c214f45e14 | |||
| c8620070b9 | |||
| 61a371b106 | |||
| 5210df6882 | |||
| edb7991979 | |||
| 90d6069a16 | |||
| 880a4e3ca6 | |||
| 18e30c7e44 | |||
| 0113224cb6 | |||
| d1bd936765 | |||
| 2c41eecdb1 | |||
| 1a9e38a1dd | |||
| 9f3f619774 | |||
| 795e234c6f | |||
| 23fdcbfeb8 | |||
| ee3e36672c | |||
| 119b4e4529 | |||
| cc6112cbc4 | |||
| f16c9cd3c6 | |||
| 9e4c24baa3 | |||
| 801609fb78 | |||
| 4c8630d29f | |||
| 4e426af114 | |||
| 5b66fe47db | |||
| 7ae9b15b5c | |||
| 67323994fc | |||
| fcc7a7452a | |||
| 1bb0caed6f | |||
| 23a445619b | |||
| 837d9ca688 | |||
| 9b121a6414 | |||
| 5f1aafb961 | |||
| 615ff08d1a | |||
| 3320d1e1c7 | |||
| 3deb177ab7 | |||
| 41dad58489 | |||
| cb8a240f1a | |||
| 871ef2cdfe | |||
| 6c0bc43776 | |||
| a16d18d83c | |||
| e499c3c6e3 | |||
| ddd261c943 | |||
| a1f9ff0aaa | |||
| d636ea9338 | |||
| 1747e68d1d | |||
| c4c710d39d | |||
| 9a5dbda063 | |||
| bd9c876e36 | |||
| 903d847058 | |||
| 789e42e26f | |||
| 85e11ca341 | |||
| 0da81d22d3 | |||
| 52b993095d | |||
| 363e0a40e5 | |||
| 7ea0a6d642 | |||
| 035d410a89 | |||
| b0b42071f2 | |||
| 5c24009eb5 | |||
| 00340f33c3 | |||
| 01c285fc4a | |||
| 87797e117e | |||
| a5cc9a5517 | |||
| 806acf8cd0 | |||
| 04f6302ecc | |||
| 1df977fae2 | |||
| 9105c2cf4a | |||
| 6d43fcf8fb | |||
| fafae1cbb5 | |||
| 419e673d5b | |||
| 48f47de95c | |||
| 44a1df4353 | |||
| 13b3c78c7f | |||
| e362c2c078 | |||
| 814adbb8c4 | |||
| cf86b6c107 | |||
| 12a83e5a1c | |||
| 0f769eec81 | |||
| 0737c788fc | |||
| 3fe9aea5b5 | |||
| ab6ba848b8 | |||
| 0a38800e44 | |||
| 6be5618d22 | |||
| 95d9462a71 | |||
| e05cd9f47b | |||
| aa09302ca0 | |||
| 6d6b9fd269 | |||
| 6d265452cf | |||
| 65d20f2d08 | |||
| a229e30b08 | |||
| d246a37b11 | |||
| e839595053 | |||
| a711eb31f4 | |||
| b117a6d4cd | |||
| 36b1004e26 | |||
| c75c47fdd2 | |||
| 0f626c8d30 | |||
| 021783dcc1 | |||
| 1f339862db | |||
| 4446d9ce4b | |||
| 92b08a4faf | |||
| d311b4bd53 | |||
| a6dfc3be2f | |||
| 750e7b73e3 | |||
| 6a36967e6f | |||
| d6d7ade6e3 | |||
| 151d98df51 | |||
| fa744e53d3 | |||
| e0df2c584f | |||
| 3c88477270 | |||
| df46e5137c | |||
| ffe8133865 | |||
| 7140e82189 | |||
| cb743da215 | |||
| 4d24ba1f35 | |||
| 87411da95f | |||
| d25d1ecb3a | |||
| 2a00a88e2a | |||
| b01220d2c5 | |||
| 58dd2bff41 | |||
| f34773ed73 | |||
| 9b5cc7cda7 | |||
| 77db8f04b9 | |||
| 9319bc579c | |||
| 73784b9e12 | |||
| 533f960854 | |||
| 765208a181 | |||
| 4417701ea7 | |||
| f66eaf8f44 | |||
| 0dd9c386ee | |||
| af8c871411 | |||
| 50e1e6596e | |||
| d8897c585d | |||
| 7d32dc312f | |||
| eff1e4bd7e | |||
| ac50b46608 | |||
| a0e2a3db1d | |||
| 0cc981ec18 | |||
| 8170b91f76 | |||
| d1a7bb0136 | |||
| 56caa10e56 | |||
| 926496b59d | |||
| 102d30db2d | |||
| 5281a85b67 | |||
| de28c812e8 | |||
| eea73deab3 | |||
| 67c02e3522 | |||
| 19dd2a693b | |||
| 3df133652a | |||
| 80d2034083 | |||
| db9389d24c | |||
| c996be321c | |||
| 6ff6a4989a | |||
| 2655255d4d | |||
| 8485afa3a5 | |||
| 2759091ede | |||
| ae02b71a85 | |||
| 4445569bb0 | |||
| a604394b20 | |||
| dd8a337b14 | |||
| 0572d44996 | |||
| 38aa116c59 | |||
| 61666bae69 | |||
| 362a26a404 | |||
| 81fa3da101 | |||
| bd1fb86492 | |||
| 238298f695 | |||
| 194f7375da | |||
| 3581c5b078 | |||
| c5572acd38 | |||
| acc2fea7e3 | |||
| 3dc7b64fa1 | |||
| 79f2c21dfb | |||
| df36c44bc2 | |||
| c4db65cc08 | |||
| c86ddb3b7d | |||
| a1aebdc5d6 | |||
| b49a1f27eb | |||
| e7fd84e031 | |||
| 9d9e18f614 | |||
| c8199de188 | |||
| fc331da883 | |||
| b6d3fa8c66 | |||
| 3cebea1801 | |||
| 2e9ee81dcd | |||
| cf4da5c4d1 | |||
| 9d1ec0b319 | |||
| 9c5108c1ca | |||
| 2807be7080 | |||
| ec7b18dab5 | |||
| b9e20dc5c9 | |||
| cfdc852f03 | |||
| 92514e33bb | |||
| 572a2a06d1 | |||
| f076fcd539 | |||
| 4ac59875af | |||
| 780ca38f2f | |||
| 97ea5e9dba | |||
| 9e83bc6544 | |||
| 37aefe5811 | |||
| d686b48f65 | |||
| f319362e35 | |||
| 0d9b1654ec | |||
| 940e726754 | |||
| f43824762a | |||
| cd53bb7eff | |||
| 60fc90bb8e | |||
| a9437d69ab | |||
| 5d91caebe9 | |||
| eb4131e1c7 | |||
| 07f0ba213e | |||
| 48382564d1 | |||
| 274386a078 | |||
| 557d015662 | |||
| 5985f0eefa | |||
| 82258915da | |||
| 11a1f090d3 | |||
| a0d48c588a | |||
| 5e2424da58 | |||
| 72a6696f5c | |||
| 9087116ee5 | |||
| 89e0dcba5e | |||
| 7698064f5a | |||
| ab31e96385 | |||
| a9dcad629b | |||
| e49679484a | |||
| 290226539f | |||
| 75efc79930 | |||
| 905496e926 | |||
| 64579eef7e | |||
| e0a648240f | |||
| 7bad8f3348 | |||
| 11a197a387 | |||
| ee1384341e | |||
| fb01ed55e5 | |||
| 5a0a5d9ff1 | |||
| 58e3232710 | |||
| 2cd7238e76 | |||
| 21f0043b27 | |||
| b7599c0f30 | |||
| d8494ef1ae | |||
| 727b32e886 | |||
| 8124efa505 | |||
| a5cff4d797 | |||
| d1e5828644 | |||
| 18d73d6d76 | |||
| 4a3a24dcc1 | |||
| 591159c4a9 | |||
| 7baf959975 | |||
| 3f02935844 | |||
| f98251a05a | |||
| 80f0741103 | |||
| e28707055b | |||
| 698c3415ea | |||
| daf43989fc | |||
| c7586de280 | |||
| 506b9deec5 | |||
| 1fc0191311 | |||
| 1f9e04f72d | |||
| a71bdc761e | |||
| 9d8f4d5cfa | |||
| ee87fdc869 | |||
| bf63a18c5f | |||
| ddba30988b | |||
| b0e2c959eb | |||
| 28bec8e1bf | |||
| 86702186f2 | |||
| 82b1a2bd7a | |||
| d36cf71a2d | |||
| 1dd1062be1 | |||
| c0e3b86064 | |||
| 6210a8491f | |||
| 33a4f05ffa | |||
| a74d3005f8 | |||
| bca833dad7 | |||
| f981e05908 | |||
| b5abd777b0 | |||
| b2c9add47e | |||
| a401a192b8 | |||
| ad1b007dd1 | |||
| 71e35c8b4d | |||
| 2e504b2dac | |||
| 6e9df9e452 | |||
| 8aa5899196 | |||
| b6608ad31d | |||
| edb39039dd | |||
| bacf518189 | |||
| 1244044647 | |||
| b960ce1426 | |||
| c55a889c23 | |||
| 829af30568 | |||
| a3007e11ca | |||
| 9a981b5292 | |||
| 4464a6c3f6 | |||
| d30ac20fad | |||
| 7bb2d94e53 | |||
| 7ff4509858 | |||
| f2997e4c00 | |||
| 133e9d4705 | |||
| 501ca4bcf5 | |||
| 9212942724 | |||
| 683c1a6512 | |||
| 9b0d33048c | |||
| bc8bf2c329 | |||
| f0002501f7 | |||
| c4cc0154be | |||
| cba4c3cdc4 | |||
| c51d3b5465 | |||
| e179adc4a0 | |||
| 47f3740a70 | |||
| 2880370047 | |||
| 61a055a1c6 | |||
| 64b4cfa59f | |||
| c799ffd223 | |||
| 2ec039365f | |||
| 26e731b487 | |||
| 34bae90820 | |||
| b55a052a22 | |||
| 011aabe9ed | |||
| a17a6527f6 | |||
| 122c6256ca | |||
| 73aaff1b29 | |||
| c7fbc16357 | |||
| bc728db15b | |||
| 2eebbd307d | |||
| dc851a729e | |||
| 6007fd630f | |||
| cb0ecb2afb | |||
| 84a785ea67 | |||
| cc1e4d2194 | |||
| b2d84dcebd | |||
| 958d77ba52 | |||
| c4b38869ab | |||
| fd1968dd22 | |||
| 88b80ebdf5 | |||
| 2445ab8d8e | |||
| 0e1931f178 | |||
| 3e923b4993 | |||
| 8181498d86 | |||
| 57dd611111 | |||
| b3162bd41c | |||
| cd2adbad9a | |||
| 99730ac4f9 | |||
| d2ab3383ad | |||
| 3b15a6b39e | |||
| 651e58f443 | |||
| 769f9e33e9 | |||
| cf77bb7cfc | |||
| c75b76ddf5 | |||
| 4dec8d7925 | |||
| 934e7b614c | |||
| 416b14de72 | |||
| b87099c790 | |||
| 052725fdc7 | |||
| f90b79791f | |||
| 4c32c95b33 | |||
| c00d47cc99 | |||
| ea53c7dc85 | |||
| 2b923c681e | |||
| 7a8e918519 | |||
| d99ae3809d | |||
| 51e6d0a336 | |||
| 228844c017 | |||
| 87e628a9e9 | |||
| e6885e25b5 | |||
| f31ffc4596 | |||
| 4114f00c05 | |||
| 8f7209f886 | |||
| d80146c704 | |||
| 577f379a12 | |||
| 3d73915358 | |||
| a5317d50a5 | |||
| 143bd6cc80 | |||
| 5cc8f970c0 | |||
| c9058280e0 | |||
| 5af50cfd55 | |||
| d846142f0c | |||
| 0ba0f9d2b9 | |||
| f4f9c1865e | |||
| c40439ae6b | |||
| 683fa2a392 | |||
| 246bf1df64 | |||
| 9a868e9239 | |||
| ab3cde1939 | |||
| bec3e156fb | |||
| 086afbbaa5 | |||
| cd4d73114c | |||
| 14ca506774 | |||
| 984bf67d84 | |||
| 2b3ae8b638 | |||
| bb9ae18c71 | |||
| ce01457510 | |||
| d1a46b491e | |||
| 31df99f7d6 | |||
| 5e11b2b056 | |||
| d106934336 | |||
| 68718361a7 | |||
| c887865d54 | |||
| dc48944979 | |||
| d22b8b1d3a | |||
| 56619b20cf | |||
| 12ebf77e22 | |||
| 845af8bd96 | |||
| 680f08c2b8 | |||
| 82bac4173e | |||
| 8a8fda3e02 | |||
| 1c5b685398 | |||
| e95084f138 | |||
| e12d268662 | |||
| 6a3f17cd36 | |||
| db0774a81b | |||
| 34615d3a74 | |||
| 189499c10b | |||
| de613a8a98 | |||
| c0369b2e10 | |||
| 07ebbb6c84 | |||
| 73ed657e00 | |||
| b37217b181 | |||
| b02e6e222f | |||
| c52abed4d3 | |||
| 9e57efe82c | |||
| 77ab872bec | |||
| 27acebc5f5 | |||
| 2755d9941c | |||
| 488982f424 | |||
| 086e12c6ca | |||
| 9b19f16698 | |||
| b13fd68848 | |||
| 3e51426379 | |||
| 105781fa76 | |||
| d2be12bb07 | |||
| fdc15e12c4 | |||
| e548743cbf | |||
| 7499f875a6 | |||
| cdef752a9c | |||
| 1483941bea | |||
| 9cc15be7f2 | |||
| 453e1bfaec | |||
| 82439327fa | |||
| f60002e87d | |||
| 9fc6382909 | |||
| ebad08aa97 | |||
| 599f1dd157 | |||
| bb5ce67d57 | |||
| f948ce399e | |||
| 954c60947d | |||
| 98b6783c05 | |||
| 0894d2886a | |||
| 4995b4abe3 | |||
| 35ef19cfc8 | |||
| 09824a718f | |||
| f4e85af53c | |||
| 74a909cfbc | |||
| 0bfdfd8433 | |||
| 1f5cf776b2 | |||
| cdd6840826 | |||
| ab27ee4cf4 | |||
| 6211295155 | |||
| befd7ceb89 | |||
| 2cead6f328 | |||
| 4e3d58f75a | |||
| 24fddf1ded | |||
| 87cd65ff03 | |||
| 219e3d61f8 | |||
| 4ade06f36f | |||
| 786510a937 | |||
| 0c6df39a45 | |||
| 648ad0cd90 | |||
| cd0d43382f | |||
| 98b730c806 | |||
| 4b787b22c8 | |||
| 5c6f5a1610 | |||
| 0b8d5f7b98 | |||
| 314d481dcd | |||
| 0980c68e6f | |||
| 983bfa2088 | |||
| 3a9928de65 | |||
| 1fd5fb2f7e | |||
| 4ac88fa8d3 | |||
| 5f8f9e33f1 | |||
| f0c71ae2ae | |||
| 0c7ecdc954 | |||
| 73a687df7d | |||
| b683110e72 | |||
| 3840015e7d | |||
| 639b8112b6 | |||
| 2bf17f5d3c | |||
| 4823d4c32a | |||
| c8c035eeef | |||
| 155bd09fd0 | |||
| f546e5a8ef | |||
| 2ccb0c8f42 | |||
| 05303ce6c6 | |||
| d8f3029952 | |||
| 09c28f75b3 | |||
| 57671e267d | |||
| b692108f1e | |||
| 2815aecd0c | |||
| b9f2b1e7c6 | |||
| bd9ba7ef1f | |||
| a015bd1ebd | |||
| d6cf167d52 | |||
| 3fc2194fd5 | |||
| 72c14994f0 | |||
| fddb6a31a7 | |||
| 278ae7763a | |||
| 5cafaef0a9 | |||
| fcd297ffb2 | |||
| 969b9eb89d | |||
| 4fb5bd76fb | |||
| 8043bb9087 | |||
| 69912ba3c7 | |||
| 19034d9dff | |||
| cf0fcf5a2a | |||
| 149c593d89 | |||
| ab5a33fc31 | |||
| f5a55b3024 | |||
| 7422ab9e55 | |||
| f66256cc13 | |||
| 9cf7a63c77 | |||
| 7842812e24 | |||
| ec59d7d26b | |||
| ea23525f66 | |||
| 87762a9b17 | |||
| bc3a899acf | |||
| 5e01ffdfd8 | |||
| 794cbd8708 | |||
| 661b485b58 | |||
| 64399d45c1 | |||
| 653a9e6e7f | |||
| 71e07dc6c7 | |||
| 69ceebeb05 | |||
| ccb2724fc4 | |||
| ec6d6adebc | |||
| 3899248305 | |||
| 4557992334 | |||
| d0e9108800 | |||
| dc80d000aa | |||
| 775caabeeb | |||
| e8b6e95f8e | |||
| d2614d01fd | |||
| 4262794668 | |||
| a6237e5473 | |||
| 0b14d785ca | |||
| 6bdf415adb | |||
| ebabdd37b4 | |||
| 11c5230628 | |||
| bfe029bb0c | |||
| cbf12bb54b | |||
| b01d8e01e3 | |||
| 985b222123 | |||
| b4b8929ab1 | |||
| 48a217648c | |||
| 12ae714c70 | |||
| 2c51887668 | |||
| 69e11136e8 | |||
| c2190f71ca | |||
| 5378fee1c3 | |||
| cefc37a553 | |||
| 264253757c | |||
| 2512e958fa | |||
| cb2c0733e2 | |||
| 280aa6da91 | |||
| 9554adda28 | |||
| f3fa7119ac | |||
| 0d022d420b | |||
| ec530a2c91 | |||
| ebeeafc94f | |||
| 17e28ae85d | |||
| da6434a65a | |||
| a2623b1a9a | |||
| 1738b38536 | |||
| 7235647e67 | |||
| 2a1e3b2b77 | |||
| 61823a5d62 | |||
| ba96c6f3bb | |||
| fd8931c87e | |||
| 7530b3c971 | |||
| 64616f1408 | |||
| 004d9b09b8 | |||
| 8d46840e09 | |||
| 753a12f436 | |||
| 8e667e69f6 | |||
| 4d09be25aa | |||
| 0f499e36fb | |||
| f5beaabded | |||
| 248809ca1f | |||
| f9bc7458d4 | |||
| c4459dff40 | |||
| 16381929ba | |||
| f1b03b36f7 | |||
| e9ba6fd034 | |||
| bb03e17e2d | |||
| 09875a5180 | |||
| 4912202cfa | |||
| f57da6655c | |||
| ac34714837 | |||
| b4ce31cae3 | |||
| 5dffbca636 | |||
| fec9fcda7d | |||
| 306776626a | |||
| 15be6827ea | |||
| 8c0a786918 | |||
| 8aa67114a9 | |||
| 1bbb26334a | |||
| 1227b0a633 | |||
| 6c315e8aee | |||
| 88faac7bbc | |||
| 9bb7e8d614 | |||
| 286f97fad0 | |||
| f0a02e0d9d | |||
| 8185bfe893 | |||
| d577cebd89 | |||
| 0e5514003a | |||
| 167161d8ce | |||
| b8b0ecabd8 | |||
| bb05de2e80 | |||
| 7890e87234 | |||
| 25c05867d6 | |||
| a421270c19 | |||
| 764fb57fdc | |||
| 3fd846687e | |||
| ff9c939720 | |||
| 234db2be3f | |||
| fc44d53bb0 | |||
| 555a4b5f5c | |||
| a6e6df1445 | |||
| 2010d697c8 | |||
| 26045a9be5 | |||
| 06e5b8a06a | |||
| 94aef197dd | |||
| a86e7eeba0 | |||
| 95a3ce68ce | |||
| 9ab1e69697 | |||
| 4f03cf7e1e | |||
| 60d80fd5fc | |||
| 350d3ad386 | |||
| d6065e8814 | |||
| 363808a57b | |||
| 3402835c8e | |||
| 911d37e4d7 | |||
| 72e1e242a3 | |||
| c42ff338e7 | |||
| 4f81fcd5cc | |||
| d47f1ef406 | |||
| 422246825b | |||
| b0ccd2a8a0 | |||
| 76c72351a5 | |||
| 03df3c5293 | |||
| dd31574b4f | |||
| eb52ac55a7 | |||
| d167582f6b | |||
| dd6cb054a7 | |||
| b97557ce7b | |||
| 964fd1095e | |||
| fcc6c2384b | |||
| a5d73f41b5 | |||
| 1b305bf789 | |||
| 943752db30 | |||
| 60a2a39e88 | |||
| 532563e861 | |||
| 3ee27bd434 | |||
| 55e68441cb | |||
| 7ec481d99b | |||
| 129e947720 | |||
| e964060a6a | |||
| 74696d2e44 | |||
| 78746fdb6f | |||
| ed2068fb03 | |||
| b61c4d3693 | |||
| 81b9952e34 | |||
| 64958264c5 | |||
| bda52a51a7 | |||
| bab4136411 | |||
| e4fe335e75 | |||
| 0a7ac4d42a | |||
| 95233b5299 | |||
| 8b6f68abcf | |||
| e9dfb3cb63 | |||
| 5b0badc215 | |||
| 6f4398889e | |||
| dd4722fc1f | |||
| eec27f0e89 | |||
| baf51a2e2f | |||
| 256eb17ae5 | |||
| 610d29dab0 | |||
| 5ad4b6249e | |||
| aaef4a2d5b | |||
| 557bd3f438 | |||
| 27b28cf6ec | |||
| cc150cc2c6 | |||
| 345bda69ec | |||
| 478b6b53a9 | |||
| a9a1204ab9 | |||
| e7ced1aeab | |||
| 56f95934f5 | |||
| 88ee62be26 | |||
| 961d41d0bd | |||
| 9c824aa0b5 | |||
| efff2a78c8 | |||
| 608f823516 | |||
| e68ffdbc81 | |||
| 3dc9a8b980 | |||
| bec0b6e8c3 | |||
| 8c01612851 | |||
| b0e5db0eb0 | |||
| 7c8fbc35bc | |||
| b637429e44 | |||
| d52bb78d2c | |||
| 1be36fe6a9 | |||
| 1088375b38 | |||
| 285322982f | |||
| 4e6be9172a | |||
| 0e1333ed5f | |||
| cd74fb6a6d | |||
| ec2d529832 | |||
| 257556bbf5 | |||
| 93d93b4805 | |||
| e368453751 | |||
| d0dc095c84 | |||
| 360fdca5ac | |||
| e1b95913ea | |||
| a3ea9e2985 | |||
| e9bf3e13d0 | |||
| 9e02471ded | |||
| 094fda0e73 | |||
| d2de560060 | |||
| 5315eb546f | |||
| 7fa521a046 | |||
| 0244c4046e | |||
| 7e8c93bea2 | |||
| 8cd7a44a25 | |||
| 9a1e6cc3e8 | |||
| 34220ec447 | |||
| f0135a02f5 | |||
| 0b7e013fbe | |||
| 850eef0c1a | |||
| 5a581f46df | |||
| b334621d76 | |||
| a768855a7a | |||
| 7ddeb0d00f | |||
| 2ba437b6dc | |||
| f2920bc30d | |||
| d043f46270 | |||
| 1e1b111678 | |||
| 1f5ce4f619 | |||
| 524da5dc54 | |||
| a2a6303a22 | |||
| 6805d8c7e0 | |||
| 5ae9de4e3b | |||
| 2f9b930c6b | |||
| e243ef5907 | |||
| 7b162c7513 | |||
| 5b8f105308 | |||
| 1df47352cc | |||
| e4225cbab8 | |||
| 83ca7654b1 | |||
| 8065dbc2e7 | |||
| d03fcad9bd | |||
| e494fc04e5 | |||
| d77c9139ad | |||
| 4479d99a9a | |||
| 072c289f5e | |||
| a538f655be | |||
| b888a6ba37 | |||
| de988f6a76 | |||
| 2b325de680 | |||
| d83fac4247 | |||
| 0a5ea859ea | |||
| 9a93b150f0 | |||
| 5476b9098e | |||
| e5a75cfd1c | |||
| 1f745c4588 | |||
| 6c7f49d563 | |||
| dae51a4a2b | |||
| d113324a90 | |||
| 1cab99b3ca | |||
| f7d08d3371 | |||
| 02d22dca95 | |||
| 7764cb2b80 | |||
| be5f8413ca | |||
| ce48d880d9 | |||
| 8d950620b7 | |||
| 10b33d0f79 | |||
| 2706486559 | |||
| d1e468fefb | |||
| 0ac90ac395 | |||
| fef779feca | |||
| ced890301c | |||
| 7d73d90c1a | |||
| 4e40260f1f | |||
| 3aebb8cb41 | |||
| fcbeb2fa22 | |||
| 7a3cbf1876 | |||
| 3dda72e47f | |||
| 1458349cb3 | |||
| a2bfd5fcfc | |||
| 6501374a34 | |||
| 63669000ab | |||
| f9a62667cf | |||
| 6cc1466baa | |||
| bcd77ac65e | |||
| 0786a0a088 | |||
| c14e79f8df | |||
| 8cc6a30557 | |||
| 5c1f79ab26 | |||
| 799c4837d3 | |||
| 5eeb79ffa1 | |||
| 159f9494a9 | |||
| 8316469cfc | |||
| 7a434d19a6 | |||
| 95ac7724a6 | |||
| e236ba4daf | |||
| 5746df4046 | |||
| e9570d1a00 | |||
| e0d3a3b0ed | |||
| 3183d73e4d | |||
| c8700dd246 | |||
| 08ebc59db0 | |||
| 7329fa9cf5 | |||
| 27becdec97 | |||
| 8d662e9327 | |||
| ff7636ea01 | |||
| 8f14f392fd | |||
| a1abc79f28 | |||
| 5fad7e1b87 | |||
| 3d0f751211 | |||
| 8864f944e2 | |||
| 918984ee64 | |||
| b29f106c51 | |||
| 71f8280c5e | |||
| 0ff293707a | |||
| 9adab801ac | |||
| 43e7776f4d | |||
| aee91b4f6f | |||
| ffd36ea662 | |||
| abf80cc112 | |||
| 43d26fa6b6 | |||
| d02a8ba2b9 | |||
| 9acc606e4d | |||
| e52386ccfb | |||
| 1d40c06c19 | |||
| c175cdf3d8 | |||
| 7924784215 | |||
| 06cbc96722 | |||
| dcda332a93 | |||
| eac4e991bd | |||
| 9284344480 | |||
| 2c03467eec | |||
| b67cda7cbb | |||
| f04655c814 | |||
| cd6aa0774f | |||
| 6d3052c5dd | |||
| fb27ed4deb | |||
| 572a335c38 | |||
| f21b298e5e | |||
| b7c1750485 | |||
| bfd10d7b06 | |||
| ed801de016 | |||
| 9df6e97c88 | |||
| e7c5f48d15 | |||
| 7ef112cf30 | |||
| f6de42a2ae | |||
| 8acb62f6ee | |||
| 1d6fbf1c35 | |||
| f92b487947 | |||
| 6a67155404 | |||
| f42e647430 | |||
| 7c65c1e3aa | |||
| 9f51003366 | |||
| 512eb93a62 | |||
| 9c919db9ae | |||
| 61ada2c1dc | |||
| bd5bff321e | |||
| ee3a302cf2 | |||
| fb3752a8ef | |||
| 548b748f50 | |||
| 771009f333 | |||
| db731d307e | |||
| c6f3f386df | |||
| 8d781a737b | |||
| e9af0bb72b | |||
| d8bbec9594 | |||
| f1a37da94c | |||
| bca7b02ae9 | |||
| e761b3235c | |||
| 219ddf3e11 | |||
| afae58b231 | |||
| b5db0d0397 | |||
| 563af4211a | |||
| 184bd51b87 | |||
| 895af3c3ab | |||
| 6783bcd273 | |||
| 1d51f3af0c | |||
| 26d8120168 | |||
| 21f744e218 | |||
| 841f815be3 | |||
| 3c231ee9b7 | |||
| 3d31e2f2a9 | |||
| 8516e9da70 | |||
| d6b0263144 | |||
| 91768c025c | |||
| 57aee92bfe | |||
| 89de1a8cf6 | |||
| ccd4724263 | |||
| f6a06a5618 | |||
| 5684b5909f | |||
| 60cbd7a88c | |||
| 2db68acab9 | |||
| b04bd5fa74 | |||
| 4d26535758 | |||
| 5407e42b76 | |||
| 8f02ea1d42 | |||
| 3ed5a935fb | |||
| f24b0c2ffe | |||
| 127ad508b4 | |||
| cbc067b490 | |||
| 4087b4e6b9 | |||
| c35da0085f | |||
| f8ea50caae | |||
| 20801615f3 | |||
| 9279736fe6 | |||
| d84a0c6503 | |||
| 8fb2d04ce8 | |||
| c06cb4664a | |||
| 039d19dacf | |||
| 4dfb47cdd9 | |||
| 499fe3e218 | |||
| 855b23b3fe | |||
| 72b2876b6a | |||
| f4d0286109 | |||
| 544cec0434 | |||
| bcc097718f | |||
| 0dc176b4f1 | |||
| 47401cba1f | |||
| 8a2826f3a9 | |||
| 81f8ece236 | |||
| 3c2cf79675 | |||
| a841ba4084 | |||
| 3024026d9e | |||
| fb03a3bf67 | |||
| e53bbd668b | |||
| fc05511354 | |||
| ca35a75a7d | |||
| 15b7e4f05e | |||
| 49c84f099a | |||
| 43b267ea51 | |||
| a8441b28e8 | |||
| 3002e592c3 | |||
| 4f12f8b04f | |||
| 36e3939ec2 | |||
| c803bf1849 | |||
| ee98f577e2 | |||
| 4a86638ce8 | |||
| e037b5c438 | |||
| f45343a345 | |||
| 94a7e52c1f | |||
| 2b42895bc7 | |||
| d98d152d23 | |||
| b645a7faf5 | |||
| ffa841e7c1 | |||
| 98cee991ef | |||
| 0a617a05d0 | |||
| e66d6a9399 | |||
| ef65c47592 | |||
| 1592ecdc55 | |||
| 96742852eb | |||
| de0e660d28 | |||
| d057ffe80f | |||
| 9a2d4fe46b | |||
| e650d11b30 | |||
| a4d715e25d | |||
| af0e1f609e | |||
| 1ab5b481ff | |||
| 26ee1246ae | |||
| d0402332f7 | |||
| 43c7417906 | |||
| 56540a55ec | |||
| 35ec4de776 | |||
| c5748983f6 | |||
| 791ee013ac | |||
| 5797673daa | |||
| 3972022fa2 | |||
| 39201e5042 | |||
| ff34a73fbd | |||
| 539ac32806 | |||
| 7a86cffd0a | |||
| bc7ed8eaab | |||
| 9c5ed01130 | |||
| e58906cb4d | |||
| 7a1a4541c0 | |||
| 04df392866 | |||
| f3a325fe1a | |||
| ce7b1576e0 | |||
| 686d2759f4 | |||
| 78b8bd80e4 | |||
| 1943d9819f | |||
| 1670769119 | |||
| 59a0cf94ab | |||
| 3e4faf602a | |||
| 454a724f4e | |||
| cfecbb24ca | |||
| 762b594927 | |||
| 8d3d290e33 | |||
| 0df903090d | |||
| 6812fa4764 | |||
| cd97d74f0f | |||
| 00f6763228 | |||
| aafd74f9ea | |||
| f61ee85f80 | |||
| e33b130606 | |||
| 15e74357cf | |||
| 0dbfe314a3 | |||
| 00a1864a95 | |||
| 6c096b72b5 | |||
| a8e62e1bc1 | |||
| 42aa8f263a | |||
| af95ff5f8b | |||
| f0093375b8 | |||
| 7d26e61d82 | |||
| e035000864 | |||
| 6db5d83615 | |||
| 86a04a867b | |||
| f3823232e0 | |||
| 6b8b23c401 | |||
| 6fd2a9b677 | |||
| da559b5568 | |||
| 24587ab459 | |||
| c7e49b58a8 | |||
| c5680c29bd | |||
| 1144121d08 | |||
| fa6736e69d | |||
| 10e6b43a2f | |||
| 0809e7cf9f | |||
| 12fd43e1c6 | |||
| 397a795e75 | |||
| 1f9ade0ab6 | |||
| 83407c386c | |||
| b791d90b35 | |||
| 574e934bf3 | |||
| b57ea3a229 | |||
| 771f3c49e5 | |||
| 13e1305a76 | |||
| 9214df482e | |||
| b1a9e87ecf | |||
| 0a34403ef8 | |||
| e5bb0ba004 | |||
| 2147fe479c | |||
| 93e7988df7 | |||
| 7801e8368b | |||
| 91d7f28c67 | |||
| 8171c7766c | |||
| 3f69ceac40 | |||
| 4be9e0d396 | |||
| 6bd8a93ff4 | |||
| e39797d860 | |||
| 254ddcad51 | |||
| abd8bd6f36 | |||
| fd6c33980b | |||
| 2d5d5746d1 | |||
| 314b63eebf | |||
| f382d54e9a | |||
| 9581e4ff98 | |||
| b7a57ac4b0 | |||
| df5295ae85 | |||
| c8ad8b18bb | |||
| 44cc254620 | |||
| cef512a123 | |||
| 7895d43a98 | |||
| 4f4a80cc04 | |||
| d6597038ee | |||
| ec3e8de780 | |||
| f667b52cca | |||
| 48b54131f6 | |||
| d172b9add6 | |||
| 2d9f21a2ea | |||
| 247759b75b | |||
| 987166f4da | |||
| 90d368ae30 | |||
| a2d33a7d76 | |||
| 51f9310b9f | |||
| dca3d477c9 | |||
| 02cdf8ac63 | |||
| 6b370e85d5 | |||
| 05e80aad90 | |||
| 4ad255b8e0 | |||
| 09a60cdefa | |||
| eacf5a3813 | |||
| e951c619c5 | |||
| 6c5b8dc31c | |||
| fd0e7a4efa | |||
| a4c4548c3a | |||
| 8efc29972d | |||
| 7977fbb9c5 | |||
| 681bab558b | |||
| 107107107c | |||
| 3a804674c9 | |||
| 91673f8fdc | |||
| 86919ec0e1 | |||
| 0e320d17c1 | |||
| d063f0b335 | |||
| 781b2b4548 | |||
| bb65e6797f | |||
| b0f0641564 | |||
| 16aae4eb77 | |||
| 3a1082fe0d | |||
| dba2baba9c | |||
| ffe00e8619 | |||
| 3fa45ff994 | |||
| 73ff506b88 | |||
| 3a1676e558 | |||
| 0db9850a73 | |||
| 11ee1f3eb2 | |||
| 14951d8713 | |||
| 065ee621b8 | |||
| 12c83b340d | |||
| d2897bc6a0 | |||
| 5920372929 | |||
| 1fa82eec89 | |||
| 8c2fd50957 | |||
| 2f7d38bb81 | |||
| 4f8b5849b7 | |||
| 7f216f2581 | |||
| 6ffd38c393 | |||
| 801e7f3c2f | |||
| c7140df5f8 | |||
| 6b5f0957ce | |||
| f2ed50e6b0 | |||
| 511ca82e30 | |||
| 00274bb4da | |||
| a4d94a83b9 | |||
| 0de9960772 | |||
| aa7c9dd15d | |||
| 628354ba92 | |||
| 17b1a34ebf | |||
| 349f251d14 | |||
| 3942a464fe | |||
| 2331dc3256 | |||
| 8c3fb3998c | |||
| 327c577024 | |||
| d572d90bb7 | |||
| b42fae0989 | |||
| d92008abe4 | |||
| 484a3e6824 | |||
| 08b02efc6c | |||
| 4728478247 | |||
| 4704367382 | |||
| 14cca55b50 | |||
| 248f9424ac | |||
| b404d37eb0 | |||
| 14170afe8a | |||
| 58fdf58150 | |||
| 000ec71629 | |||
| 3e794e7fdb | |||
| c38ca21a81 | |||
| f923eaf09a | |||
| 5b980b99a0 | |||
| 22240777aa | |||
| f95395b351 | |||
| df24cff0b1 | |||
| 6dda047128 | |||
| e9efa73eed | |||
| 1c0b3fc7e0 | |||
| 580bd2b25e | |||
| d6aa834b5f | |||
| f526027778 | |||
| 949e93bec7 | |||
| cd016be86e | |||
| 84753db574 | |||
| ef0bee9228 | |||
| a60cee6536 | |||
| 108846055b | |||
| b9179de288 | |||
| 0c4b2ff06b | |||
| 8c9090fd03 | |||
| ef66b002e0 | |||
| 0d1c0e72a6 | |||
| 37f24d8c1c | |||
| 3571e6ef85 | |||
| ed542b2cb4 | |||
| b950651487 | |||
| 09700360f7 | |||
| 29a6db8960 | |||
| 6d737e61fd | |||
| d874ca5d8c | |||
| 1adc408ad7 | |||
| 83026fd263 | |||
| 92824b6729 | |||
| 7563655221 | |||
| 6889b48973 | |||
| 9766d87126 | |||
| bba528e2ae | |||
| 7c39c1de9b | |||
| 81c2fb508b | |||
| 350257e1a4 | |||
| 0e07d3c58f | |||
| 0d4543ca2a | |||
| 20cc2d7267 | |||
| 39a832d07f | |||
| 13136ec083 | |||
| 31a5a77ae5 | |||
| 1c014299eb | |||
| 7c47b0029c | |||
| 61d9852632 | |||
| cb2748ae08 | |||
| 900d7df40f | |||
| 6837370a62 | |||
| 9cfdd8afea | |||
| 7b24df0957 | |||
| 122555fb66 | |||
| d836033212 | |||
| 510041a873 | |||
| 8b4b6ba946 | |||
| d36a715b24 | |||
| 599e00d6da | |||
| 3cd8891ab8 | |||
| e3e6fb5489 | |||
| a9303acfdf | |||
| b4ec4f46b8 | |||
| 6ee9d0f35f | |||
| a0040e6fb1 | |||
| 28d7af313b | |||
| 39ef39aa4e | |||
| d9a1308624 | |||
| 56dd09f4fe | |||
| de495952fd | |||
| 1ce5349199 | |||
| dcd011048d | |||
| 12e3c9e08b | |||
| 262ff01619 | |||
| 76ccaf5e6f | |||
| 47e4a95d8f | |||
| c0bafbc804 | |||
| 61c64d1060 | |||
| 3e1e1a683c | |||
| 18f59d3be8 | |||
| bf739aa156 | |||
| 43b7d1fe98 | |||
| cc21d1b3cf | |||
| 08333e0876 | |||
| 2f93df480b | |||
| 56fe450959 | |||
| 6f9adbd162 | |||
| f48c535802 | |||
| 5f7e5a9844 | |||
| 3f3b4bc363 | |||
| 68466f05b6 | |||
| e6b4655142 | |||
| f690d55045 | |||
| d523f9cc6b | |||
| 7ca15c60bb | |||
| 8abd3e8bb4 | |||
| 6730dc1dc4 | |||
| 6b40d69a8f | |||
| d6420b8803 | |||
| a4ad0a9468 | |||
| a09fd80905 | |||
| 0617e9e14b | |||
| cb4711203b | |||
| e3e39e8de3 | |||
| 209b14fbac | |||
| 04c9d01390 | |||
| c9d8e59dbf | |||
| 86b194014b | |||
| e7c827f73b | |||
| abe498f35c | |||
| 49c02854f5 | |||
| cccfb89aa0 | |||
| 2981867375 | |||
| 56d922999f | |||
| 813c3298ad | |||
| 02832d9623 | |||
| 0ab36ef44d | |||
| 9bb46aa944 | |||
| 474baca6d8 | |||
| 88d0b7d135 | |||
| aea1ec2594 | |||
| 22a7b026e7 | |||
| c8d4a0dcdc | |||
| f16949c292 | |||
| f910a152f1 | |||
| 270c2e58a0 | |||
| a586d1c529 | |||
| 09b047611b | |||
| e5005597fe | |||
| 38bfefcdfa | |||
| 44fe6f6d39 | |||
| 4fe17fcecf | |||
| 276ee81da8 | |||
| 5e158bd3f2 | |||
| 2b924175aa | |||
| 37a722cc1d | |||
| a84223bdc6 | |||
| 4df1a938b1 | |||
| 94a3b1cfe8 | |||
| a21c6c4628 | |||
| 58f0fa3ca5 | |||
| 97bd8f7bc1 | |||
| 4c0ef37a5c | |||
| 1df8f52a9f | |||
| f9434091c3 | |||
| 59f253ba24 | |||
| c52d447381 | |||
| 524b065bc8 | |||
| f7b55ec8d4 | |||
| e7fc2bfa3b | |||
| 22e3075c64 | |||
| 09ead539a5 | |||
| 5272dd951b | |||
| 7eee9e7b05 | |||
| e5eb727110 | |||
| 7352a5a495 | |||
| 3d859a7493 | |||
| 3587cfd2df | |||
| de2be90636 | |||
| 9f35c3f52d | |||
| 22910c02a9 | |||
| fef8905dc2 | |||
| 0f7534c755 | |||
| 4d0330bf82 | |||
| 026efd96b2 | |||
| f6af5ff13a | |||
| 0d7b7585a8 | |||
| 6283600b84 | |||
| f6e04ffdd2 | |||
| 44b42f68fd | |||
| 56241838c0 | |||
| 26475f8f40 | |||
| ff5e31f396 | |||
| 59b1c324a9 | |||
| 1f627caa81 | |||
| 7dc3a50ddf | |||
| cfe08de951 | |||
| 48ad959697 | |||
| 05881ffa62 | |||
| 8b3ed7b599 | |||
| 48ad7ca3a0 | |||
| cbec04cd0f | |||
| 3fde455932 | |||
| ba727e13ae | |||
| 2248007c9a | |||
| 2359ba9aed | |||
| b736691bde | |||
| 50bf528f3f | |||
| 7e3eab9915 | |||
| dc0793b731 | |||
| c194804fec | |||
| d41e405420 | |||
| 516cb959cb | |||
| 704e74b904 | |||
| b70f08d850 | |||
| 53f2594983 | |||
| 7573d7289b | |||
| f9abe40494 | |||
| 88bb26afb4 | |||
| dac0baac0d | |||
| f7eacf70ec | |||
| 067b35217a | |||
| c3888f5bbb | |||
| af3ef02ca0 | |||
| c49ebba648 | |||
| 933d96af5f | |||
| bf6044fced | |||
| 1a0392bf15 | |||
| ad00c44231 | |||
| 69f321a471 | |||
| 37383f4217 | |||
| b84e95d768 | |||
| 4369fb234e | |||
| 58040d478a | |||
| 46a54f5474 | |||
| e31173e33e | |||
| 5b0ef401f7 | |||
| 1650dd1c7d | |||
| 84f123041a | |||
| f258ae795c | |||
| 33e80a733d | |||
| 20331a77ce | |||
| 4e6b37ca04 | |||
| 646ad3eed4 | |||
| edcc2a9e0d | |||
| 0e20acdf55 | |||
| f262e77fbd | |||
| 244aa6879a | |||
| e9fe90244f | |||
| a90376a7c4 | |||
| aff7d8a994 | |||
| 7f4b6b1ae7 | |||
| 78bcb0fd53 | |||
| c733e794de | |||
| 99fc90648b | |||
| 2587545eed | |||
| ac300c7356 | |||
| 2af2db2cbf | |||
| d5ca9dacb6 | |||
| 5e436984a2 | |||
| be972f04ac | |||
| 00c87a8fc9 | |||
| e51656e070 | |||
| 9dc6d920ce | |||
| 354db953e6 | |||
| e67cf68321 | |||
| 60d35e17ac | |||
| d161d8c545 | |||
| f66b29f043 | |||
| 77f6db2543 | |||
| 5eabe9aa33 | |||
| 76c1681173 | |||
| 67ba381dfe | |||
| 9a6285942b | |||
| d93f16fe87 | |||
| 214c1ccc7e | |||
| d1ac92fd99 | |||
| 263b7854c1 | |||
| 843aed228e | |||
| bf71b1fcf7 | |||
| 81c216f330 | |||
| e4b242955c | |||
| 3fac832567 | |||
| 08011e9b78 | |||
| ee7ed1fdc3 | |||
| d63a712cc5 | |||
| c549d7154b | |||
| 590483b81f | |||
| 9ba9d9424e | |||
| 962e140cea | |||
| 9afa960979 | |||
| 8b4f3fa775 | |||
| 5fb0b2c190 | |||
| 266ab28145 | |||
| 2acac67570 | |||
| 361ef33856 | |||
| c0c52c33b9 | |||
| 4ed92f4155 | |||
| cb953a418f | |||
| 9c1f258be3 | |||
| c6641748ce | |||
| 12efd29121 | |||
| a4bd1755cf | |||
| 683c061e60 | |||
| 0e625e193e | |||
| 43302f937c | |||
| 792ac5ed64 | |||
| 90548468ee | |||
| 1584aba387 | |||
| caea340985 | |||
| ab6c74b3c1 | |||
| f06c8b22e8 | |||
| 68fdc49528 | |||
| cd73d738e5 | |||
| ab50e5483e | |||
| 8a72bdb422 | |||
| df39bd39b0 | |||
| d58df667b9 | |||
| 7a24642c56 | |||
| 1a90adfb5e | |||
| 3832d4fa1c | |||
| 8f328b2624 | |||
| 80ef348600 | |||
| e2a9c0a8f3 | |||
| 780a234467 | |||
| ea9dc9317d | |||
| 15af1bca69 | |||
| 479150b214 | |||
| e1d1d16227 | |||
| 877dd1f98d | |||
| 7df7ac57cc | |||
| e5793acd78 | |||
| 24e76f2960 | |||
| 75e66ab5e0 | |||
| b3725baf5a | |||
| f1d9a014c0 | |||
| 8e3112734e | |||
| eb850681ee | |||
| 70308d05f3 | |||
| c7e5a62909 | |||
| f72d148d37 | |||
| d8435163bb | |||
| af11546b1e | |||
| 63f16d7a46 | |||
| c765de81d4 | |||
| 02e1c49818 | |||
| 71b15c1fa6 | |||
| 65e9388f00 | |||
| 056d43eca7 | |||
| 55ec4808f1 | |||
| 2cfa5406e7 | |||
| 86716dc37b | |||
| f9ab077908 | |||
| 8b3a3e4ac8 | |||
| 45f5819ef3 | |||
| 3f55067414 | |||
| 797b69fe8f | |||
| 019fa390f2 | |||
| 42de2a3e0b | |||
| f90bf2dd40 | |||
| dc8fc9fc79 | |||
| 3d49976b3c | |||
| eed38e1bbc | |||
| 9595297a3a | |||
| 7c5b5d25e3 | |||
| 2e22a0d9bb | |||
| ba2a8ebf2e | |||
| 381c7544fa | |||
| 4752c4014b | |||
| 24642a4c18 | |||
| 62979c7bd9 | |||
| 7b9fb7ad9c | |||
| 7f830d555d | |||
| 9aafd8c09f | |||
| 6781eb7c76 | |||
| 3e09b97f58 | |||
| e7b9513d4a | |||
| 34c36c73ee | |||
| 2821eb7397 | |||
| 65c9cd99cd | |||
| b217e8384c | |||
| df96be199b | |||
| ecc55048c5 | |||
| e58911cc95 | |||
| 269c4604aa | |||
| 8f1dc7a2d4 | |||
| da91a841b7 | |||
| 4323ca4a01 | |||
| fff0c96bf3 | |||
| 7167fbf545 | |||
| e4aff539b0 | |||
| d0e31f4ec3 | |||
| 3e06446297 | |||
| 4237039d53 | |||
| 5ae7dbf77c | |||
| f1037f75d9 | |||
| a7cb513a89 | |||
| e3ec71c683 | |||
| f7870d4968 | |||
| 80ef0ce9b5 | |||
| 696a3c4a42 | |||
| 81a01134bb | |||
| 70c291753c | |||
| 3c7ada8e83 | |||
| 46b3027981 | |||
| 334999f639 | |||
| dabfce5c82 | |||
| 0a8d9a12ab | |||
| 19b2da2590 | |||
| 17a074e1ac | |||
| 38d5f688b3 | |||
| e307a1b4bd | |||
| a50e22a11f | |||
| c995505023 | |||
| 1f8f428a59 | |||
| e10c6cbaf7 | |||
| 5870da0b55 | |||
| 5f729d4dbf | |||
| ebde86b967 | |||
| 14a425e487 | |||
| 1f1d1da87b | |||
| 129ade2f73 | |||
| c37c6fb6de | |||
| 5736fa3351 | |||
| 3e84a2acc0 | |||
| 77c252a4c0 | |||
| e4f92ddf77 | |||
| 1f3b1e1c99 | |||
| 73bdf7481e | |||
| c2ab3c664c | |||
| ddec5d6908 | |||
| 975aae1d13 | |||
| 9e62ca562b | |||
| d28b0ba2fa | |||
| aba332d4c4 | |||
| 543fb7a9cb | |||
| 67b3fc70f8 | |||
| 2268aa9093 | |||
| 4b8ee85995 | |||
| 86ead1b93b | |||
| 7ec7f261b1 | |||
| 1685769bd9 | |||
| 2acb6ed60d | |||
| 144244e902 | |||
| 7cf9d1380b | |||
| f188019244 | |||
| 38dfc88e8d | |||
| 95c36221fa | |||
| b30ac48513 | |||
| 4fcc1c0f31 | |||
| 1a2fad4eac | |||
| da4f4dafbd | |||
| e5876b3a1b | |||
| 9c2d94ca1a | |||
| ae4f837f57 | |||
| c6c4aa4634 | |||
| bcda172ae7 | |||
| d511e76a63 | |||
| 56e982375e | |||
| e3eaf5f29e | |||
| e56609d836 | |||
| 460fb66949 | |||
| b955469721 | |||
| 6378e16fdf | |||
| 8b48fd95fe | |||
| 5600430a05 | |||
| 50ad7ba1f6 | |||
| fe6cb4774e | |||
| 91fefd4671 | |||
| 677d5f09ce | |||
| c7f5475b56 | |||
| 42e3add6a1 | |||
| 8dc98bbc1b | |||
| f98595bee5 | |||
| fafefb2cf5 | |||
| 1cbcf7e1ad | |||
| df080fbc53 | |||
| bd66dfedc9 | |||
| 69faf14a79 | |||
| 1a443cf6b5 | |||
| 2fb68bfc03 | |||
| 4d70c483b2 | |||
| 29256df5b1 | |||
| a74156fe5b | |||
| 57473ff98d | |||
| 00618995d9 | |||
| 6a340afb8a | |||
| dfbc49513d | |||
| 7bb830a228 | |||
| b3f002f68f | |||
| ea949a5f28 | |||
| 53457262d4 | |||
| 472efc08eb | |||
| 0525070898 | |||
| cbc1c472d5 | |||
| aca9884e76 | |||
| 17fb601c02 | |||
| 76ac8ffbd6 | |||
| fe0c164de2 | |||
| ea2c5294df | |||
| 3c0681ad6d | |||
| 0debcfed0a | |||
| 06f733a7f2 | |||
| ad6a72e369 | |||
| b40ed5bdb7 | |||
| ee6e4c493d | |||
| 9c0c8f2bc7 | |||
| 43cc62d267 | |||
| d304b52391 | |||
| a86b278115 | |||
| ae491f04a1 | |||
| 1e108d97b2 | |||
| f0ab4b51dc | |||
| 8db02dcf40 | |||
| 63104af8e9 | |||
| b5dcfb3431 | |||
| a5e455d8ed | |||
| 6781373727 | |||
| b07960d3bc | |||
| 977d729ee0 | |||
| a33b2afe08 | |||
| 2eb0d19a75 | |||
| 9ecd1e37fa | |||
| 3ab9e04db7 | |||
| f185aba5fc | |||
| 2431fcc2a1 | |||
| 1060e93783 | |||
| 5aee8a8a81 | |||
| 28b9f4238a | |||
| a09c2dbdd7 | |||
| e1a5a24a93 | |||
| ddb042148d | |||
| 2d9929059f | |||
| b0e352c44e | |||
| 2ff407ac6a | |||
| b0e5de4c9c | |||
| 970fe0df12 | |||
| 38097783b8 | |||
| ae1729bd8a | |||
| 72f0637efe | |||
| 4e139ee080 | |||
| 57b9acec62 | |||
| c1f31d37f5 | |||
| 4b2f56e035 | |||
| d84d82c166 | |||
| f44e50b9cd | |||
| d0451932bf | |||
| 92749f011e | |||
| 9080d09583 | |||
| afc71341a5 | |||
| 1cdb2c6a26 | |||
| c62deeefd4 | |||
| 4953e79588 | |||
| 5c0bf14554 | |||
| 62102293b5 | |||
| 3eb37344cd | |||
| fcfeac818f | |||
| c13a46b07b | |||
| 705693ecf8 | |||
| 8848dc6673 | |||
| 47e784d5d0 | |||
| a346767a72 | |||
| 107641626a | |||
| 83624e1f68 | |||
| 2ce164be09 | |||
| 24d7374a22 | |||
| aa48bd91f4 | |||
| ac986c7c61 | |||
| cad96cef72 | |||
| 41cfa6349a | |||
| 62beaf299f | |||
| b928cb0223 | |||
| 4b2562d02a | |||
| b5faa8f83c | |||
| 53bfc6fa59 | |||
| adece0b73e | |||
| 063df64108 | |||
| f1f93b8f81 | |||
| 5784ffc972 | |||
| 91737b11fe | |||
| bf61c826d5 | |||
| 5816505e61 | |||
| 6e1c7a2c16 | |||
| c9afb3daaa | |||
| 7fdbadf645 | |||
| 27c86422c7 | |||
| 1b775febcd | |||
| f0d51899c1 | |||
| 3fa9d23627 | |||
| 2b18813115 | |||
| 430fd759fe | |||
| 0556837e3b | |||
| d4802cc766 | |||
| 0031c41630 | |||
| f745971cc8 | |||
| 456b649b19 | |||
| 4035dcf8e3 | |||
| dff5707e19 | |||
| 0f5603a4bc | |||
| a4c1fcb59a | |||
| d0a824996b | |||
| 69b34693f0 | |||
| 9a63ed6c50 | |||
| 6f6eda6413 | |||
| 86d2316089 | |||
| 064fc81697 | |||
| b7e4de6ea5 | |||
| a146aabcaf | |||
| 9ecb6c4e34 | |||
| 3ccfb86e1b | |||
| 9c21f43df6 | |||
| 87c07679e1 | |||
| 6de4c27b32 | |||
| 995e9b5f9f | |||
| e03f323fdd | |||
| f2bca2ef67 | |||
| 0b88d5f077 | |||
| 9f67e00e40 | |||
| 9d71369b2c | |||
| 2dd0f488a1 | |||
| dd7f24b20e | |||
| ccb7531289 | |||
| 4d0179174a | |||
| 3ddcf60a11 | |||
| 3b581aaf94 | |||
| 0c68a6afdd | |||
| fd29382290 | |||
| 1d3f91a1b8 | |||
| 999252a806 | |||
| da3c9948e6 | |||
| daa8265a47 | |||
| f807ebf9ba | |||
| 8c3a4c260e | |||
| 06f4dfb9f1 | |||
| af89eb5404 | |||
| dc0a086400 | |||
| 8aec943093 | |||
| 99b6963fab | |||
| b3c65b7bca | |||
| 0ec526c5f1 | |||
| 8af694da2e | |||
| 05d1b3605e | |||
| 5ba8daf518 | |||
| 286e154d05 | |||
| a0c1b250b6 | |||
| 6527eef655 | |||
| f39a0a5fbe | |||
| a06a93d5ba | |||
| f6e4cc14a2 | |||
| 658b4f70ef | |||
| fc5840cda6 | |||
| 2f6db5802f | |||
| 77c191df42 | |||
| d85bb3f4eb | |||
| 3a6399aaaa | |||
| de6f3b5653 | |||
| 0262076bfe | |||
| 7aca2785b6 | |||
| 6dc35a3772 | |||
| 2efc4812d7 | |||
| bb9c063e80 | |||
| 22e51e1615 | |||
| 03a46a499e | |||
| f0e01ceb8f | |||
| c2c74982c4 | |||
| c390c02acb | |||
| 56d46b5a49 | |||
| 0a7a12bbff | |||
| ace187cdd0 | |||
| 0aa1aff6ba | |||
| c54ddabe0b | |||
| e5029c532b | |||
| a4cd9e022a | |||
| 99bbcd15e1 | |||
| 9d11c8cbb5 | |||
| 92d1534917 | |||
| abd8bbd6ef | |||
| 13abe785a9 | |||
| 6a9d1edee1 | |||
| 69bdbe97a8 | |||
| de7ed1cbe9 | |||
| 7d3bbd3cf7 | |||
| 59e7379010 | |||
| be9be6e5c9 | |||
| 867f0e1f02 | |||
| 202aed560b | |||
| fdc9619e7c | |||
| 737b0dfd42 | |||
| 66371457fd | |||
| 1d85c9d201 | |||
| 3a026a7dc3 | |||
| 0502f7881f | |||
| 50354253c8 | |||
| 954d83b6a0 | |||
| f83a877331 | |||
| 2a8d740d63 | |||
| c84e5489f2 | |||
| aa08df0455 | |||
| e51d16aa37 | |||
| 98e40d12ef | |||
| e6e0210e73 | |||
| 83a2f06e3a | |||
| a5c3c7d2e5 | |||
| 65b2a0d538 | |||
| d099148961 | |||
| 6f901636bf | |||
| b087d79a08 | |||
| 904ec44a8c | |||
| 6f6503ee32 | |||
| 441713d959 | |||
| e75e437a4a | |||
| 0d87d909c6 | |||
| 2d4df57d87 | |||
| b7df539871 | |||
| d53f2f10fb | |||
| 5940247200 | |||
| 9a392d2b5c | |||
| a981c65d2f | |||
| 81805945ce | |||
| 70a3c5d440 | |||
| 7fe15f5f8d | |||
| 9c5c4457b6 | |||
| 1e605de31e | |||
| 1e9afdc289 | |||
| 1f6ca25820 | |||
| 8e2c34a003 | |||
| c2f0fbcd82 | |||
| 85b33e9cae | |||
| 6250e478f4 | |||
| 66368debf8 | |||
| aaac4c1bde | |||
| 974a3c8807 | |||
| 369f1132f3 | |||
| 2524c35638 | |||
| d906ccc77e | |||
| a2f93b0696 | |||
| 77c9dff054 | |||
| 09f9f21261 | |||
| 5f6d1644cf | |||
| c18e5e07cc | |||
| 000414c47d | |||
| 2ffa8f4623 | |||
| 53c9fb3e00 | |||
| 342b25d00e | |||
| 88abf3a6ba | |||
| 71a5e5333a | |||
| 5dfa908835 | |||
| ea0c559bc3 | |||
| 15ae06a7c4 | |||
| b6a0296d00 | |||
| 2f361e94dd | |||
| 89c2bb5cf1 | |||
| b164345561 | |||
| 3cc212940c | |||
| 2aec81330b | |||
| f16b387ad9 | |||
| 0a6968cfe5 | |||
| 8f19d11f29 | |||
| a34201ebff | |||
| 6a7324ab3e | |||
| f4d0261387 | |||
| 7f7bd961e2 | |||
| fcbacf8afd | |||
| e75de44907 | |||
| 161fa95066 | |||
| 8f8605ab2f | |||
| 544a458f20 | |||
| 285b9dad83 | |||
| 770a607ba5 | |||
| a2d4bd4fff | |||
| fe8d524352 | |||
| e212f16962 | |||
| 020fdcc781 | |||
| 194bfc54d1 | |||
| 9b050a33e4 | |||
| b6fccee6a4 | |||
| 23468a2d07 | |||
| 2c7c1c501d | |||
| 3cbdc3a198 | |||
| dcb2e8cd9e | |||
| 571bdfc828 | |||
| 0aed00a758 | |||
| 58847fa2ca | |||
| bba5285740 | |||
| e7234fd4b2 | |||
| 400002e64c | |||
| d59707bc4b | |||
| 926fa73fee | |||
| cd8cb9cced | |||
| fad79a96a2 | |||
| b6128c5dfa | |||
| 68a1da31a0 | |||
| 2c2003aa5b | |||
| f4bcf9ad1d | |||
| 7e0f2f9b12 | |||
| 50be3bd2e5 | |||
| 3c614d95b8 | |||
| aaa20c0ff0 | |||
| 0531b3d801 | |||
| 40493c564f | |||
| bbaa93c846 | |||
| 72680c7707 | |||
| 039ca6e839 | |||
| 9fadd48ea3 | |||
| 4bf9700562 | |||
| 966aec7ad7 | |||
| 78972cd611 | |||
| 24e4a43ec4 | |||
| c3415bcff2 | |||
| 35a380676e | |||
| d3ff67ffb5 | |||
| 6f874be41b | |||
| cb0929d933 | |||
| dfbd63df94 | |||
| 76bfe54c7e | |||
| 9cbcce671d | |||
| 0628a5d931 | |||
| 696be6aacd | |||
| 766cc2d42f | |||
| 2dc6adc038 | |||
| 27cc5c8a63 | |||
| d0c4b2de9f | |||
| cd6552d344 | |||
| 20bd723e7c | |||
| 2d3fe7ce1c | |||
| 4f76211551 | |||
| c918f395b9 | |||
| 4a4f318e24 | |||
| e7b1fc6696 | |||
| 76bf720adf | |||
| 2169e8d935 | |||
| ddbe496097 | |||
| 3f80d0b7d8 | |||
| 2eebecfb17 | |||
| 70c24a9466 | |||
| 4ab2e40d8a | |||
| 568af756cc | |||
| f5366c91a7 | |||
| b5f1f50a16 | |||
| 6ac9e6f9c4 | |||
| 39815801aa | |||
| 11ab9b7fa9 | |||
| baa422e65b | |||
| a7f1e788e6 | |||
| 6c44664c19 | |||
| f2d6b52561 | |||
| 8405314399 | |||
| 3321ada41e | |||
| ff8aa9112a | |||
| 0fc3e5fa1e | |||
| 98f534b1bd | |||
| f85881c18c | |||
| b8b5b93b63 | |||
| 20e25cd928 | |||
| a7d4da25a4 | |||
| ac83871214 | |||
| a1608b636f | |||
| d862817485 | |||
| 63210449c6 | |||
| 4a32b70aec | |||
| 9199b1b1d8 | |||
| a49446c9e9 | |||
| f5e529db61 | |||
| eec9578619 | |||
| d81a5b1423 | |||
| 3cbe42df0a | |||
| a2da525064 | |||
| 7c2b08b9b6 | |||
| 99af70ae59 | |||
| 5a0b93742c | |||
| 7c7cc3914d | |||
| 0d64b0f94d | |||
| f18e80e899 | |||
| 210999b874 | |||
| 046d029e89 | |||
| 7d89938624 | |||
| 6ff9aab2ca | |||
| 5f47730fc0 | |||
| 9e62e98f79 | |||
| 763828837b | |||
| f9d9d12f11 | |||
| 56f7359da4 | |||
| 6fed80333c | |||
| befd38d9ae | |||
| 98b668b3a8 | |||
| f103004aa0 | |||
| 5b4631dcf9 | |||
| 177933e212 | |||
| 83d3658ef0 | |||
| 44f0ca08e2 | |||
| 338dc62474 | |||
| a736350859 | |||
| 156b092dc9 | |||
| 122bb4d829 | |||
| 7508949ca8 | |||
| c882c8f417 | |||
| ac59073071 | |||
| 7311c161f6 | |||
| 9ba3e6d3f7 | |||
| 5db38c0127 | |||
| 191cb92300 | |||
| 2491aad6f2 | |||
| 4b239a0b87 | |||
| 2768727e2f | |||
| 309759b725 | |||
| 18627960d7 | |||
| 160b131de3 | |||
| 613777afde | |||
| dcfd29c2d9 | |||
| a7d0c4fb1e | |||
| 3a2b9f83ec | |||
| 48870f3e8b | |||
| 1f93fc902b | |||
| c646476ca8 | |||
| de94f6c2f6 | |||
| f0c4aa6777 | |||
| 0811d2d527 | |||
| 3abf14beef | |||
| 638f20c80f | |||
| 04cac6cd33 | |||
| 1d0f6eebdc | |||
| 16620f6835 | |||
| 88bfd3c3a7 | |||
| 4b11a4256e | |||
| 1dc00ccedd | |||
| 7832acbceb | |||
| 0042f4e16e | |||
| ffc9211ce2 | |||
| 8217840acc | |||
| cd7253bac9 | |||
| d3b0a3dc46 | |||
| e91dd3e373 | |||
| 6e497ae372 | |||
| 7398200980 | |||
| 8ed42410bf | |||
| 8f271861f5 | |||
| f6a70e2e08 | |||
| 52780e65e7 | |||
| 57cd4ff3c6 | |||
| 2e28e2d293 | |||
| 13e2f26a67 | |||
| 73b77525eb | |||
| a84cf030bb | |||
| af05ebe428 | |||
| c5a06dab0a | |||
| 11bace8804 | |||
| 7a9a46e093 | |||
| 8bd58b1ad4 | |||
| c681395fb2 | |||
| 33580e0aa1 | |||
| 47436bd774 | |||
| a992a5fba9 | |||
| 94e2f464e3 | |||
| 56471f4ad4 | |||
| cacb852a1e | |||
| 6dca588370 | |||
| cdf25d902a | |||
| 2a26bc6668 | |||
| 4e12e70929 | |||
| f0ad20a250 | |||
| 8ae727ca04 | |||
| 5b6537674f | |||
| 126141cdce | |||
| fe17c83020 | |||
| b8928d230a | |||
| 675c9a7945 | |||
| 1a73b0a0da | |||
| f7b845d49c | |||
| 0bd64a0e72 | |||
| acded1e08a | |||
| a4f4b81e6b | |||
| 0b18ec8208 | |||
| e3944bc67f | |||
| b085284c55 | |||
| 31b55e0030 | |||
| 7a4918e4a4 | |||
| 1e1880893a | |||
| 363cc60c82 | |||
| b09970f159 | |||
| 52930a7597 | |||
| 96fa531566 | |||
| 64997662d2 | |||
| 900ebf6583 | |||
| ce94a4ecea | |||
| 7b6482c01d | |||
| a043e95d24 | |||
| f56ecb6d3f | |||
| e24ada37bf | |||
| 546b52200b | |||
| 327c000c82 | |||
| 1b0b2fe21e | |||
| e327d47169 | |||
| 35ee550171 | |||
| f27325fd98 | |||
| 2447fdb90d | |||
| 7ab13a44d7 | |||
| 1745c8c607 | |||
| c6c5faa95c | |||
| df39bac449 | |||
| c3bf9bd4a0 | |||
| 1ac82546ec | |||
| b09b0bc43b | |||
| 0224c7a9eb | |||
| ca0d38d19d | |||
| b62ac7a046 | |||
| daa53b77cf | |||
| b8477a470f | |||
| 2f44523e6d | |||
| 2fa5f6f242 | |||
| a86cce5d70 | |||
| 9856f170a7 | |||
| ba35619718 | |||
| 37331d8ead | |||
| d17784b231 | |||
| 18e1b45388 | |||
| 9b083f801c | |||
| f0907d6f96 | |||
| 71d58e3a67 | |||
| 37425d6fcd | |||
| 1f295bba5b | |||
| a50be7a912 | |||
| f9d52ea5b9 | |||
| e192869e15 | |||
| f1be9bbf6c | |||
| d331ff3193 | |||
| 035a187c42 | |||
| 3c37036f7a | |||
| 14b6d6291b | |||
| 5720a32bc5 | |||
| 11f57f259c | |||
| 3fc6375ec5 | |||
| f8e05f8e3c | |||
| 98c0b3a2b1 | |||
| 6423c23a9a | |||
| dece8a69f6 | |||
| 5724d2d4c7 | |||
| b1736b6411 | |||
| 703ec474f5 | |||
| 64a109d28a | |||
| dc2ec17886 | |||
| 1d9dd8d29d | |||
| 8b0e1d6c03 | |||
| f1a9f6263e | |||
| a049c6fd6b | |||
| 9609767c51 | |||
| 86a8e0716f | |||
| b5e9f09972 | |||
| 4d9a167f56 | |||
| b704cc8375 | |||
| e34c956196 | |||
| 7197dd751a | |||
| 0b9e4ffe54 | |||
| 486ba6121d | |||
| 1015c126d7 | |||
| 1caf81811a | |||
| 4c2a11b6d0 | |||
| 8fd3b26308 | |||
| 617d21fa84 | |||
| 4a88ffe250 | |||
| 41b68ef353 | |||
| 72c85744b9 | |||
| c7b5bbd467 | |||
| 082bbc7336 | |||
| 087dccd194 | |||
| 61450335a5 | |||
| 67649d7976 | |||
| 6247969ede | |||
| efd38fa940 | |||
| 551472220e | |||
| 01703b1350 | |||
| e9d785475e | |||
| 9e008996ab | |||
| bcfae17219 | |||
| ddea45160b | |||
| 53f13a9721 | |||
| 3e33f064bf | |||
| aa0afc9a4e | |||
| a0d1cf26d0 | |||
| 01d14aed80 | |||
| 3c4c830e20 | |||
| 0c9c481cee | |||
| 7dae376646 | |||
| ccb89bd76a | |||
| b2317543c8 | |||
| b812ef2771 | |||
| 7618e7f3fb | |||
| b6732fbae9 | |||
| 68fa377d13 | |||
| 7a9561b966 | |||
| c061991c43 | |||
| bdac1d9bfd | |||
| 266c4209c4 | |||
| fb26da1cb0 | |||
| d623720f4d | |||
| 9d4fcbf946 | |||
| 896db3806d | |||
| 691b986e36 | |||
| 5416f60643 | |||
| 67e2e154fa | |||
| 330dea181a | |||
| 7bc673002f | |||
| ae8d1a3a60 | |||
| 27975e9dfd | |||
| bff938ccf5 | |||
| 53f317e076 | |||
| 0a7df9d02e | |||
| 408ffd3d2c | |||
| a211895e28 | |||
| 19763f8973 | |||
| 99d6f9c7a9 | |||
| 63e4ac80bd | |||
| 24983ea329 | |||
| 6cab5b5591 | |||
| c9d2aed286 | |||
| a16cc3ac8a | |||
| ba1699a831 | |||
| 20c69a0e3e | |||
| bdc5ed094b | |||
| 088d22675b | |||
| fc9b3c13e6 | |||
| 14a64e2529 | |||
| f5415fb4ac | |||
| 20076ed57e | |||
| 006b8574ae | |||
| 1de7ac3c67 | |||
| 8d1fc18941 | |||
| 06dc99ab85 | |||
| e4059dfe6a | |||
| 4048b1e515 | |||
| ccb46df905 | |||
| a16d8ba3ea | |||
| a485957130 | |||
| 56d34e0e80 | |||
| 11824b3916 | |||
| 5ca6381624 | |||
| 024b184008 | |||
| 7a105333dc | |||
| 332eb5fbd6 | |||
| 5b0dac797c | |||
| 86ddc00bb1 | |||
| 3107f37864 | |||
| 17f5fec538 | |||
| 03b76b4606 | |||
| a3e8a61547 | |||
| a8d5a8734a | |||
| 10bbb7fa1f | |||
| 8c5f2b249c | |||
| 332c512eed | |||
| d10584ac6c | |||
| d2b761b7de | |||
| 49c5ce30cc | |||
| 95725bf7fc | |||
| 94c62b1eec | |||
| 02febd3f65 | |||
| 497fbb17a8 | |||
| 5ddb1d6649 | |||
| 396c129d41 | |||
| f64a7bb820 | |||
| 4a9be0a8d2 | |||
| bf1756448e | |||
| ed8f60431f | |||
| 6f1f75bc8f | |||
| 963d150e93 | |||
| c1f1b1174d | |||
| 1ddeef71c6 | |||
| b7eefeac8b | |||
| e57f36fc5b | |||
| 32116086b3 | |||
| 878da3b474 | |||
| 73320d4180 | |||
| a1d31f640a | |||
| 9c7230e79f | |||
| 98687d474b | |||
| 7b57b8f2ca | |||
| 55c98bfaef | |||
| e9a45a2f45 | |||
| 2212a131ef | |||
| deacf05769 | |||
| 870224cde0 | |||
| e557c962fb | |||
| 5a3c218239 | |||
| 1e71deb0db | |||
| dea1d01de2 | |||
| e9bea1c742 | |||
| d51bb8b1cc | |||
| aad5283786 | |||
| 66df38957b | |||
| 7cbafd603a | |||
| 3e48c9744b | |||
| a982280400 | |||
| d62983e1a2 | |||
| 90ac24e524 | |||
| 0b2ba98238 | |||
| 916ce7899b | |||
| b978aa6dca | |||
| 6565855005 | |||
| 9f80a55652 | |||
| 9d895e6b15 | |||
| a7acb84b8b | |||
| 8d54453981 | |||
| 452fb59c74 | |||
| ba45daff35 | |||
| b3fb6d7d18 | |||
| 5dc3467337 | |||
| 729757b1dd | |||
| 393f9d329d | |||
| 820390b7ed | |||
| e0790f758e | |||
| 2f333424a6 | |||
| a67b347966 | |||
| dedf09017a | |||
| cd07ab5b5f | |||
| 6892cb1c7e | |||
| b518a9a338 | |||
| 54d078f379 | |||
| b0a0533a4f | |||
| 399f20ae54 | |||
| 554ba9d6a6 | |||
| 2c05e9719d | |||
| cb9e7358d2 | |||
| ae01e1d2c3 | |||
| 2766e5ca6f | |||
| ca0c4f2cc0 | |||
| 70c98fff19 | |||
| b5698ee101 | |||
| 379138af27 | |||
| 1864419561 | |||
| c4a8bb26fb | |||
| a9ddb1d3b3 | |||
| 314670a347 | |||
| ad49c54531 | |||
| 43ac33c2b4 | |||
| 83fdcff178 | |||
| ee4009e123 | |||
| 2decf1ecda | |||
| 1d7fbd6a9a | |||
| 1213708b72 | |||
| 6cc5428d5e | |||
| 8fcebebae3 | |||
| f801dc6558 | |||
| 8716ac554f | |||
| d7b4753007 | |||
| a9b0d25c01 | |||
| 4c7fc8a70a | |||
| f8e9ea45ba | |||
| 1b6c14be8d | |||
| a5bb925a3d | |||
| 6a14849381 | |||
| f93dbb8f49 | |||
| f83b19cecf | |||
| 1e09be19f5 | |||
| c1de0bc28c | |||
| 1a5a0f5eca | |||
| 8b0cd60be9 | |||
| 2239a52e9b | |||
| c9214ce6c0 | |||
| bb9b5e6aff | |||
| 0327ecc5c1 | |||
| ccdea1c4ad | |||
| c22e1e71f0 | |||
| aff63028d4 | |||
| 7a7b168af3 | |||
| bdf6a1c70e | |||
| d1e07434a1 | |||
| c0d823f1d8 | |||
| 8d0947f07f | |||
| 161d8ef47a | |||
| 8c139206d7 | |||
| e3a7fddddf | |||
| 923ba6f3bb | |||
| 729cd9284e | |||
| 140c5bfc3e | |||
| a5f0faefc3 | |||
| 608f8de347 | |||
| 3e8a00d264 | |||
| 7d5a72c9e0 | |||
| 48d0f80a86 | |||
| bd6c187fcd | |||
| 585837a3f0 | |||
| b4e821c28d | |||
| 589ac1c5d4 | |||
| c9e8b87c60 | |||
| 41f5158247 | |||
| d2993474fb | |||
| 77e312fb99 | |||
| cd6ef2958b | |||
| 40f3adc45f | |||
| cfa2d4aaa8 | |||
| bdefeaf6f9 | |||
| 0958c10f88 | |||
| 4adf412049 | |||
| 03332c340d | |||
| 63ecb56b51 | |||
| cbd895a29c | |||
| 9cbe77904d | |||
| a6350d5dd1 | |||
| 19b5b47b26 | |||
| 52a0b38379 | |||
| a4fdbf0a88 | |||
| 3990e2d3e6 | |||
| 53af2dbb3f | |||
| 5bdd1cf837 | |||
| 5dfe3f414d | |||
| 324fa10918 | |||
| aad06faf1f | |||
| 1a3c01154a | |||
| df338f0552 | |||
| e5d0e035d0 | |||
| 6d91a9fe6f | |||
| 935e398930 | |||
| 2afc7cbaaa | |||
| 1b5cf118e7 | |||
| a3a4c0a906 | |||
| 3ae7debc17 | |||
| dab53f4e41 | |||
| 9da7910fc9 | |||
| 3609eb25c9 | |||
| 55c75d2c87 | |||
| ded828dfc9 | |||
| c69c70cf5f | |||
| 7cd79714fa | |||
| 87af905018 | |||
| 7205a93751 | |||
| f8097a428c | |||
| 228988ca2b | |||
| d2b0b019ec | |||
| a5d74c5e96 | |||
| 3e7e077fad | |||
| dbb03ae2d7 | |||
| 06d2c5357b | |||
| c8e7530e37 | |||
| cdffaa1598 | |||
| b836d2497d | |||
| bdd94f053c | |||
| f88c3ae417 | |||
| b09ac19e61 | |||
| 826dc7d5a6 | |||
| fa5a2b6a85 | |||
| 8b8120cfb7 | |||
| e6a3b59229 | |||
| 0eb0b1e1c9 | |||
| 1becd2f788 | |||
| 7c0b93f815 | |||
| fa852c7dbe | |||
| 73ca2119ed | |||
| 86dbb859b7 | |||
| e1e370999e | |||
| 038c708a0a | |||
| c71bc25090 | |||
| 52fe86b56c | |||
| 004ebfdaee | |||
| d0edd44a69 | |||
| ea5e837bd6 | |||
| bbf52f3cea | |||
| d788b12a8e | |||
| 8a9320c4ef | |||
| 5cc9bd7702 | |||
| aa7e2376ec | |||
| ff211a9508 | |||
| 930895a218 | |||
| 3452e18da1 | |||
| b5d4b5a21c | |||
| 2dc798d539 | |||
| 805d52987f | |||
| c2467b7b38 | |||
| 22b8cfd0ba | |||
| 10a55f16cc | |||
| 8e4451d1ab | |||
| 0b5c6350ae | |||
| 48cd56acc2 | |||
| 71e16bfac3 | |||
| b7c579adf9 | |||
| 461fa6a88a | |||
| dfee46604a | |||
| a7c9827ad4 | |||
| f580bee32c | |||
| de9d859f4a | |||
| 3aaa0172d5 | |||
| 29e7eda887 | |||
| 7cb32a3680 | |||
| a4d4ab1df9 | |||
| 4bef176e9b | |||
| d2de8a87bf | |||
| 12cad7c393 | |||
| be1238cc95 | |||
| 67378c7dea | |||
| c13039396c | |||
| e940632d93 | |||
| 6db25aa7fa | |||
| 0012f39384 | |||
| 0e7e5b59ae | |||
| d459da1378 | |||
| 3063369322 | |||
| a90ad62fc0 | |||
| cd01a1eb09 | |||
| 090a769bf6 | |||
| 014846cf31 | |||
| b83cb2dbf5 | |||
| 112b7f6571 | |||
| 68a878264c | |||
| a771f168eb | |||
| 79b5b79de1 | |||
| 7cc8380330 | |||
| e91df31f8c | |||
| 663b2c9c5e | |||
| 801467e565 | |||
| 447d2b6f93 | |||
| 9ccf39b27f | |||
| d4af8dd89a | |||
| 932f31e37b | |||
| 0878db4e17 | |||
| 037586d7bb | |||
| cb7cf40b5e | |||
| 3632412c48 | |||
| 4b858648e5 | |||
| 85bebebb36 | |||
| 980be9e0e8 | |||
| ad1027455a | |||
| 9dc238187f | |||
| 73d45f3bf0 | |||
| 96400234a8 | |||
| 2e5f321583 | |||
| 5a9b29b73a | |||
| 1b2260132b | |||
| 1479468730 | |||
| f0b7afd7cc | |||
| 870d26f9d8 | |||
| f6d465667a | |||
| aaae30cb84 | |||
| fbb9396813 | |||
| b9a4abce0e | |||
| d0cc5c0fc7 | |||
| b7c2bfbcde | |||
| 8be2a55ccc | |||
| 81270f3142 | |||
| eb0d006168 | |||
| a47bda026b | |||
| 5129d0da45 | |||
| b86ec2ffcf | |||
| 20eb4352fb | |||
| e76d8eb046 | |||
| c8fefc4434 | |||
| 2c18d67769 | |||
| 428771f1d7 | |||
| 038148bf06 | |||
| 6786734d95 | |||
| 1446254a03 | |||
| 3bcd76bd4e | |||
| 0bcece4585 | |||
| 035ab590ec | |||
| 8e6e57de86 | |||
| 4c1026436f | |||
| 9f97bab717 | |||
| 76518d4c59 | |||
| eba7d3b172 | |||
| b8311caa6b | |||
| 5b044a93c1 | |||
| f009d36811 | |||
| f43260bd58 | |||
| cf384795d2 | |||
| 423cc1685c | |||
| 0a23a5ef50 | |||
| 629d608d4f | |||
| 00be247913 | |||
| 5ed0cc293d | |||
| 5401cb7392 | |||
| e26ae9899c | |||
| 48296c2ba6 | |||
| b858fceb4f | |||
| 195fb1cf66 | |||
| 52acc23ecf | |||
| 0a34fc4bcd | |||
| bec91aab7b | |||
| 5a049d41fd | |||
| 6f4dbf4fcd | |||
| bf66c36ba4 | |||
| 0c10f47e85 | |||
| 1bad9a939f | |||
| 8d6504d6e3 | |||
| 04c187deb5 | |||
| bc938ce630 | |||
| e5f95a450d | |||
| b31d38eef7 | |||
| db402cb8af | |||
| 1af6550db7 | |||
| 7795f5207f | |||
| a9b8a50c31 | |||
| a9418fa1e7 | |||
| 08f48d27e8 | |||
| 25a66da4ca | |||
| ff61bc9e7c | |||
| 3e8f4ba018 | |||
| f9eb6a31bd | |||
| 4f8cac731b | |||
| 3e496f6625 | |||
| 2d62f9c4c5 | |||
| 78811b8816 | |||
| e38cd5149a | |||
| dc2a1e270a | |||
| 44ab50553d | |||
| 7c683c368d | |||
| 62ca7a9b60 | |||
| 632e36ab44 | |||
| 0057c89eaa | |||
| 9e9a55df46 | |||
| 9463238490 | |||
| b7ff2ecffb | |||
| fad89f1c3b | |||
| 5063eefa96 | |||
| 1b34fa26ac | |||
| 25827c12a3 | |||
| cb32fd15ee | |||
| d6dcab443d | |||
| c32fec774f | |||
| ddac4686a7 | |||
| 2865865382 | |||
| 7ce835e878 | |||
| 7e0fdbbe99 | |||
| fd1f2ca1c6 | |||
| a6a92f7b6b | |||
| 4f85f151fd | |||
| 478ae0715e | |||
| 714eb6dcc5 | |||
| 89942ed92a | |||
| 6ed9251f44 | |||
| 2c32a721fc | |||
| 08aaae7999 | |||
| 78bad361ab | |||
| 2005c89baa | |||
| 8c6aa9db31 | |||
| 58eef983e2 | |||
| 390b192f0a | |||
| 7b40859eff | |||
| d0126f0fa0 | |||
| 0c034ad7de | |||
| aeeceb7d0b | |||
| d5f16ce272 | |||
| c89362f6a2 | |||
| 8a029159cd | |||
| 891ebd0cb1 | |||
| 382509d778 | |||
| f9ee8978ff | |||
| e71c2df39d | |||
| cfc7865f82 | |||
| cf6606065d | |||
| 9feb92df1b | |||
| be26810cd7 | |||
| df79b6c238 | |||
| 82c86ed2f7 | |||
| 9077563dac | |||
| 8d15f44b33 | |||
| b3fbada10e | |||
| 31cdd7bdd2 | |||
| c464e90d5d | |||
| 670d2b191c | |||
| 7bddb87306 | |||
| 2025f02105 | |||
| 1078626eea | |||
| 16c6b44f55 | |||
| 6b3b06df25 | |||
| e3b3b0cda7 | |||
| bb2cc196a6 | |||
| d3bc96a201 | |||
| 11ba6e45ab | |||
| a742501a4f | |||
| 70346028c5 | |||
| 3359458175 | |||
| 6784301376 | |||
| 51d19e7c31 | |||
| 0652870204 | |||
| 67dd6754a6 | |||
| 34274ec391 | |||
| 28feea0447 | |||
| 53267e283b | |||
| 15ed963a29 | |||
| c652d0b183 | |||
| 22c55cbcfa | |||
| c24d89dd34 | |||
| f10ea1fb9b | |||
| eb72cc9f04 | |||
| ee288340b0 | |||
| a69248299d | |||
| caa83d20f7 | |||
| 486d48e4f8 | |||
| 8480674708 | |||
| 7c62574e59 | |||
| 22584fb2d1 | |||
| 90ac9165e2 | |||
| bcb69a54b2 | |||
| f93cb262ba | |||
| 67949bb5b7 | |||
| e56da4eb46 | |||
| f7fdfe52bc | |||
| 7de0ff337b | |||
| e1c0a917fa | |||
| ead180aa60 | |||
| 58d367d704 | |||
| a1ab6c28c1 | |||
| 59e46f09b7 | |||
| 7766076042 | |||
| b96864c7e6 | |||
| 79513f06a4 | |||
| 00ff53499a | |||
| 142b44d4be | |||
| 7f28489c70 | |||
| a58c12db0b | |||
| 12e1be2626 | |||
| f81674232e | |||
| eb086b0e3f | |||
| b6b9085773 | |||
| 241989c5fa | |||
| f944573b3c | |||
| c66b155dcb | |||
| 5662867730 | |||
| dbecf0fa50 | |||
| 62cb532460 | |||
| f9bc682115 | |||
| 6cf0c5cd6d | |||
| 8a2a76da1e | |||
| e07484f057 | |||
| 0070fce286 | |||
| a2e8e3090c | |||
| 0ac68def49 | |||
| def364fe28 | |||
| c06707c891 | |||
| d7a8d385d8 | |||
| 3567c43fb5 | |||
| aaaeb66cc8 | |||
| 4ed76a15ff | |||
| b5837d1271 | |||
| e4c3b1c2bd | |||
| ea916fd7e1 | |||
| 4bee8dc37f | |||
| 8b01d05146 | |||
| 376e564cff | |||
| caf02d1841 | |||
| 6cf73fad13 | |||
| cfe660ab35 | |||
| 8eaf76394c | |||
| a692adefd7 | |||
| e05f1c37ad | |||
| 923fcc3b3d | |||
| c50b9bc4b4 | |||
| e1f95ceb54 | |||
| eb77495d5f | |||
| 270d602a26 | |||
| dd41ee68de | |||
| 46dc40f3f1 | |||
| 7c7af2e102 | |||
| 36189b8c3b | |||
| cde802b16c | |||
| 1500e5f588 | |||
| fbe91fb245 | |||
| 321e7d6977 | |||
| 56488a4ac9 | |||
| 4a75f44d47 | |||
| deb4b03200 | |||
| df94c906da | |||
| 4d50d9daa4 | |||
| 0624bdc72d | |||
| ccec6e53c0 | |||
| 68d411918d | |||
| f14d47bfe6 | |||
| 0af452720e | |||
| db8e6fe7a7 | |||
| 631d7d0ce7 | |||
| ed345e5b65 | |||
| d3a66af7d6 | |||
| 52deff06ba | |||
| 838cbe1840 | |||
| 70804e2ba6 | |||
| 07c925223b | |||
| c2cbc62be6 | |||
| 9d74d42f2a | |||
| a36f25c7b2 | |||
| 86fb5412fa | |||
| c5b9ab3aca | |||
| bf6f43ec3a | |||
| 36159c2bd4 | |||
| 72e1d03860 | |||
| ed1b8f2545 | |||
| 1ad0f24ecd | |||
| 586440622b | |||
| 6231b07d2a | |||
| 1dcf5e4f85 | |||
| 9ba8f4795c | |||
| 951fe3491e | |||
| 6ae1f1b02c | |||
| 673e84920b | |||
| d1e1c14dc3 | |||
| 11db3151ae | |||
| 65f81aca0f | |||
| 187216096d | |||
| 3f9b699eef | |||
| 5f8564c655 | |||
| cbe0000d23 | |||
| 0e278d2299 | |||
| 21d725daa5 | |||
| 247e90b3d0 |
+10
-4
@@ -7,10 +7,16 @@ git submodule -q update --init --depth 1 $(awk '/path/ && !/llvm/ { print $3 }'
|
||||
|
||||
# Prefer newer Clang than in base system (see also .ci/install-freebsd.sh)
|
||||
# libc++ isn't in llvm* packages, so download manually
|
||||
fetch https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/libcxx-11.0.0.src.tar.xz
|
||||
tar xf libcxx-11.0.0.src.tar.xz
|
||||
export CC=clang11 CXX=clang++11
|
||||
export CXXFLAGS="$CXXFLAGS -nostdinc++ -isystem $PWD/libcxx-11.0.0.src/include"
|
||||
fetch https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-13.0.1-rc1.tar.gz
|
||||
tar xf llvm*.tar.gz
|
||||
export CC=clang13 CXX=clang++13
|
||||
cmake -B libcxx_build -G Ninja -S llvm*/libcxx \
|
||||
-DLLVM_CCACHE_BUILD=ON \
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=libcxx_prefix
|
||||
cmake --build libcxx_build
|
||||
cmake --install libcxx_build
|
||||
export CXXFLAGS="$CXXFLAGS -nostdinc++ -isystem$PWD/libcxx_prefix/include/c++/v1"
|
||||
export LDFLAGS="$LDFLAGS -nostdlib++ -L$PWD/libcxx_prefix/lib -l:libc++.a -lcxxrt"
|
||||
|
||||
CONFIGURE_ARGS="
|
||||
-DWITH_LLVM=OFF
|
||||
|
||||
+20
-15
@@ -1,11 +1,13 @@
|
||||
#!/bin/sh -ex
|
||||
|
||||
# Setup Qt variables
|
||||
export QT_BASE_DIR=/opt/qt${QTVERMIN}
|
||||
export PATH=$QT_BASE_DIR/bin:$PATH
|
||||
export LD_LIBRARY_PATH=$QT_BASE_DIR/lib/x86_64-linux-gnu:$QT_BASE_DIR/lib
|
||||
export QT_BASE_DIR=/opt/qt"${QTVERMIN}"
|
||||
export PATH="$QT_BASE_DIR"/bin:"$PATH"
|
||||
export LD_LIBRARY_PATH="$QT_BASE_DIR"/lib/x86_64-linux-gnu:"$QT_BASE_DIR"/lib
|
||||
|
||||
cd rpcs3 || exit 1
|
||||
if [ -z "$CIRRUS_CI" ]; then
|
||||
cd rpcs3 || exit 1
|
||||
fi
|
||||
|
||||
# Pull all the submodules except llvm, since it is built separately and we just download that build
|
||||
# Note: Tried to use git submodule status, but it takes over 20 seconds
|
||||
@@ -21,19 +23,19 @@ mkdir build && cd build || exit 1
|
||||
|
||||
if [ "$COMPILER" = "gcc" ]; then
|
||||
# These are set in the dockerfile
|
||||
export CC=${GCC_BINARY}
|
||||
export CXX=${GXX_BINARY}
|
||||
export CC="${GCC_BINARY}"
|
||||
export CXX="${GXX_BINARY}"
|
||||
export LINKER=gold
|
||||
# We need to set the following variables for LTO to link properly
|
||||
export AR=/usr/bin/gcc-ar-$GCCVER
|
||||
export RANLIB=/usr/bin/gcc-ranlib-$GCCVER
|
||||
export AR=/usr/bin/gcc-ar-"$GCCVER"
|
||||
export RANLIB=/usr/bin/gcc-ranlib-"$GCCVER"
|
||||
export CFLAGS="-fuse-linker-plugin"
|
||||
else
|
||||
export CC=${CLANG_BINARY}
|
||||
export CXX=${CLANGXX_BINARY}
|
||||
export CC="${CLANG_BINARY}"
|
||||
export CXX="${CLANGXX_BINARY}"
|
||||
export LINKER=lld
|
||||
export AR=/usr/bin/llvm-ar-$LLVMVER
|
||||
export RANLIB=/usr/bin/llvm-ranlib-$LLVMVER
|
||||
export AR=/usr/bin/llvm-ar-"$LLVMVER"
|
||||
export RANLIB=/usr/bin/llvm-ranlib-"$LLVMVER"
|
||||
fi
|
||||
|
||||
export CFLAGS="$CFLAGS -fuse-ld=${LINKER}"
|
||||
@@ -49,15 +51,18 @@ cmake .. \
|
||||
-DCMAKE_AR="$AR" \
|
||||
-DCMAKE_RANLIB="$RANLIB" \
|
||||
-DUSE_SYSTEM_CURL=ON \
|
||||
-DOpenGL_GL_PREFERENCE=LEGACY \
|
||||
-G Ninja
|
||||
|
||||
ninja; build_status=$?;
|
||||
|
||||
cd ..
|
||||
|
||||
# If it compiled succesfully let's deploy depending on the build pipeline (Azure Pipelines).
|
||||
# Azure publishes PRs as artifacts only.
|
||||
{ [ "$IS_AZURE" = "true" ];
|
||||
shellcheck .ci/*.sh
|
||||
|
||||
# If it compiled succesfully let's deploy.
|
||||
# Azure and Cirrus publish PRs as artifacts only.
|
||||
{ [ "$CI_HAS_ARTIFACTS" = "true" ];
|
||||
} && SHOULD_DEPLOY="true" || SHOULD_DEPLOY="false"
|
||||
|
||||
if [ "$build_status" -eq 0 ] && [ "$SHOULD_DEPLOY" = "true" ]; then
|
||||
|
||||
+33
-21
@@ -1,27 +1,39 @@
|
||||
#!/bin/sh -ex
|
||||
|
||||
export CCACHE_SLOPPINESS=pch_defines,time_macros
|
||||
export CMAKE_PREFIX_PATH=/usr/local/opt/qt5/
|
||||
export PATH="/usr/local/opt/ccache/libexec:$PATH"
|
||||
brew update
|
||||
brew install llvm@13 sdl2 nasm qt@5 ninja cmake glew git p7zip create-dmg ccache
|
||||
|
||||
# Setup vulkan and gfx-rs/portability
|
||||
curl -sLO https://github.com/gfx-rs/portability/releases/download/latest/gfx-portability-macos-latest.zip
|
||||
unzip -: gfx-portability-macos-latest.zip
|
||||
curl -sLO https://github.com/KhronosGroup/Vulkan-Headers/archive/sdk-1.1.106.0.zip
|
||||
unzip -: sdk-*.zip
|
||||
mkdir vulkan-sdk
|
||||
ln -s "${PWD}"/Vulkan-Headers*/include vulkan-sdk/include
|
||||
mkdir vulkan-sdk/lib
|
||||
cp target/release/libportability.dylib vulkan-sdk/lib/libVulkan.dylib
|
||||
# Let macdeployqt locate and install Vulkan library
|
||||
install_name_tool -id "${PWD}"/vulkan-sdk/lib/libVulkan.dylib vulkan-sdk/lib/libVulkan.dylib
|
||||
export VULKAN_SDK="${PWD}/vulkan-sdk"
|
||||
export MACOSX_DEPLOYMENT_TARGET=11.6
|
||||
export CXX=clang++
|
||||
export CC=clang
|
||||
export Qt5_DIR="/usr/local/opt/qt@5/lib/cmake/Qt5"
|
||||
export PATH="/usr/local/opt/llvm@13/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Apple/usr/bin"
|
||||
export LDFLAGS="-L/usr/local/opt/llvm@13/lib -Wl,-rpath,/usr/local/opt/llvm@13/lib"
|
||||
export CPPFLAGS="-I/usr/local/opt/llvm@13/include -msse -msse2 -mcx16 -no-pie"
|
||||
|
||||
# Pull all the submodules except llvm
|
||||
# Note: Tried to use git submodule status, but it takes over 20 seconds
|
||||
# shellcheck disable=SC2046
|
||||
git submodule -q update --init $(awk '/path/ && !/llvm/ { print $3 }' .gitmodules)
|
||||
git submodule update --init --recursive --depth 1
|
||||
|
||||
# 3rdparty fixes
|
||||
sed -i '' "s/extern const double NSAppKitVersionNumber;/const double NSAppKitVersionNumber = 1343;/g" 3rdparty/hidapi/hidapi/mac/hid.c
|
||||
|
||||
mkdir build && cd build || exit 1
|
||||
cmake .. -DWITH_LLVM=OFF -DUSE_NATIVE_INSTRUCTIONS=OFF -G Ninja
|
||||
ninja
|
||||
|
||||
cmake .. \
|
||||
-DUSE_DISCORD_RPC=OFF -DUSE_VULKAN=ON -DUSE_ALSA=OFF -DUSE_PULSE=OFF -DUSE_AUDIOUNIT=ON \
|
||||
-DLLVM_CCACHE_BUILD=OFF -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_BUILD_RUNTIME=OFF -DLLVM_BUILD_TOOLS=OFF \
|
||||
-DLLVM_INCLUDE_DOCS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_TOOLS=OFF \
|
||||
-DLLVM_INCLUDE_UTILS=OFF -DLLVM_USE_PERF=OFF -DLLVM_ENABLE_Z3_SOLVER=OFF \
|
||||
-DUSE_NATIVE_INSTRUCTIONS=OFF \
|
||||
-DUSE_SYSTEM_MVK=OFF \
|
||||
-G Ninja
|
||||
|
||||
ninja; build_status=$?;
|
||||
|
||||
cd ..
|
||||
|
||||
{ [ "$CI_HAS_ARTIFACTS" = "true" ];
|
||||
} && SHOULD_DEPLOY="true" || SHOULD_DEPLOY="false"
|
||||
|
||||
if [ "$build_status" -eq 0 ] && [ "$SHOULD_DEPLOY" = "true" ]; then
|
||||
.ci/deploy-mac.sh
|
||||
fi
|
||||
+15
-9
@@ -12,13 +12,17 @@ if [ "$DEPLOY_APPIMAGE" = "true" ]; then
|
||||
./squashfs-root/AppRun ./appdir/usr/share/applications/*.desktop -bundle-non-qt-libs
|
||||
ls ./appdir/usr/lib/
|
||||
rm -r ./appdir/usr/share/doc
|
||||
rm ./appdir/usr/lib/libxcb*
|
||||
cp "$(readlink -f /lib/x86_64-linux-gnu/libnsl.so.1)" ./appdir/usr/lib/libnsl.so.1
|
||||
export PATH=/rpcs3/build/squashfs-root/usr/bin/:${PATH}
|
||||
export PATH=/rpcs3/build/squashfs-root/usr/bin/:"${PATH}"
|
||||
|
||||
# Embed newer libstdc++ for distros that don't come with it (ubuntu 16.04)
|
||||
mkdir -p appdir/usr/optional/ ; mkdir -p appdir/usr/optional/libstdc++/
|
||||
cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 ./appdir/usr/optional/libstdc++/
|
||||
|
||||
# Remove libwayland-client because it has platform-dependent exports and breaks other OSes
|
||||
rm -f ./appdir/usr/lib/libwayland-client.so*
|
||||
|
||||
# Install latest appimage runner
|
||||
rm ./appdir/AppRun
|
||||
curl -sL https://github.com/RPCS3/AppImageKit-checkrt/releases/download/continuous2/AppRun-patched-x86_64 -o ./appdir/AppRun
|
||||
chmod a+x ./appdir/AppRun
|
||||
@@ -29,28 +33,30 @@ if [ "$DEPLOY_APPIMAGE" = "true" ]; then
|
||||
# This may need updating if you update the compiler or rpcs3 uses newer c++ features
|
||||
# See https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/config/abi/pre/gnu.ver
|
||||
# for which definitions correlate to which CXXABI version.
|
||||
# Currently we target a minimum of GLIBCXX_3.4.26 and CXXABI_1.3.11
|
||||
printf "#include <bits/stdc++.h>\nint main(){std::make_exception_ptr(0);std::pmr::get_default_resource();}" | $CXX -x c++ -std=c++2a -o ./appdir/usr/optional/checker -
|
||||
# Currently we target a minimum of GLIBCXX_3.4.29 and CXXABI_1.3.11
|
||||
printf "#include <sstream>\n#include <exception>\n#include <memory_resource>\nint main(){auto x = std::stringbuf();x.get_allocator();std::make_exception_ptr(0);std::pmr::get_default_resource();}" \
|
||||
| $CXX -x c++ -std=c++2a -o ./appdir/usr/optional/checker -
|
||||
|
||||
# Package it up and send it off
|
||||
./squashfs-root/usr/bin/appimagetool /rpcs3/build/appdir
|
||||
./squashfs-root/usr/bin/appimagetool "$APPDIR"
|
||||
|
||||
ls
|
||||
|
||||
COMM_TAG="$(grep 'version{.*}' ../rpcs3/rpcs3_version.cpp | awk -F[\{,] '{printf "%d.%d.%d", $2, $3, $4}')"
|
||||
COMM_TAG=$(awk '/version{.*}/ { printf("%d.%d.%d", $5, $6, $7) }' ../rpcs3/rpcs3_version.cpp)
|
||||
COMM_COUNT="$(git rev-list --count HEAD)"
|
||||
COMM_HASH="$(git rev-parse --short=8 HEAD)"
|
||||
RPCS3_APPIMAGE="rpcs3-v${COMM_TAG}-${COMM_COUNT}-${COMM_HASH}_linux64.AppImage"
|
||||
|
||||
mv ./RPCS3*.AppImage "$RPCS3_APPIMAGE"
|
||||
|
||||
# If we're building using Azure Pipelines, let's copy over the AppImage artifact
|
||||
# If we're building using a CI, let's copy over the AppImage artifact
|
||||
if [ -n "$BUILD_ARTIFACTSTAGINGDIRECTORY" ]; then
|
||||
cp "$RPCS3_APPIMAGE" ~/artifacts
|
||||
cp "$RPCS3_APPIMAGE" "$ARTDIR"
|
||||
fi
|
||||
|
||||
FILESIZE=$(stat -c %s ./rpcs3*.AppImage)
|
||||
SHA256SUM=$(sha256sum ./rpcs3*.AppImage | awk '{ print $1 }')
|
||||
echo "${SHA256SUM};${FILESIZE}B" > /rpcs3/GitHubReleaseMessage.txt
|
||||
echo "${SHA256SUM};${FILESIZE}B" > "$RELEASE_MESSAGE"
|
||||
|
||||
fi
|
||||
|
||||
|
||||
Executable
+56
@@ -0,0 +1,56 @@
|
||||
#!/bin/sh -ex
|
||||
|
||||
cd build || exit 1
|
||||
|
||||
# Gather explicit version number and number of commits
|
||||
COMM_TAG=$(awk '/version{.*}/ { printf("%d.%d.%d", $5, $6, $7) }' ../rpcs3/rpcs3_version.cpp)
|
||||
COMM_COUNT=$(git rev-list --count HEAD)
|
||||
COMM_HASH=$(git rev-parse --short=8 HEAD)
|
||||
|
||||
AVVER="${COMM_TAG}-${COMM_COUNT}"
|
||||
|
||||
# AVVER is used for GitHub releases, it is the version number.
|
||||
echo "AVVER=$AVVER" >> ../.ci/ci-vars.env
|
||||
|
||||
cd bin
|
||||
mkdir "rpcs3.app/Contents/lib/"
|
||||
cp "/usr/local/opt/llvm@13/lib/c++/libc++abi.1.0.dylib" "rpcs3.app/Contents/lib/libc++abi.1.dylib"
|
||||
rm -rf "rpcs3.app/Contents/Frameworks/QtPdf.framework" \
|
||||
"rpcs3.app/Contents/Frameworks/QtQml.framework" \
|
||||
"rpcs3.app/Contents/Frameworks/QtQmlModels.framework" \
|
||||
"rpcs3.app/Contents/Frameworks/QtQuick.framework" \
|
||||
"rpcs3.app/Contents/Frameworks/QtVirtualKeyboard.framework" \
|
||||
"rpcs3.app/Contents/Plugins/platforminputcontexts" \
|
||||
"rpcs3.app/Contents/Plugins/virtualkeyboard"
|
||||
|
||||
# Need to do this rename hack due to case insensitive filesystem
|
||||
mv rpcs3.app RPCS3_.app
|
||||
mv RPCS3_.app RPCS3.app
|
||||
|
||||
echo "[InternetShortcut]" > Quickstart.url
|
||||
echo "URL=https://rpcs3.net/quickstart" >> Quickstart.url
|
||||
echo "IconIndex=0" >> Quickstart.url
|
||||
|
||||
DMG_FILEPATH="$BUILD_ARTIFACTSTAGINGDIRECTORY/rpcs3-v${COMM_TAG}-${COMM_COUNT}-${COMM_HASH}_macos.dmg"
|
||||
|
||||
create-dmg --volname RPCS3 \
|
||||
--window-size 800 400 \
|
||||
--icon-size 100 \
|
||||
--icon rpcs3.app 200 190 \
|
||||
--add-file Quickstart.url Quickstart.url 400 20 \
|
||||
--hide-extension rpcs3.app \
|
||||
--hide-extension Quickstart.url \
|
||||
--app-drop-link 600 185 \
|
||||
--skip-jenkins \
|
||||
"$DMG_FILEPATH" \
|
||||
RPCS3.app
|
||||
|
||||
7z a -mx9 rpcs3-v"${COMM_TAG}"-"${COMM_COUNT}"-"${COMM_HASH}"_macos.7z RPCS3.app
|
||||
|
||||
FILESIZE=$(stat -f %z "$DMG_FILEPATH")
|
||||
SHA256SUM=$(shasum -a 256 "$DMG_FILEPATH" | awk '{ print $1 }')
|
||||
cd ..
|
||||
echo "${SHA256SUM};${FILESIZE}B" > "$RELEASE_MESSAGE"
|
||||
cd bin
|
||||
|
||||
mv ./rpcs3*_macos.7z "$ARTDIR"
|
||||
@@ -4,7 +4,7 @@
|
||||
ARTIFACT_DIR="$BUILD_ARTIFACTSTAGINGDIRECTORY"
|
||||
|
||||
# Remove unecessary files
|
||||
rm -f ./bin/rpcs3.exp ./bin/rpcs3.lib ./bin/rpcs3.pdb
|
||||
rm -f ./bin/rpcs3.exp ./bin/rpcs3.lib ./bin/rpcs3.pdb ./bin/vc_redist.x64.exe
|
||||
|
||||
# Prepare compatibility database for packaging, as well as
|
||||
# certificate for ssl (auto-updater)
|
||||
@@ -20,5 +20,5 @@ sha256sum "$BUILD" | awk '{ print $1 }' | tee "$BUILD.sha256"
|
||||
echo "$(cat "$BUILD.sha256");$(stat -c %s "$BUILD")B" > GitHubReleaseMessage.txt
|
||||
|
||||
# Move files to publishing directory
|
||||
mv -- "$BUILD" "$ARTIFACT_DIR"
|
||||
mv -- "$BUILD.sha256" "$ARTIFACT_DIR"
|
||||
cp -- "$BUILD" "$ARTIFACT_DIR"
|
||||
cp -- "$BUILD.sha256" "$ARTIFACT_DIR"
|
||||
|
||||
+4
-1
@@ -1,10 +1,13 @@
|
||||
# Variables set by Azure Pipelines
|
||||
IS_AZURE
|
||||
CI_HAS_ARTIFACTS
|
||||
BUILD_REASON
|
||||
BUILD_SOURCEVERSION
|
||||
BUILD_ARTIFACTSTAGINGDIRECTORY
|
||||
BUILD_REPOSITORY_NAME
|
||||
BUILD_SOURCEBRANCHNAME
|
||||
APPDIR
|
||||
ARTDIR
|
||||
RELEASE_MESSAGE
|
||||
# Variables for build matrix
|
||||
COMPILER
|
||||
DEPLOY_APPIMAGE
|
||||
|
||||
@@ -10,4 +10,4 @@ while IFS='=' read -r key val; do
|
||||
# Skip over lines containing comments.
|
||||
[ "${key##\#*}" ] || continue
|
||||
echo "##vso[task.setvariable variable=$key]$val"
|
||||
done < ".ci/azure-vars.env"
|
||||
done < ".ci/ci-vars.env"
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
# Export variables for later stages of the Cirrus pipeline
|
||||
# Values done in this manner will appear as environment variables
|
||||
# in later stages.
|
||||
|
||||
# From pure-sh-bible
|
||||
# Setting 'IFS' tells 'read' where to split the string.
|
||||
while IFS='=' read -r key val; do
|
||||
# Skip over lines containing comments.
|
||||
[ "${key##\#*}" ] || continue
|
||||
export "$key"="$val"
|
||||
done < ".ci/ci-vars.env"
|
||||
@@ -24,7 +24,7 @@ curl -s \
|
||||
cat release.json
|
||||
id=$(grep '"id"' release.json | cut -d ':' -f2 | head -n1 | awk '{$1=$1;print}')
|
||||
id=${id%?}
|
||||
echo ${id:?}
|
||||
echo "${id:?}"
|
||||
|
||||
upload_file()
|
||||
{
|
||||
|
||||
@@ -9,10 +9,10 @@ export ASSUME_ALWAYS_YES=true
|
||||
pkg info # debug
|
||||
|
||||
# Prefer newer Clang than in base system (see also .ci/build-freebsd.sh)
|
||||
pkg install llvm11
|
||||
pkg install llvm13
|
||||
|
||||
# Mandatory dependencies (qt5-dbus and qt5-gui are pulled via qt5-widgets)
|
||||
pkg install git ccache cmake ninja qt5-qmake qt5-buildtools qt5-widgets qt5-concurrent glew openal-soft ffmpeg
|
||||
pkg install git ccache cmake ninja qt5-qmake qt5-buildtools qt5-widgets qt5-concurrent qt5-multimedia qt5-svg glew openal-soft ffmpeg
|
||||
|
||||
# Optional dependencies (libevdev is pulled by qt5-gui)
|
||||
pkg install pkgconf alsa-lib pulseaudio sdl2 evdev-proto vulkan-headers vulkan-loader
|
||||
|
||||
+14
-10
@@ -7,25 +7,29 @@ PR_NUMBER="$SYSTEM_PULLREQUEST_PULLREQUESTID"
|
||||
|
||||
# Resource/dependency URLs
|
||||
# Qt mirrors can be volatile and slow, so we list 2
|
||||
QT_HOST="http://mirrors.ocf.berkeley.edu/qt/"
|
||||
#QT_HOST="http://qt.mirror.constant.com/"
|
||||
#QT_HOST="http://mirrors.ocf.berkeley.edu/qt/"
|
||||
QT_HOST="http://qt.mirror.constant.com/"
|
||||
QT_URL_VER=$(echo "$QT_VER" | sed "s/\.//g")
|
||||
QT_VER_MSVC_UP=$(echo ${QT_VER_MSVC} | tr '[:lower:]' '[:upper:]')
|
||||
QT_VER_MSVC_UP=$(echo "${QT_VER_MSVC}" | tr '[:lower:]' '[:upper:]')
|
||||
QT_PREFIX="online/qtsdkrepository/windows_x86/desktop/qt${QT_VER_MAIN}_${QT_URL_VER}/qt.qt${QT_VER_MAIN}.${QT_URL_VER}.win64_${QT_VER_MSVC}_64/${QT_VER}-0-${QT_DATE}"
|
||||
QT_SUFFIX="-Windows-Windows_10-${QT_VER_MSVC_UP}-Windows-Windows_10-X86_64.7z"
|
||||
QT_BASE_URL="${QT_HOST}${QT_PREFIX}qtbase${QT_SUFFIX}"
|
||||
QT_WINE_URL="${QT_HOST}${QT_PREFIX}qtwinextras${QT_SUFFIX}"
|
||||
QT_DECL_URL="${QT_HOST}${QT_PREFIX}qtdeclarative${QT_SUFFIX}"
|
||||
QT_TOOL_URL="${QT_HOST}${QT_PREFIX}qttools${QT_SUFFIX}"
|
||||
QT_MM_URL="${QT_HOST}${QT_PREFIX}qtmultimedia${QT_SUFFIX}"
|
||||
QT_SVG_URL="${QT_HOST}${QT_PREFIX}qtsvg${QT_SUFFIX}"
|
||||
LLVMLIBS_URL='https://github.com/RPCS3/llvm-mirror/releases/download/custom-build-win/llvmlibs_mt.7z'
|
||||
GLSLANG_URL='https://github.com/RPCS3/glslang/releases/download/custom-build-win/glslanglibs_mt.7z'
|
||||
VULKAN_SDK_URL="https://www.dropbox.com/s/kn005de7gsv5whe/VulkanSDK-1.2.154.1-Installer.exe"
|
||||
VULKAN_SDK_URL="https://www.dropbox.com/s/o918fc11pfk8x9c/VulkanSDK-${VULKAN_VER}-Installer.exe"
|
||||
|
||||
DEP_URLS=" \
|
||||
$QT_BASE_URL \
|
||||
$QT_WINE_URL \
|
||||
$QT_DECL_URL \
|
||||
$QT_TOOL_URL \
|
||||
$QT_MM_URL \
|
||||
$QT_SVG_URL \
|
||||
$LLVMLIBS_URL \
|
||||
$GLSLANG_URL \
|
||||
$VULKAN_SDK_URL"
|
||||
@@ -36,7 +40,7 @@ DEP_URLS=" \
|
||||
# Pull all the submodules except llvm, since it is built separately and we just download that build
|
||||
# Note: Tried to use git submodule status, but it takes over 20 seconds
|
||||
# shellcheck disable=SC2046
|
||||
git submodule -q update --init --depth 1 $(awk '/path/ && !/llvm/ { print $3 }' .gitmodules)
|
||||
git submodule -q update --init --depth=1 --jobs=8 $(awk '/path/ && !/llvm/ { print $3 }' .gitmodules)
|
||||
|
||||
# Git bash doesn't have rev, so here it is
|
||||
rev()
|
||||
@@ -76,13 +80,13 @@ for url in $DEP_URLS; do
|
||||
case "$url" in
|
||||
*qt*) checksum=$(curl -L "${url}.sha1"); algo="sha1"; outDir='C:\Qt\' ;;
|
||||
*llvm*) checksum=$(curl -L "${url}.sha256"); algo="sha256"; outDir="." ;;
|
||||
*glslang*) checksum=$(curl -L "${url}.sha256"); algo="sha256"; outDir="./lib/Release - LLVM-x64" ;;
|
||||
*glslang*) checksum=$(curl -L "${url}.sha256"); algo="sha256"; outDir="./lib/Release-x64" ;;
|
||||
*Vulkan*)
|
||||
# Vulkan setup needs to be run in batch environment
|
||||
# Need to subshell this or else it doesn't wait
|
||||
download_and_verify "$url" "$VULKAN_SDK_SHA" "sha256" "$fileName"
|
||||
cp "$CACHE_DIR/$fileName" .
|
||||
_=$(echo "$fileName /S" | cmd)
|
||||
_=$(echo "$fileName --accept-licenses --default-answer --confirm-command install" | cmd)
|
||||
continue
|
||||
;;
|
||||
*) echo "Unknown url resource: $url"; exit 1 ;;
|
||||
@@ -110,6 +114,6 @@ fi
|
||||
# BUILD is the name of the release artifact
|
||||
# AVVER is used for GitHub releases, it is the version number.
|
||||
BRANCH="${REPO_NAME}/${REPO_BRANCH}"
|
||||
echo "BRANCH=$BRANCH" > .ci/azure-vars.env
|
||||
echo "BUILD=$BUILD" >> .ci/azure-vars.env
|
||||
echo "AVVER=$AVVER" >> .ci/azure-vars.env
|
||||
echo "BRANCH=$BRANCH" > .ci/ci-vars.env
|
||||
echo "BUILD=$BUILD" >> .ci/ci-vars.env
|
||||
echo "AVVER=$AVVER" >> .ci/ci-vars.env
|
||||
|
||||
+134
-4
@@ -1,11 +1,114 @@
|
||||
env:
|
||||
CIRRUS_CLONE_DEPTH: 0 # Unshallow clone to obtain proper GIT_VERSION
|
||||
BUILD_REPOSITORY_NAME: $CIRRUS_REPO_FULL_NAME
|
||||
SYSTEM_PULLREQUEST_SOURCEBRANCH: $CIRRUS_BRANCH
|
||||
SYSTEM_PULLREQUEST_PULLREQUESTID: $CIRRUS_PR
|
||||
BUILD_SOURCEVERSION: $CIRRUS_CHANGE_IN_REPO
|
||||
BUILD_SOURCEBRANCHNAME: $CIRRUS_BRANCH
|
||||
RPCS3_TOKEN: ENCRYPTED[!a4c3850e29ab150692286a74bec29819d25971a7ec431b86de2a35f7ed90c5b2ab3c93469f9298e30924d843599110e9!]
|
||||
|
||||
windows_task:
|
||||
matrix:
|
||||
- name: Cirrus Windows
|
||||
windows_container:
|
||||
image: cirrusci/windowsservercore:visualstudio2019
|
||||
cpu: 8
|
||||
memory: 16G
|
||||
env:
|
||||
CIRRUS_SHELL: "bash"
|
||||
COMPILER: msvc
|
||||
QT_VER_MAIN: '5'
|
||||
BUILD_ARTIFACTSTAGINGDIRECTORY: ${CIRRUS_WORKING_DIR}\artifacts\
|
||||
QT_VER: '5.15.2'
|
||||
QT_VER_MSVC: 'msvc2019'
|
||||
QT_DATE: '202011130602'
|
||||
QTDIR: C:\Qt\${QT_VER}\${QT_VER_MSVC}_64
|
||||
VULKAN_VER: '1.3.204.0'
|
||||
VULKAN_SDK_SHA: '41f4996335cc5a545d7b2f6e5ff29cf3867789aae4be053a7069aa93408861fa'
|
||||
VULKAN_SDK: C:\VulkanSDK\${VULKAN_VER}
|
||||
CACHE_DIR: "./cache"
|
||||
UPLOAD_COMMIT_HASH: 7d09e3be30805911226241afbb14f8cdc2eb054e
|
||||
UPLOAD_REPO_FULL_NAME: "rpcs3/rpcs3-binaries-win"
|
||||
deps_cache:
|
||||
folder: "./cache"
|
||||
#obj_cache:
|
||||
# folder: "./tmp"
|
||||
#obj2_cache:
|
||||
# folder: "./rpcs3/x64"
|
||||
setup_script:
|
||||
- './.ci/get_keys-windows.sh'
|
||||
- './.ci/setup-windows.sh'
|
||||
# - choco install -y python # Needed for SPIRV, use either this or make a new Docker image
|
||||
# spirv_script:
|
||||
# - export PATH=${PATH}:"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin"
|
||||
# - cd "${CIRRUS_WORKING_DIR}/3rdparty/SPIRV"
|
||||
# - msbuild.exe spirv.vcxproj //p:Configuration=Release //m
|
||||
rpcs3_script:
|
||||
- export PATH=${PATH}:"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin"
|
||||
- msbuild.exe rpcs3.sln //p:Configuration=Release //m
|
||||
deploy_script:
|
||||
- mkdir artifacts
|
||||
- source './.ci/export-cirrus-vars.sh'
|
||||
- './.ci/deploy-windows.sh'
|
||||
artifacts:
|
||||
name: Artifact
|
||||
path: "*.7z*"
|
||||
push_script: |
|
||||
if [ "$CIRRUS_REPO_OWNER" = "RPCS3" ] && [ -z "$CIRRUS_PR" ] && [ "$CIRRUS_BRANCH" = "master" ]; then
|
||||
source './.ci/export-cirrus-vars.sh'
|
||||
'./.ci/github-upload.sh'
|
||||
fi;
|
||||
|
||||
linux_task:
|
||||
container:
|
||||
image: rpcs3/rpcs3-ci-bionic:1.5
|
||||
cpu: 4
|
||||
memory: 16G
|
||||
env:
|
||||
BUILD_ARTIFACTSTAGINGDIRECTORY: ${CIRRUS_WORKING_DIR}/artifacts
|
||||
ARTDIR: ${CIRRUS_WORKING_DIR}/artifacts/
|
||||
CCACHE_DIR: "/tmp/ccache_dir"
|
||||
CCACHE_MAXSIZE: 300M
|
||||
CI_HAS_ARTIFACTS: true
|
||||
UPLOAD_COMMIT_HASH: d812f1254a1157c80fd402f94446310560f54e5f
|
||||
UPLOAD_REPO_FULL_NAME: "rpcs3/rpcs3-binaries-linux"
|
||||
DEPLOY_APPIMAGE: true
|
||||
APPDIR: "./appdir"
|
||||
RELEASE_MESSAGE: "../GitHubReleaseMessage.txt"
|
||||
ccache_cache:
|
||||
folder: "/tmp/ccache_dir"
|
||||
matrix:
|
||||
- name: Cirrus Linux GCC
|
||||
env:
|
||||
COMPILER: gcc
|
||||
gcc_script:
|
||||
- mkdir artifacts
|
||||
- ".ci/build-linux.sh"
|
||||
- name: Cirrus Linux Clang
|
||||
env:
|
||||
COMPILER: clang
|
||||
clang_script:
|
||||
- mkdir artifacts
|
||||
- ".ci/build-linux.sh"
|
||||
artifacts:
|
||||
name: Artifact
|
||||
path: "artifacts/*"
|
||||
push_script: |
|
||||
if [ "$CIRRUS_REPO_OWNER" = "RPCS3" ] && [ -z "$CIRRUS_PR" ] && [ "$CIRRUS_BRANCH" = "master" ] && [ "$COMPILER" = "gcc" ]; then
|
||||
COMM_TAG=$(awk '/version{.*}/ { printf("%d.%d.%d", $5, $6, $7) }' ./rpcs3/rpcs3_version.cpp)
|
||||
COMM_COUNT=$(git rev-list --count HEAD)
|
||||
COMM_HASH=$(git rev-parse --short=8 HEAD)
|
||||
|
||||
export AVVER="${COMM_TAG}-${COMM_COUNT}"
|
||||
|
||||
.ci/github-upload.sh
|
||||
fi;
|
||||
|
||||
freebsd_task:
|
||||
matrix:
|
||||
- name: FreeBSD 12.2
|
||||
- name: Cirrus FreeBSD
|
||||
freebsd_instance:
|
||||
image_family: freebsd-12-2
|
||||
image_family: freebsd-13-1
|
||||
cpu: 8
|
||||
memory: 8G
|
||||
env:
|
||||
@@ -13,7 +116,34 @@ freebsd_task:
|
||||
CCACHE_DIR: /tmp/ccache_dir
|
||||
ccache_cache:
|
||||
folder: /tmp/ccache_dir
|
||||
packages_cache:
|
||||
folder: /var/cache/pkg
|
||||
install_script: "sh -ex ./.ci/install-freebsd.sh"
|
||||
script: "./.ci/build-freebsd.sh"
|
||||
|
||||
macos_task:
|
||||
timeout_in: 120m
|
||||
ccache_cache:
|
||||
folder: /tmp/ccache_dir
|
||||
matrix:
|
||||
- name: Cirrus macOS
|
||||
osx_instance:
|
||||
image: monterey-xcode-13.3
|
||||
mac_script:
|
||||
- mkdir artifacts
|
||||
- ".ci/build-mac.sh"
|
||||
env:
|
||||
BUILD_ARTIFACTSTAGINGDIRECTORY: ${CIRRUS_WORKING_DIR}/artifacts
|
||||
ARTDIR: ${CIRRUS_WORKING_DIR}/artifacts/
|
||||
CCACHE_DIR: "/tmp/ccache_dir"
|
||||
CCACHE_MAXSIZE: 300M
|
||||
CI_HAS_ARTIFACTS: true
|
||||
UPLOAD_COMMIT_HASH: 51ae32f468089a8169aaf1567de355ff4a3e0842
|
||||
UPLOAD_REPO_FULL_NAME: "rpcs3/rpcs3-binaries-mac"
|
||||
RELEASE_MESSAGE: "../GitHubReleaseMessage.txt"
|
||||
artifacts:
|
||||
name: Artifact
|
||||
path: "artifacts/rpcs3-*_macos.*"
|
||||
push_script: |
|
||||
if [ "$CIRRUS_REPO_OWNER" = "RPCS3" ] && [ -z "$CIRRUS_PR" ] && [ "$CIRRUS_BRANCH" = "master" ]; then
|
||||
source './.ci/export-cirrus-vars.sh'
|
||||
.ci/github-upload.sh
|
||||
fi;
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
Standard: c++20
|
||||
UseTab: ForIndentation
|
||||
UseTab: AlignWithSpaces
|
||||
TabWidth: 4
|
||||
IndentWidth: 4
|
||||
AccessModifierOffset: -4
|
||||
@@ -16,11 +16,12 @@ AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortCaseLabelsOnASingleLine: true
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AllowShortLambdasOnASingleLine: Empty
|
||||
Cpp11BracedListStyle: true
|
||||
IndentCaseLabels: false
|
||||
SortIncludes: false
|
||||
ReflowComments: true
|
||||
AlignConsecutiveAssignments: true
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignTrailingComments: true
|
||||
AlignAfterOpenBracket: DontAlign
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Getting Started
|
||||
|
||||
Before getting started using the emulator, read the [Quickstart Guide](https://rpcs3.net/quickstart) and the [FAQ](https://rpcs3.net/faq). After reading those, if you need support, visit our [Forums](https://forums.rpcs3.net).
|
||||
Before getting started using the emulator, read the [Quickstart Guide](https://rpcs3.net/quickstart). After reading it, if you need support, check out [How to ask for Support](https://github.com/RPCS3/rpcs3/wiki/How-to-ask-for-Support).
|
||||
|
||||
# Issue Reporting
|
||||
|
||||
@@ -8,13 +8,12 @@ Before getting started using the emulator, read the [Quickstart Guide](https://r
|
||||
|
||||
**Before reporting an issue:**
|
||||
- Check if your system matches all the minimum requirements listed in the [Quickstart Guide](https://rpcs3.net/quickstart);
|
||||
- Check if the issue is meaningful for the team (e.g. The Last of Us doesn't work is obvious and therefore useless);
|
||||
- Search older issues/forum threads to see if your issue was already submitted.
|
||||
- Use understandable English. It doesn't need to be perfect, but clear enough to understand your message.
|
||||
- While reporting issues, don't forget to include details about your system (OS, CPU, GPU, etc.), as well as the RPCS3.log file.
|
||||
- Search older issues/forum threads to see if your issue was already submitted;
|
||||
- Use understandable English. It doesn't need to be perfect, but clear enough to understand your message;
|
||||
- While reporting issues, please follow the template for the type of issue you've selected (Regression Report, Bug Report or Feature Request), which is prefilled on the issue's textbox.
|
||||
|
||||
Submitting your test results for Commercial Games must be done on our forums. Please read the [Game Compatibility](https://github.com/RPCS3/rpcs3/wiki/Game-Compatibility) wiki page before doing so.
|
||||
|
||||
# Contributing
|
||||
|
||||
Check the [Coding Style Guidelines](https://github.com/RPCS3/rpcs3/wiki/Coding-Style), [Roadmap](https://github.com/RPCS3/rpcs3/wiki/Roadmap) and [Developer Information](https://github.com/RPCS3/rpcs3/wiki/Developer-Information). If you have any questions, hit us up on our [Discord Server](https://discord.me/RPCS3) in the **#development** channel.
|
||||
Check the [Coding Style Guidelines](https://github.com/RPCS3/rpcs3/wiki/Coding-Style) and [Developer Information](https://github.com/RPCS3/rpcs3/wiki/Developer-Information). If you have any questions, hit us up on our [Discord Server](https://discord.me/RPCS3) in the **#development** channel.
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
---
|
||||
name: Regression report
|
||||
about: If something used to work before, but now it doesn't
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
## Please do not ask for help or report compatibility regressions here, use [RPCS3 Discord server](https://discord.me/RPCS3) or [forums](https://forums.rpcs3.net/) instead.
|
||||
|
||||
## Quick summary
|
||||
Please briefly describe what has stopped working correctly.
|
||||
|
||||
## Details
|
||||
Please describe the regression as accurately as possible.
|
||||
|
||||
#### 1. Please provide _exact_ build (or commit) information that introduced the regression you're reporting.
|
||||
* Please see [How to find the build that caused a regression](https://wiki.rpcs3.net/index.php?title=Help:Using_different_versions_of_RPCS3#How_to_find_the_build_that_caused_a_regression.3F) in our wiki.
|
||||
* You can find [History of RPCS3 builds](https://rpcs3.net/compatibility?b) here.
|
||||
|
||||
#### 2. Please attach TWO logs:
|
||||
* One for the build with regression.
|
||||
* One for the build that works as expected.
|
||||
|
||||
##### How to obtain RPCS3's log:
|
||||
* Run the game until you find the regression.
|
||||
* Completely close RPCS3, or move to the next step in case it has crashed.
|
||||
* Locate RPCS3's log file:
|
||||
+ ```RPCS3.log``` (It can show up as just RPCS3 and have a notepad icon)
|
||||
or
|
||||
+ ```RPCS3.log.gz``` (It can show up as RPCS3.log and have a zip or rar icon)
|
||||

|
||||
On Linux it will be in ```~/.cache/rpcs3/```.
|
||||
On Windows it will be near the executable.
|
||||
* Attach the log:
|
||||
+ Drag and drop your log file into the issue.
|
||||
+ Or upload it to the cloud, such as Dropbox, Mega etc.
|
||||
|
||||
#### 3. If you describe graphical regression, please provide an RSX capture and a RenderDoc capture that demonstrate it.
|
||||
* To create an RSX capture, use _Create_ _RSX_ _Capture_ under _Utilities_.
|
||||
Captures will be stored in RPCS3 folder → captures.
|
||||
+ Compress your capture with 7z, Rar etc.
|
||||
And drag and drop it into the issue.
|
||||
+ Or upload it to the cloud, such as Dropbox, Mega etc.
|
||||
* To create a RenderDoc capture, please refer to [RenderDoc's documentation](https://renderdoc.org/docs/how/how_capture_frame.html).
|
||||
|
||||
#### 4. Please attach screenshots of your problem.
|
||||
* Enable performance overlay with at least medium level of detail.
|
||||
You can find it in _Emulator_ tab in _Settings_.
|
||||
|
||||
#### 5. Please provide comparison with real PS3.
|
||||
|
||||
#### 6. Please provide your system configuration:
|
||||
* OS
|
||||
* CPU
|
||||
* GPU
|
||||
* Driver version
|
||||
* etc.
|
||||
|
||||
#### Please include.
|
||||
* Anything else you deem to be important
|
||||
@@ -0,0 +1,93 @@
|
||||
name: Regression report
|
||||
description: If something used to work before, but now it doesn't
|
||||
title: "[Regression] Enter a title here"
|
||||
labels: []
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
# Summary
|
||||
Please do not ask for help or report compatibility regressions here, use [RPCS3 Discord server](https://discord.me/RPCS3) or [forums](https://forums.rpcs3.net/) instead.
|
||||
- type: textarea
|
||||
id: quick-summary
|
||||
attributes:
|
||||
label: Quick summary
|
||||
description: Please briefly describe what has stopped working correctly.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: details
|
||||
attributes:
|
||||
label: Details
|
||||
description: Please describe the regression as accurately as possible. Include screenshots if neccessary.
|
||||
validations:
|
||||
required: false
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
# Identify the regressed build
|
||||
Please provide the _exact_ build (or commit) information that introduced the regression you're reporting.
|
||||
* Please see [How to find the build that caused a regression](https://wiki.rpcs3.net/index.php?title=Help:Using_different_versions_of_RPCS3#How_to_find_the_build_that_caused_a_regression.3F) in our wiki.
|
||||
* You can find [History of RPCS3 builds](https://rpcs3.net/compatibility?b) here.
|
||||
|
||||
Make sure you're running with settings as close to default as possible
|
||||
* **Do NOT enable any emulator game patches when reporting issues**
|
||||
* Only change settings that are required for the game to work
|
||||
- type: input
|
||||
id: regressed-build
|
||||
attributes:
|
||||
label: Build with regression
|
||||
description: Provide _exact_ build (or commit) information that introduced the regression you're reporting.
|
||||
placeholder: v0.0.23-13948-31df99f7
|
||||
validations:
|
||||
required: true
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
# Log files
|
||||
Obtaining the log file:
|
||||
* Run the game until you find the regression.
|
||||
* Completely close RPCS3 and locate the log file.
|
||||
|
||||
RPCS3's Log file will be ```RPCS3.log.gz``` (sometimes shows as RPCS3.log with zip icon) or ```RPCS3.log``` (sometimes shows as RPCS3 wtih notepad icon).
|
||||
* On Windows it will be in the RPCS3 directory near the executable
|
||||
* On Linux it will be in ```~/.cache/rpcs3/```
|
||||
* On MacOS it will be in ```~/Library/Caches/rpcs3```. If you're unable to locate it copy paste the path in Spotlight and hit enter.
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Attach two log files
|
||||
description: |
|
||||
Attach one file for the build with regression and another for a build that works.
|
||||
Drag & drop the files into this input field, or upload them to another service (f.ex. Dropbox, Mega) and provide a link.
|
||||
validations:
|
||||
required: true
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
# Other details
|
||||
If you describe a graphical regression, please provide an RSX capture and/or a RenderDoc capture that demonstrate it.
|
||||
* To create an RSX capture, use _Create_ _RSX_ _Capture_ under _Utilities_.
|
||||
* Captures will be stored in RPCS3 folder → captures.
|
||||
* To create a RenderDoc capture, please refer to [RenderDoc's documentation](https://renderdoc.org/docs/how/how_capture_frame.html).
|
||||
- type: textarea
|
||||
id: captures
|
||||
attributes:
|
||||
label: Attach capture files for visual issues
|
||||
description: Compress your capture with 7z, Rar etc. and attach it here, or upload it to the cloud (Dropbox, Mega etc) and add a link to it.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: system-info
|
||||
attributes:
|
||||
label: System configuration
|
||||
description: Provide information about your system, such as operating system, CPU and GPU model, GPU driver version and other information that describes your system configuration.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: other-details
|
||||
attributes:
|
||||
label: Other details
|
||||
description: Include anything else you deem to be important.
|
||||
validations:
|
||||
required: false
|
||||
@@ -1,55 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: If something doesn't work correctly in RPCS3
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
## Please do not ask for help or report compatibility regressions here, use [RPCS3 Discord server](https://discord.me/RPCS3) or [forums](https://forums.rpcs3.net/) instead.
|
||||
|
||||
## Quick summary
|
||||
Please briefly describe what is not working correctly.
|
||||
|
||||
## Details
|
||||
|
||||
Please describe the problem as accurately as possible.
|
||||
|
||||
#### 1. Please attach RPCS3's log.
|
||||
* Run the game until you find the issue.
|
||||
* Completely close RPCS3, or move to the next step in case it has crashed.
|
||||
* Locate RPCS3's log file:
|
||||
+ ```RPCS3.log``` (It can show up as just RPCS3 and have a notepad icon)
|
||||
or
|
||||
+ ```RPCS3.log.gz``` (It can show up as RPCS3.log and have a zip or rar icon)
|
||||

|
||||
On Linux it will be in ```~/.cache/rpcs3/```.
|
||||
On Windows it will be near the executable.
|
||||
* Attach the log:
|
||||
+ Drag and drop your log file into the issue.
|
||||
+ Or upload it to the cloud, such as Dropbox, Mega etc.
|
||||
|
||||
#### 2. If you describe graphical issue, please provide an RSX capture and a RenderDoc capture that demonstrate it.
|
||||
* To create an RSX capture, use _Create_ _RSX_ _Capture_ under _Utilities_.
|
||||
Captures will be stored in RPCS3 folder → captures.
|
||||
+ Compress your capture with 7z, Rar etc.
|
||||
And drag and drop it into the issue.
|
||||
+ Or upload it to the cloud, such as Dropbox, Mega etc.
|
||||
* To create a RenderDoc capture, please refer to [RenderDoc's documentation](https://renderdoc.org/docs/how/how_capture_frame.html).
|
||||
|
||||
#### 3. Please attach screenshots of your problem.
|
||||
* Enable performance overlay with at least medium level of detail.
|
||||
You can find it in _Emulator_ tab in _Settings_.
|
||||
|
||||
#### 4. Please provide comparison with real PS3.
|
||||
|
||||
#### 5. Please provide your system configuration:
|
||||
* OS
|
||||
* CPU
|
||||
* GPU
|
||||
* Driver version
|
||||
* etc.
|
||||
|
||||
#### Please include.
|
||||
* Anything else you deem to be important
|
||||
@@ -0,0 +1,78 @@
|
||||
name: Bug report
|
||||
description: If something doesn't work correctly in RPCS3
|
||||
title: "Enter a title here"
|
||||
labels: []
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
# Summary
|
||||
Please do not ask for help or report compatibility regressions here, use [RPCS3 Discord server](https://discord.me/RPCS3) or [forums](https://forums.rpcs3.net/) instead.
|
||||
- type: textarea
|
||||
id: quick-summary
|
||||
attributes:
|
||||
label: Quick summary
|
||||
description: Please briefly describe what is not working correctly.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: details
|
||||
attributes:
|
||||
label: Details
|
||||
description: |
|
||||
Please describe the problem as accurately as possible.
|
||||
Provide a comparison with a real PS3, if possible.
|
||||
validations:
|
||||
required: false
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
# Log files
|
||||
|
||||
Provide a log file that includes the bug you're reporting.
|
||||
|
||||
Obtaining the log file:
|
||||
* Run the game until you find the regression.
|
||||
* Completely close RPCS3 and locate the log file.
|
||||
|
||||
RPCS3's Log file will be ```RPCS3.log.gz``` (sometimes shows as RPCS3.log with zip icon) or ```RPCS3.log``` (sometimes shows as RPCS3 wtih notepad icon).
|
||||
* On Windows it will be in the RPCS3 directory near the executable
|
||||
* On Linux it will be in ```~/.cache/rpcs3/```
|
||||
* On MacOS it will be in ```~/Library/Caches/rpcs3```. If you're unable to locate it copy paste the path in Spotlight and hit enter.
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Attach a log file
|
||||
description: |
|
||||
Drag & drop the files into this input field, or upload them to another service (f.ex. Dropbox, Mega) and provide a link.
|
||||
validations:
|
||||
required: true
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
# Other details
|
||||
If you describe a graphical issue, please provide an RSX capture and/or a RenderDoc capture that demonstrate it.
|
||||
* To create an RSX capture, use _Create_ _RSX_ _Capture_ under _Utilities_.
|
||||
* Captures will be stored in RPCS3 folder → captures.
|
||||
* To create a RenderDoc capture, please refer to [RenderDoc's documentation](https://renderdoc.org/docs/how/how_capture_frame.html).
|
||||
- type: textarea
|
||||
id: captures
|
||||
attributes:
|
||||
label: Attach capture files for visual issues
|
||||
description: Compress your capture with 7z, Rar etc. and attach it here, or upload it to the cloud (Dropbox, Mega etc) and add a link to it.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: system-info
|
||||
attributes:
|
||||
label: System configuration
|
||||
description: Provide information about your system, such as operating system, CPU and GPU model, GPU driver version and other information that describes your system configuration.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: other-details
|
||||
attributes:
|
||||
label: Other details
|
||||
description: Include anything else you deem to be important.
|
||||
validations:
|
||||
required: false
|
||||
@@ -1,41 +0,0 @@
|
||||
---
|
||||
name: Feature Request
|
||||
about: If RPCS3 lacks a feature you would like to see
|
||||
title: '[Feature Request] Enter Feature Title Here'
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
## Please do not ask for help or report compatibility regressions here, use [RPCS3 Discord server](https://discord.me/RPCS3) or [forums](https://forums.rpcs3.net/) instead.
|
||||
|
||||
## Quick summary
|
||||
Please briefly describe what feature you would like RPCS3 to have.
|
||||
|
||||
## Details
|
||||
|
||||
Please describe the feature as accurately as possible.
|
||||
|
||||
#### 1. Please describe, what part of RPCS3 would be affected by your feature:
|
||||
* Gameplay
|
||||
* Debugging
|
||||
* UI
|
||||
* Patches
|
||||
* Installation
|
||||
* Github
|
||||
* CI
|
||||
* etc.
|
||||
|
||||
#### 2. Please tell us, why your feature is important to RPCS3.
|
||||
|
||||
#### 3. Please attach screenshots of the feature implemented in other projects.
|
||||
|
||||
#### 4. Please provide your system configuration:
|
||||
* OS
|
||||
* CPU
|
||||
* GPU
|
||||
* Driver version
|
||||
* etc.
|
||||
|
||||
#### Please include.
|
||||
* Anything else you deem to be important
|
||||
@@ -0,0 +1,36 @@
|
||||
name: Feature request
|
||||
description: If RPCS3 lacks a feature you would like to see
|
||||
title: "[Feature request] Enter a title here"
|
||||
labels: []
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Please do not ask for help or report compatibility regressions here, use [RPCS3 Discord server](https://discord.me/RPCS3) or [forums](https://forums.rpcs3.net/) instead.
|
||||
- type: textarea
|
||||
id: quick-summary
|
||||
attributes:
|
||||
label: Quick summary
|
||||
description: Please briefly describe what feature you would like RPCS3 to have.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: details
|
||||
attributes:
|
||||
label: Details
|
||||
description: Please describe the feature as accurately as possible.
|
||||
validations:
|
||||
required: false
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Please include the following information:
|
||||
* What part of RPCS3 would be affected by your feature? (Gameplay, Debugging, UI, Patches, Installation, CI etc.)
|
||||
* Why your feature is important to RPCS3.
|
||||
* If the feature is implemented in other projects, attach screenshots.
|
||||
* If this feature is something that a game is trying to use, upload a log file for it.
|
||||
|
||||
RPCS3's Log file will be ```RPCS3.log.gz``` (sometimes shows as RPCS3.log with zip icon) or ```RPCS3.log``` (sometimes shows as RPCS3 wtih notepad icon).
|
||||
* On Windows it will be in the RPCS3 directory near the executable
|
||||
* On Linux it will be in ```~/.cache/rpcs3/```
|
||||
* On MacOS it will be in ```~/Library/Caches/rpcs3```. If you're unable to locate it copy paste the path in Spotlight and hit enter.
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
name: Advanced
|
||||
about: For developers and experienced users only
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
## Please do not ask for help or report compatibility regressions here, use [RPCS3 Discord server](https://discord.me/RPCS3) or [forums](https://forums.rpcs3.net/) instead.
|
||||
|
||||
You're using the advanced template. You're expected to know what to write in order to fill in all the required information for proper report.
|
||||
|
||||
If you're unsure on what to do, please return back to the issue type selection and choose different category.
|
||||
+12
-14
@@ -1,20 +1,18 @@
|
||||
## How to test a PR build
|
||||
|
||||
Please take into account, that RPCS3 build usually takes some time (about 20 min), so you can't access a build, if a PR was just submitted.
|
||||
Please take into account, that RPCS3 build usually takes some time (about 15 mins), so you can't access a build if a PR was just submitted.
|
||||
|
||||
- Open a PR you want to test
|
||||
- Scroll to the very bottom and locate "Checks" section
|
||||
- Expand all checks
|
||||
- Scroll to the very bottom and locate the **Checks** section
|
||||
- Click on **Show all checks**
|
||||
You are supposed to see something like this
|
||||

|
||||
- Click on **Linux_Build** or **Windows_Build** __Details__
|
||||
- Click **View more details on Azure Pipelines** at the very bottom
|
||||

|
||||
- Click on *1 artifact produced*
|
||||

|
||||
- Select a build for your OS and click three dots on the right, Click **Download artifacts**
|
||||

|
||||
|
||||
- Congratulations! You are now downloading RPCS3 build for specific PR.
|
||||

|
||||
- Click on __Details__ on either **Cirrus Linux GCC** or **Cirrus Windows**
|
||||
- Click **View more details on Cirrus CI** at the very bottom
|
||||

|
||||
- Click on the download button for **Artifact** on the **Artifacts** block
|
||||

|
||||
|
||||
Please note, that PR builds are not supposed to be stable, because they contain new changesets.
|
||||
- Congratulations! You are now downloading an RPCS3 build for that specific PR.
|
||||
|
||||
__Please note that PR builds are not supposed to be stable because they contain new changesets.__
|
||||
|
||||
+15
-5
@@ -9,7 +9,7 @@
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
# *.a # Commented out since OpenAL Soft's binaries use this extension.
|
||||
*.a
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.suo
|
||||
@@ -37,14 +37,17 @@
|
||||
/rpcs3/Debug
|
||||
/rpcs3/Release
|
||||
/llvm_build
|
||||
/3rdparty/llvm_build
|
||||
/Vulkan/Vulkan-build
|
||||
/Vulkan/glslang-build
|
||||
/Vulkan/spirv-tools-build
|
||||
|
||||
!/bin
|
||||
/bin/*
|
||||
|
||||
# Audio DLLs
|
||||
!/bin/soft_oal.dll
|
||||
!/bin/xaudio2_9redist.dll
|
||||
|
||||
# Test Programs
|
||||
!/bin/test/
|
||||
|
||||
# Themes
|
||||
!/bin/GuiConfigs/
|
||||
/bin/GuiConfigs/*.ini
|
||||
@@ -52,6 +55,9 @@
|
||||
/bin/GuiConfigs/*.dat
|
||||
/bin/GuiConfigs/*.dat.*
|
||||
|
||||
# Some data from git
|
||||
!/bin/git/
|
||||
|
||||
# Visual Studio Files
|
||||
.vs/*
|
||||
.vscode/*
|
||||
@@ -62,6 +68,8 @@
|
||||
*.vcxproj.user
|
||||
enc_temp_folder/*
|
||||
CMakeSettings.json
|
||||
*PVS-Studio*
|
||||
PVS/*
|
||||
|
||||
# Ignore other system generated files
|
||||
x64/*
|
||||
@@ -116,3 +124,5 @@ yaml-cpp.pc
|
||||
|
||||
# ssl certificate
|
||||
cacert.pem
|
||||
|
||||
_ReSharper.*/
|
||||
|
||||
+40
-39
@@ -1,77 +1,78 @@
|
||||
[submodule "rpcs3-ffmpeg"]
|
||||
path = 3rdparty/ffmpeg
|
||||
url = https://github.com/RPCS3/ffmpeg-core
|
||||
url = ../../RPCS3/ffmpeg-core.git
|
||||
ignore = dirty
|
||||
[submodule "asmjit"]
|
||||
path = asmjit
|
||||
url = https://github.com/kobalicek/asmjit
|
||||
path = 3rdparty/asmjit/asmjit
|
||||
url = ../../RPCS3/asmjit.git
|
||||
branch = aarch64
|
||||
ignore = dirty
|
||||
[submodule "llvm"]
|
||||
path = llvm
|
||||
url = https://github.com/RPCS3/llvm-mirror
|
||||
url = ../../RPCS3/llvm-mirror.git
|
||||
ignore = dirty
|
||||
[submodule "Vulkan/glslang"]
|
||||
path = Vulkan/glslang
|
||||
url = https://github.com/KhronosGroup/glslang.git
|
||||
[submodule "3rdparty/glslang"]
|
||||
path = 3rdparty/glslang/glslang
|
||||
url = ../../KhronosGroup/glslang.git
|
||||
ignore = dirty
|
||||
[submodule "Vulkan/spirv-tools"]
|
||||
path = Vulkan/spirv-tools
|
||||
url = https://github.com/KhronosGroup/SPIRV-Tools.git
|
||||
[submodule "3rdparty/SPIRV-Tools"]
|
||||
path = 3rdparty/SPIRV/SPIRV-Tools
|
||||
url = ../../KhronosGroup/SPIRV-Tools.git
|
||||
ignore = dirty
|
||||
[submodule "Vulkan/spirv-headers"]
|
||||
path = Vulkan/spirv-headers
|
||||
url = https://github.com/KhronosGroup/SPIRV-Headers.git
|
||||
ignore = dirty
|
||||
[submodule "3rdparty/cereal"]
|
||||
path = 3rdparty/cereal
|
||||
url = https://github.com/RPCS3/cereal.git
|
||||
[submodule "3rdparty/SPIRV-Headers"]
|
||||
path = 3rdparty/SPIRV/SPIRV-Headers
|
||||
url = ../../KhronosGroup/SPIRV-Headers.git
|
||||
ignore = dirty
|
||||
[submodule "3rdparty/zlib"]
|
||||
path = 3rdparty/zlib
|
||||
url = https://github.com/madler/zlib
|
||||
path = 3rdparty/zlib/zlib
|
||||
url = ../../madler/zlib
|
||||
ignore = dirty
|
||||
[submodule "3rdparty/hidapi"]
|
||||
path = 3rdparty/hidapi
|
||||
url = https://github.com/RPCS3/hidapi
|
||||
path = 3rdparty/hidapi/hidapi
|
||||
url = ../../RPCS3/hidapi.git
|
||||
branch = master
|
||||
ignore = dirty
|
||||
[submodule "3rdparty/pugixml"]
|
||||
path = 3rdparty/pugixml
|
||||
url = https://github.com/zeux/pugixml
|
||||
url = ../../zeux/pugixml.git
|
||||
ignore = dirty
|
||||
[submodule "3rdparty/xxHash"]
|
||||
path = 3rdparty/xxHash
|
||||
url = https://github.com/Cyan4973/xxHash
|
||||
url = ../../Cyan4973/xxHash.git
|
||||
ignore = dirty
|
||||
[submodule "3rdparty/yaml-cpp"]
|
||||
path = 3rdparty/yaml-cpp
|
||||
url = https://github.com/RPCS3/yaml-cpp.git
|
||||
path = 3rdparty/yaml-cpp/yaml-cpp
|
||||
url = ../../RPCS3/yaml-cpp.git
|
||||
ignore = dirty
|
||||
[submodule "3rdparty/libpng"]
|
||||
path = 3rdparty/libpng
|
||||
url = https://github.com/glennrp/libpng.git
|
||||
path = 3rdparty/libpng/libpng
|
||||
url = ../../glennrp/libpng.git
|
||||
ignore = dirty
|
||||
[submodule "3rdparty/libusb"]
|
||||
path = 3rdparty/libusb
|
||||
url = https://github.com/libusb/libusb.git
|
||||
path = 3rdparty/libusb/libusb
|
||||
url = ../../libusb/libusb.git
|
||||
ignore = dirty
|
||||
[submodule "3rdparty/FAudio"]
|
||||
path = 3rdparty/FAudio
|
||||
url = https://github.com/FNA-XNA/FAudio.git
|
||||
ignore = dirty
|
||||
[submodule "3rdparty/span"]
|
||||
path = 3rdparty/span
|
||||
url = https://github.com/tcbrindle/span
|
||||
url = ../../FNA-XNA/FAudio.git
|
||||
ignore = dirty
|
||||
[submodule "3rdparty/curl"]
|
||||
path = 3rdparty/curl
|
||||
url = https://github.com/curl/curl.git
|
||||
path = 3rdparty/curl/curl
|
||||
url = ../../curl/curl.git
|
||||
ignore = dirty
|
||||
[submodule "3rdparty/wolfssl"]
|
||||
path = 3rdparty/wolfssl
|
||||
url = https://github.com/wolfSSL/wolfssl.git
|
||||
path = 3rdparty/wolfssl/wolfssl
|
||||
url = ../../wolfSSL/wolfssl.git
|
||||
ignore = dirty
|
||||
[submodule "3rdparty/flatbuffers"]
|
||||
path = 3rdparty/flatbuffers
|
||||
url = https://github.com/google/flatbuffers.git
|
||||
url = ../../google/flatbuffers.git
|
||||
ignore = dirty
|
||||
[submodule "3rdparty/cubeb/cubeb"]
|
||||
path = 3rdparty/cubeb/cubeb
|
||||
url = ../../mozilla/cubeb.git
|
||||
ignore = dirty
|
||||
[submodule "3rdparty/SoundTouch/soundtouch"]
|
||||
path = 3rdparty/SoundTouch/soundtouch
|
||||
url = ../../RPCS3/soundtouch.git
|
||||
ignore = dirty
|
||||
|
||||
Vendored
-128
@@ -1,128 +0,0 @@
|
||||
/* 7zCrc.c -- CRC32 init
|
||||
2017-06-06 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
#include "7zCrc.h"
|
||||
#include "CpuArch.h"
|
||||
|
||||
#define kCrcPoly 0xEDB88320
|
||||
|
||||
#ifdef MY_CPU_LE
|
||||
#define CRC_NUM_TABLES 8
|
||||
#else
|
||||
#define CRC_NUM_TABLES 9
|
||||
|
||||
#define CRC_UINT32_SWAP(v) ((v >> 24) | ((v >> 8) & 0xFF00) | ((v << 8) & 0xFF0000) | (v << 24))
|
||||
|
||||
UInt32 MY_FAST_CALL CrcUpdateT1_BeT4(UInt32 v, const void *data, size_t size, const UInt32 *table);
|
||||
UInt32 MY_FAST_CALL CrcUpdateT1_BeT8(UInt32 v, const void *data, size_t size, const UInt32 *table);
|
||||
#endif
|
||||
|
||||
#ifndef MY_CPU_BE
|
||||
UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table);
|
||||
UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table);
|
||||
#endif
|
||||
|
||||
typedef UInt32 (MY_FAST_CALL *CRC_FUNC)(UInt32 v, const void *data, size_t size, const UInt32 *table);
|
||||
|
||||
CRC_FUNC g_CrcUpdateT4;
|
||||
CRC_FUNC g_CrcUpdateT8;
|
||||
CRC_FUNC g_CrcUpdate;
|
||||
|
||||
UInt32 g_CrcTable[256 * CRC_NUM_TABLES];
|
||||
|
||||
UInt32 MY_FAST_CALL CrcUpdate(UInt32 v, const void *data, size_t size)
|
||||
{
|
||||
return g_CrcUpdate(v, data, size, g_CrcTable);
|
||||
}
|
||||
|
||||
UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size)
|
||||
{
|
||||
return g_CrcUpdate(CRC_INIT_VAL, data, size, g_CrcTable) ^ CRC_INIT_VAL;
|
||||
}
|
||||
|
||||
#define CRC_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
|
||||
|
||||
UInt32 MY_FAST_CALL CrcUpdateT1(UInt32 v, const void *data, size_t size, const UInt32 *table)
|
||||
{
|
||||
const Byte *p = (const Byte *)data;
|
||||
const Byte *pEnd = p + size;
|
||||
for (; p != pEnd; p++)
|
||||
v = CRC_UPDATE_BYTE_2(v, *p);
|
||||
return v;
|
||||
}
|
||||
|
||||
void MY_FAST_CALL CrcGenerateTable()
|
||||
{
|
||||
UInt32 i;
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
UInt32 r = i;
|
||||
unsigned j;
|
||||
for (j = 0; j < 8; j++)
|
||||
r = (r >> 1) ^ (kCrcPoly & ((UInt32)0 - (r & 1)));
|
||||
g_CrcTable[i] = r;
|
||||
}
|
||||
for (i = 256; i < 256 * CRC_NUM_TABLES; i++)
|
||||
{
|
||||
UInt32 r = g_CrcTable[(size_t)i - 256];
|
||||
g_CrcTable[i] = g_CrcTable[r & 0xFF] ^ (r >> 8);
|
||||
}
|
||||
|
||||
#if CRC_NUM_TABLES < 4
|
||||
|
||||
g_CrcUpdate = CrcUpdateT1;
|
||||
|
||||
#else
|
||||
|
||||
#ifdef MY_CPU_LE
|
||||
|
||||
g_CrcUpdateT4 = CrcUpdateT4;
|
||||
g_CrcUpdate = CrcUpdateT4;
|
||||
|
||||
#if CRC_NUM_TABLES >= 8
|
||||
g_CrcUpdateT8 = CrcUpdateT8;
|
||||
|
||||
#ifdef MY_CPU_X86_OR_AMD64
|
||||
if (!CPU_Is_InOrder())
|
||||
#endif
|
||||
g_CrcUpdate = CrcUpdateT8;
|
||||
#endif
|
||||
|
||||
#else
|
||||
{
|
||||
#ifndef MY_CPU_BE
|
||||
UInt32 k = 0x01020304;
|
||||
const Byte *p = (const Byte *)&k;
|
||||
if (p[0] == 4 && p[1] == 3)
|
||||
{
|
||||
g_CrcUpdateT4 = CrcUpdateT4;
|
||||
g_CrcUpdate = CrcUpdateT4;
|
||||
#if CRC_NUM_TABLES >= 8
|
||||
g_CrcUpdateT8 = CrcUpdateT8;
|
||||
g_CrcUpdate = CrcUpdateT8;
|
||||
#endif
|
||||
}
|
||||
else if (p[0] != 1 || p[1] != 2)
|
||||
g_CrcUpdate = CrcUpdateT1;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
for (i = 256 * CRC_NUM_TABLES - 1; i >= 256; i--)
|
||||
{
|
||||
UInt32 x = g_CrcTable[(size_t)i - 256];
|
||||
g_CrcTable[i] = CRC_UINT32_SWAP(x);
|
||||
}
|
||||
g_CrcUpdateT4 = CrcUpdateT1_BeT4;
|
||||
g_CrcUpdate = CrcUpdateT1_BeT4;
|
||||
#if CRC_NUM_TABLES >= 8
|
||||
g_CrcUpdateT8 = CrcUpdateT1_BeT8;
|
||||
g_CrcUpdate = CrcUpdateT1_BeT8;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
+83
-83
@@ -19,89 +19,89 @@
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="7z\7z.h" />
|
||||
<ClInclude Include="7z\7zAlloc.h" />
|
||||
<ClInclude Include="7z\7zBuf.h" />
|
||||
<ClInclude Include="7z\7zCrc.h" />
|
||||
<ClInclude Include="7z\7zFile.h" />
|
||||
<ClInclude Include="7z\7zTypes.h" />
|
||||
<ClInclude Include="7z\7zVersion.h" />
|
||||
<ClInclude Include="7z\Aes.h" />
|
||||
<ClInclude Include="7z\Alloc.h" />
|
||||
<ClInclude Include="7z\Bcj2.h" />
|
||||
<ClInclude Include="7z\Bra.h" />
|
||||
<ClInclude Include="7z\Compiler.h" />
|
||||
<ClInclude Include="7z\CpuArch.h" />
|
||||
<ClInclude Include="7z\Delta.h" />
|
||||
<ClInclude Include="7z\DllSecur.h" />
|
||||
<ClInclude Include="7z\LzFind.h" />
|
||||
<ClInclude Include="7z\LzFindMt.h" />
|
||||
<ClInclude Include="7z\LzHash.h" />
|
||||
<ClInclude Include="7z\Lzma2Dec.h" />
|
||||
<ClInclude Include="7z\Lzma2DecMt.h" />
|
||||
<ClInclude Include="7z\Lzma2Enc.h" />
|
||||
<ClInclude Include="7z\Lzma86.h" />
|
||||
<ClInclude Include="7z\LzmaDec.h" />
|
||||
<ClInclude Include="7z\LzmaEnc.h" />
|
||||
<ClInclude Include="7z\LzmaLib.h" />
|
||||
<ClInclude Include="7z\MtCoder.h" />
|
||||
<ClInclude Include="7z\MtDec.h" />
|
||||
<ClInclude Include="7z\Ppmd.h" />
|
||||
<ClInclude Include="7z\Ppmd7.h" />
|
||||
<ClInclude Include="7z\Precomp.h" />
|
||||
<ClInclude Include="7z\RotateDefs.h" />
|
||||
<ClInclude Include="7z\Sha256.h" />
|
||||
<ClInclude Include="7z\Sort.h" />
|
||||
<ClInclude Include="7z\Threads.h" />
|
||||
<ClInclude Include="7z\Xz.h" />
|
||||
<ClInclude Include="7z\XzCrc64.h" />
|
||||
<ClInclude Include="7z\XzEnc.h" />
|
||||
<ClInclude Include="src\7z.h" />
|
||||
<ClInclude Include="src\7zAlloc.h" />
|
||||
<ClInclude Include="src\7zBuf.h" />
|
||||
<ClInclude Include="src\7zCrc.h" />
|
||||
<ClInclude Include="src\7zFile.h" />
|
||||
<ClInclude Include="src\7zTypes.h" />
|
||||
<ClInclude Include="src\7zVersion.h" />
|
||||
<ClInclude Include="src\Aes.h" />
|
||||
<ClInclude Include="src\Alloc.h" />
|
||||
<ClInclude Include="src\Bcj2.h" />
|
||||
<ClInclude Include="src\Bra.h" />
|
||||
<ClInclude Include="src\Compiler.h" />
|
||||
<ClInclude Include="src\CpuArch.h" />
|
||||
<ClInclude Include="src\Delta.h" />
|
||||
<ClInclude Include="src\DllSecur.h" />
|
||||
<ClInclude Include="src\LzFind.h" />
|
||||
<ClInclude Include="src\LzFindMt.h" />
|
||||
<ClInclude Include="src\LzHash.h" />
|
||||
<ClInclude Include="src\Lzma2Dec.h" />
|
||||
<ClInclude Include="src\Lzma2DecMt.h" />
|
||||
<ClInclude Include="src\Lzma2Enc.h" />
|
||||
<ClInclude Include="src\Lzma86.h" />
|
||||
<ClInclude Include="src\LzmaDec.h" />
|
||||
<ClInclude Include="src\LzmaEnc.h" />
|
||||
<ClInclude Include="src\LzmaLib.h" />
|
||||
<ClInclude Include="src\MtCoder.h" />
|
||||
<ClInclude Include="src\MtDec.h" />
|
||||
<ClInclude Include="src\Ppmd.h" />
|
||||
<ClInclude Include="src\Ppmd7.h" />
|
||||
<ClInclude Include="src\Precomp.h" />
|
||||
<ClInclude Include="src\RotateDefs.h" />
|
||||
<ClInclude Include="src\Sha256.h" />
|
||||
<ClInclude Include="src\Sort.h" />
|
||||
<ClInclude Include="src\Threads.h" />
|
||||
<ClInclude Include="src\Xz.h" />
|
||||
<ClInclude Include="src\XzCrc64.h" />
|
||||
<ClInclude Include="src\XzEnc.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="7z\7zAlloc.c" />
|
||||
<ClCompile Include="7z\7zArcIn.c" />
|
||||
<ClCompile Include="7z\7zBuf.c" />
|
||||
<ClCompile Include="7z\7zBuf2.c" />
|
||||
<ClCompile Include="7z\7zCrc.c" />
|
||||
<ClCompile Include="7z\7zCrcOpt.c" />
|
||||
<ClCompile Include="7z\7zDec.c" />
|
||||
<ClCompile Include="7z\7zFile.c" />
|
||||
<ClCompile Include="7z\7zStream.c" />
|
||||
<ClCompile Include="7z\Aes.c" />
|
||||
<ClCompile Include="7z\AesOpt.c" />
|
||||
<ClCompile Include="7z\Alloc.c" />
|
||||
<ClCompile Include="7z\Bcj2.c" />
|
||||
<ClCompile Include="7z\Bcj2Enc.c" />
|
||||
<ClCompile Include="7z\Bra.c" />
|
||||
<ClCompile Include="7z\Bra86.c" />
|
||||
<ClCompile Include="7z\BraIA64.c" />
|
||||
<ClCompile Include="7z\CpuArch.c" />
|
||||
<ClCompile Include="7z\Delta.c" />
|
||||
<ClCompile Include="7z\DllSecur.c" />
|
||||
<ClCompile Include="7z\LzFind.c" />
|
||||
<ClCompile Include="7z\LzFindMt.c" />
|
||||
<ClCompile Include="7z\Lzma2Dec.c" />
|
||||
<ClCompile Include="7z\Lzma2DecMt.c" />
|
||||
<ClCompile Include="7z\Lzma2Enc.c" />
|
||||
<ClCompile Include="7z\Lzma86Dec.c" />
|
||||
<ClCompile Include="7z\Lzma86Enc.c" />
|
||||
<ClCompile Include="7z\LzmaDec.c" />
|
||||
<ClCompile Include="7z\LzmaEnc.c" />
|
||||
<ClCompile Include="7z\LzmaLib.c" />
|
||||
<ClCompile Include="7z\MtCoder.c" />
|
||||
<ClCompile Include="7z\MtDec.c" />
|
||||
<ClCompile Include="7z\Ppmd7.c" />
|
||||
<ClCompile Include="7z\Ppmd7Dec.c" />
|
||||
<ClCompile Include="7z\Ppmd7Enc.c" />
|
||||
<ClCompile Include="7z\Sha256.c" />
|
||||
<ClCompile Include="7z\Sort.c" />
|
||||
<ClCompile Include="7z\Threads.c" />
|
||||
<ClCompile Include="7z\Xz.c" />
|
||||
<ClCompile Include="7z\XzCrc64.c" />
|
||||
<ClCompile Include="7z\XzCrc64Opt.c" />
|
||||
<ClCompile Include="7z\XzDec.c" />
|
||||
<ClCompile Include="7z\XzEnc.c" />
|
||||
<ClCompile Include="7z\XzIn.c" />
|
||||
<ClCompile Include="src\7zAlloc.c" />
|
||||
<ClCompile Include="src\7zArcIn.c" />
|
||||
<ClCompile Include="src\7zBuf.c" />
|
||||
<ClCompile Include="src\7zBuf2.c" />
|
||||
<ClCompile Include="src\7zCrc.c" />
|
||||
<ClCompile Include="src\7zCrcOpt.c" />
|
||||
<ClCompile Include="src\7zDec.c" />
|
||||
<ClCompile Include="src\7zFile.c" />
|
||||
<ClCompile Include="src\7zStream.c" />
|
||||
<ClCompile Include="src\Aes.c" />
|
||||
<ClCompile Include="src\AesOpt.c" />
|
||||
<ClCompile Include="src\Alloc.c" />
|
||||
<ClCompile Include="src\Bcj2.c" />
|
||||
<ClCompile Include="src\Bcj2Enc.c" />
|
||||
<ClCompile Include="src\Bra.c" />
|
||||
<ClCompile Include="src\Bra86.c" />
|
||||
<ClCompile Include="src\BraIA64.c" />
|
||||
<ClCompile Include="src\CpuArch.c" />
|
||||
<ClCompile Include="src\Delta.c" />
|
||||
<ClCompile Include="src\DllSecur.c" />
|
||||
<ClCompile Include="src\LzFind.c" />
|
||||
<ClCompile Include="src\LzFindMt.c" />
|
||||
<ClCompile Include="src\Lzma2Dec.c" />
|
||||
<ClCompile Include="src\Lzma2DecMt.c" />
|
||||
<ClCompile Include="src\Lzma2Enc.c" />
|
||||
<ClCompile Include="src\Lzma86Dec.c" />
|
||||
<ClCompile Include="src\Lzma86Enc.c" />
|
||||
<ClCompile Include="src\LzmaDec.c" />
|
||||
<ClCompile Include="src\LzmaEnc.c" />
|
||||
<ClCompile Include="src\LzmaLib.c" />
|
||||
<ClCompile Include="src\MtCoder.c" />
|
||||
<ClCompile Include="src\MtDec.c" />
|
||||
<ClCompile Include="src\Ppmd7.c" />
|
||||
<ClCompile Include="src\Ppmd7Dec.c" />
|
||||
<ClCompile Include="src\Ppmd7Enc.c" />
|
||||
<ClCompile Include="src\Sha256.c" />
|
||||
<ClCompile Include="src\Sort.c" />
|
||||
<ClCompile Include="src\Threads.c" />
|
||||
<ClCompile Include="src\Xz.c" />
|
||||
<ClCompile Include="src\XzCrc64.c" />
|
||||
<ClCompile Include="src\XzCrc64Opt.c" />
|
||||
<ClCompile Include="src\XzDec.c" />
|
||||
<ClCompile Include="src\XzEnc.c" />
|
||||
<ClCompile Include="src\XzIn.c" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
@@ -109,12 +109,12 @@
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>My7zlib</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\common_default.props" />
|
||||
<Import Project="$(SolutionDir)\buildfiles\msvc\common_default.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup>
|
||||
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\common_default_macros.props" />
|
||||
<Import Project="$(SolutionDir)\buildfiles\msvc\common_default_macros.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
@@ -15,249 +15,249 @@
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="7z\7z.h">
|
||||
<ClInclude Include"src\7z.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\7zAlloc.h">
|
||||
<ClInclude Include"src\7zAlloc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\7zBuf.h">
|
||||
<ClInclude Include"src\7zBuf.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\7zCrc.h">
|
||||
<ClInclude Include"src\7zCrc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\7zFile.h">
|
||||
<ClInclude Include"src\7zFile.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\7zTypes.h">
|
||||
<ClInclude Include"src\7zTypes.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\7zVersion.h">
|
||||
<ClInclude Include"src\7zVersion.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\Aes.h">
|
||||
<ClInclude Include"src\Aes.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\Alloc.h">
|
||||
<ClInclude Include"src\Alloc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\Bcj2.h">
|
||||
<ClInclude Include"src\Bcj2.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\Bra.h">
|
||||
<ClInclude Include"src\Bra.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\Compiler.h">
|
||||
<ClInclude Include"src\Compiler.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\CpuArch.h">
|
||||
<ClInclude Include"src\CpuArch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\Delta.h">
|
||||
<ClInclude Include"src\Delta.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\DllSecur.h">
|
||||
<ClInclude Include"src\DllSecur.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\LzFind.h">
|
||||
<ClInclude Include"src\LzFind.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\LzFindMt.h">
|
||||
<ClInclude Include"src\LzFindMt.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\LzHash.h">
|
||||
<ClInclude Include"src\LzHash.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\Lzma2Dec.h">
|
||||
<ClInclude Include"src\Lzma2Dec.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\Lzma2DecMt.h">
|
||||
<ClInclude Include"src\Lzma2DecMt.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\Lzma2Enc.h">
|
||||
<ClInclude Include"src\Lzma2Enc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\Lzma86.h">
|
||||
<ClInclude Include"src\Lzma86.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\LzmaDec.h">
|
||||
<ClInclude Include"src\LzmaDec.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\LzmaEnc.h">
|
||||
<ClInclude Include"src\LzmaEnc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\LzmaLib.h">
|
||||
<ClInclude Include"src\LzmaLib.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\MtCoder.h">
|
||||
<ClInclude Include"src\MtCoder.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\MtDec.h">
|
||||
<ClInclude Include"src\MtDec.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\Ppmd.h">
|
||||
<ClInclude Include"src\Ppmd.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\Ppmd7.h">
|
||||
<ClInclude Include"src\Ppmd7.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\Precomp.h">
|
||||
<ClInclude Include"src\Precomp.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\RotateDefs.h">
|
||||
<ClInclude Include"src\RotateDefs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\Sha256.h">
|
||||
<ClInclude Include"src\Sha256.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\Sort.h">
|
||||
<ClInclude Include"src\Sort.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\Threads.h">
|
||||
<ClInclude Include"src\Threads.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\Xz.h">
|
||||
<ClInclude Include"src\Xz.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\XzCrc64.h">
|
||||
<ClInclude Include"src\XzCrc64.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="7z\XzEnc.h">
|
||||
<ClInclude Include"src\XzEnc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="7z\7zAlloc.c">
|
||||
<ClCompile Include"src\7zAlloc.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\7zArcIn.c">
|
||||
<ClCompile Include"src\7zArcIn.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\7zBuf.c">
|
||||
<ClCompile Include"src\7zBuf.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\7zBuf2.c">
|
||||
<ClCompile Include"src\7zBuf2.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\7zCrc.c">
|
||||
<ClCompile Include"src\7zCrc.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\7zCrcOpt.c">
|
||||
<ClCompile Include"src\7zCrcOpt.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\7zDec.c">
|
||||
<ClCompile Include"src\7zDec.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\7zFile.c">
|
||||
<ClCompile Include"src\7zFile.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\7zStream.c">
|
||||
<ClCompile Include"src\7zStream.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\Aes.c">
|
||||
<ClCompile Include"src\Aes.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\AesOpt.c">
|
||||
<ClCompile Include"src\AesOpt.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\Alloc.c">
|
||||
<ClCompile Include"src\Alloc.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\Bcj2.c">
|
||||
<ClCompile Include"src\Bcj2.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\Bcj2Enc.c">
|
||||
<ClCompile Include"src\Bcj2Enc.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\Bra.c">
|
||||
<ClCompile Include"src\Bra.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\Bra86.c">
|
||||
<ClCompile Include"src\Bra86.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\BraIA64.c">
|
||||
<ClCompile Include"src\BraIA64.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\CpuArch.c">
|
||||
<ClCompile Include"src\CpuArch.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\Delta.c">
|
||||
<ClCompile Include"src\Delta.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\DllSecur.c">
|
||||
<ClCompile Include"src\DllSecur.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\LzFind.c">
|
||||
<ClCompile Include"src\LzFind.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\LzFindMt.c">
|
||||
<ClCompile Include"src\LzFindMt.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\Lzma2Dec.c">
|
||||
<ClCompile Include"src\Lzma2Dec.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\Lzma2DecMt.c">
|
||||
<ClCompile Include"src\Lzma2DecMt.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\Lzma2Enc.c">
|
||||
<ClCompile Include"src\Lzma2Enc.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\Lzma86Dec.c">
|
||||
<ClCompile Include"src\Lzma86Dec.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\Lzma86Enc.c">
|
||||
<ClCompile Include"src\Lzma86Enc.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\LzmaDec.c">
|
||||
<ClCompile Include"src\LzmaDec.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\LzmaEnc.c">
|
||||
<ClCompile Include"src\LzmaEnc.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\LzmaLib.c">
|
||||
<ClCompile Include"src\LzmaLib.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\MtCoder.c">
|
||||
<ClCompile Include"src\MtCoder.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\MtDec.c">
|
||||
<ClCompile Include"src\MtDec.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\Ppmd7.c">
|
||||
<ClCompile Include"src\Ppmd7.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\Ppmd7Dec.c">
|
||||
<ClCompile Include"src\Ppmd7Dec.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\Ppmd7Enc.c">
|
||||
<ClCompile Include"src\Ppmd7Enc.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\Sha256.c">
|
||||
<ClCompile Include"src\Sha256.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\Sort.c">
|
||||
<ClCompile Include"src\Sort.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\Threads.c">
|
||||
<ClCompile Include"src\Threads.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\Xz.c">
|
||||
<ClCompile Include"src\Xz.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\XzCrc64.c">
|
||||
<ClCompile Include"src\XzCrc64.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\XzCrc64Opt.c">
|
||||
<ClCompile Include"src\XzCrc64Opt.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\XzDec.c">
|
||||
<ClCompile Include"src\XzDec.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\XzEnc.c">
|
||||
<ClCompile Include"src\XzEnc.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="7z\XzIn.c">
|
||||
<ClCompile Include"src\XzIn.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
Vendored
-184
@@ -1,184 +0,0 @@
|
||||
/* AesOpt.c -- Intel's AES
|
||||
2017-06-08 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
#include "CpuArch.h"
|
||||
|
||||
#ifdef MY_CPU_X86_OR_AMD64
|
||||
#if (_MSC_VER > 1500) || (_MSC_FULL_VER >= 150030729)
|
||||
#define USE_INTEL_AES
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_INTEL_AES
|
||||
|
||||
#include <wmmintrin.h>
|
||||
|
||||
void MY_FAST_CALL AesCbc_Encode_Intel(__m128i *p, __m128i *data, size_t numBlocks)
|
||||
{
|
||||
__m128i m = *p;
|
||||
for (; numBlocks != 0; numBlocks--, data++)
|
||||
{
|
||||
UInt32 numRounds2 = *(const UInt32 *)(p + 1) - 1;
|
||||
const __m128i *w = p + 3;
|
||||
m = _mm_xor_si128(m, *data);
|
||||
m = _mm_xor_si128(m, p[2]);
|
||||
do
|
||||
{
|
||||
m = _mm_aesenc_si128(m, w[0]);
|
||||
m = _mm_aesenc_si128(m, w[1]);
|
||||
w += 2;
|
||||
}
|
||||
while (--numRounds2 != 0);
|
||||
m = _mm_aesenc_si128(m, w[0]);
|
||||
m = _mm_aesenclast_si128(m, w[1]);
|
||||
*data = m;
|
||||
}
|
||||
*p = m;
|
||||
}
|
||||
|
||||
#define NUM_WAYS 3
|
||||
|
||||
#define AES_OP_W(op, n) { \
|
||||
const __m128i t = w[n]; \
|
||||
m0 = op(m0, t); \
|
||||
m1 = op(m1, t); \
|
||||
m2 = op(m2, t); \
|
||||
}
|
||||
|
||||
#define AES_DEC(n) AES_OP_W(_mm_aesdec_si128, n)
|
||||
#define AES_DEC_LAST(n) AES_OP_W(_mm_aesdeclast_si128, n)
|
||||
#define AES_ENC(n) AES_OP_W(_mm_aesenc_si128, n)
|
||||
#define AES_ENC_LAST(n) AES_OP_W(_mm_aesenclast_si128, n)
|
||||
|
||||
void MY_FAST_CALL AesCbc_Decode_Intel(__m128i *p, __m128i *data, size_t numBlocks)
|
||||
{
|
||||
__m128i iv = *p;
|
||||
for (; numBlocks >= NUM_WAYS; numBlocks -= NUM_WAYS, data += NUM_WAYS)
|
||||
{
|
||||
UInt32 numRounds2 = *(const UInt32 *)(p + 1);
|
||||
const __m128i *w = p + numRounds2 * 2;
|
||||
__m128i m0, m1, m2;
|
||||
{
|
||||
const __m128i t = w[2];
|
||||
m0 = _mm_xor_si128(t, data[0]);
|
||||
m1 = _mm_xor_si128(t, data[1]);
|
||||
m2 = _mm_xor_si128(t, data[2]);
|
||||
}
|
||||
numRounds2--;
|
||||
do
|
||||
{
|
||||
AES_DEC(1)
|
||||
AES_DEC(0)
|
||||
w -= 2;
|
||||
}
|
||||
while (--numRounds2 != 0);
|
||||
AES_DEC(1)
|
||||
AES_DEC_LAST(0)
|
||||
|
||||
{
|
||||
__m128i t;
|
||||
t = _mm_xor_si128(m0, iv); iv = data[0]; data[0] = t;
|
||||
t = _mm_xor_si128(m1, iv); iv = data[1]; data[1] = t;
|
||||
t = _mm_xor_si128(m2, iv); iv = data[2]; data[2] = t;
|
||||
}
|
||||
}
|
||||
for (; numBlocks != 0; numBlocks--, data++)
|
||||
{
|
||||
UInt32 numRounds2 = *(const UInt32 *)(p + 1);
|
||||
const __m128i *w = p + numRounds2 * 2;
|
||||
__m128i m = _mm_xor_si128(w[2], *data);
|
||||
numRounds2--;
|
||||
do
|
||||
{
|
||||
m = _mm_aesdec_si128(m, w[1]);
|
||||
m = _mm_aesdec_si128(m, w[0]);
|
||||
w -= 2;
|
||||
}
|
||||
while (--numRounds2 != 0);
|
||||
m = _mm_aesdec_si128(m, w[1]);
|
||||
m = _mm_aesdeclast_si128(m, w[0]);
|
||||
|
||||
m = _mm_xor_si128(m, iv);
|
||||
iv = *data;
|
||||
*data = m;
|
||||
}
|
||||
*p = iv;
|
||||
}
|
||||
|
||||
void MY_FAST_CALL AesCtr_Code_Intel(__m128i *p, __m128i *data, size_t numBlocks)
|
||||
{
|
||||
__m128i ctr = *p;
|
||||
__m128i one;
|
||||
one.m128i_u64[0] = 1;
|
||||
one.m128i_u64[1] = 0;
|
||||
for (; numBlocks >= NUM_WAYS; numBlocks -= NUM_WAYS, data += NUM_WAYS)
|
||||
{
|
||||
UInt32 numRounds2 = *(const UInt32 *)(p + 1) - 1;
|
||||
const __m128i *w = p;
|
||||
__m128i m0, m1, m2;
|
||||
{
|
||||
const __m128i t = w[2];
|
||||
ctr = _mm_add_epi64(ctr, one); m0 = _mm_xor_si128(ctr, t);
|
||||
ctr = _mm_add_epi64(ctr, one); m1 = _mm_xor_si128(ctr, t);
|
||||
ctr = _mm_add_epi64(ctr, one); m2 = _mm_xor_si128(ctr, t);
|
||||
}
|
||||
w += 3;
|
||||
do
|
||||
{
|
||||
AES_ENC(0)
|
||||
AES_ENC(1)
|
||||
w += 2;
|
||||
}
|
||||
while (--numRounds2 != 0);
|
||||
AES_ENC(0)
|
||||
AES_ENC_LAST(1)
|
||||
data[0] = _mm_xor_si128(data[0], m0);
|
||||
data[1] = _mm_xor_si128(data[1], m1);
|
||||
data[2] = _mm_xor_si128(data[2], m2);
|
||||
}
|
||||
for (; numBlocks != 0; numBlocks--, data++)
|
||||
{
|
||||
UInt32 numRounds2 = *(const UInt32 *)(p + 1) - 1;
|
||||
const __m128i *w = p;
|
||||
__m128i m;
|
||||
ctr = _mm_add_epi64(ctr, one);
|
||||
m = _mm_xor_si128(ctr, p[2]);
|
||||
w += 3;
|
||||
do
|
||||
{
|
||||
m = _mm_aesenc_si128(m, w[0]);
|
||||
m = _mm_aesenc_si128(m, w[1]);
|
||||
w += 2;
|
||||
}
|
||||
while (--numRounds2 != 0);
|
||||
m = _mm_aesenc_si128(m, w[0]);
|
||||
m = _mm_aesenclast_si128(m, w[1]);
|
||||
*data = _mm_xor_si128(*data, m);
|
||||
}
|
||||
*p = ctr;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void MY_FAST_CALL AesCbc_Encode(UInt32 *ivAes, Byte *data, size_t numBlocks);
|
||||
void MY_FAST_CALL AesCbc_Decode(UInt32 *ivAes, Byte *data, size_t numBlocks);
|
||||
void MY_FAST_CALL AesCtr_Code(UInt32 *ivAes, Byte *data, size_t numBlocks);
|
||||
|
||||
void MY_FAST_CALL AesCbc_Encode_Intel(UInt32 *p, Byte *data, size_t numBlocks)
|
||||
{
|
||||
AesCbc_Encode(p, data, numBlocks);
|
||||
}
|
||||
|
||||
void MY_FAST_CALL AesCbc_Decode_Intel(UInt32 *p, Byte *data, size_t numBlocks)
|
||||
{
|
||||
AesCbc_Decode(p, data, numBlocks);
|
||||
}
|
||||
|
||||
void MY_FAST_CALL AesCtr_Code_Intel(UInt32 *p, Byte *data, size_t numBlocks)
|
||||
{
|
||||
AesCtr_Code(p, data, numBlocks);
|
||||
}
|
||||
|
||||
#endif
|
||||
Vendored
+58
@@ -0,0 +1,58 @@
|
||||
# 7z sdk
|
||||
if(WIN32)
|
||||
add_library(3rdparty_7z STATIC EXCLUDE_FROM_ALL
|
||||
src/Sha256.c
|
||||
src/Ppmd7Dec.c
|
||||
src/XzDec.c
|
||||
src/XzEnc.c
|
||||
src/Lzma2Dec.c
|
||||
src/XzCrc64.c
|
||||
src/DllSecur.c
|
||||
src/Lzma2DecMt.c
|
||||
src/BraIA64.c
|
||||
src/7zFile.c
|
||||
src/7zStream.c
|
||||
src/Lzma86Enc.c
|
||||
src/Threads.c
|
||||
src/7zAlloc.c
|
||||
src/LzmaEnc.c
|
||||
src/MtCoder.c
|
||||
src/Lzma86Dec.c
|
||||
src/Sort.c
|
||||
src/LzFindMt.c
|
||||
src/7zDec.c
|
||||
src/Bcj2.c
|
||||
src/Ppmd7.c
|
||||
src/Bra86.c
|
||||
src/Bcj2Enc.c
|
||||
src/7zBuf.c
|
||||
src/Aes.c
|
||||
src/AesOpt.c
|
||||
src/XzCrc64Opt.c
|
||||
src/7zArcIn.c
|
||||
src/Lzma2Enc.c
|
||||
src/Bra.c
|
||||
src/7zCrcOpt.c
|
||||
src/7zBuf2.c
|
||||
src/LzFind.c
|
||||
src/Ppmd7Enc.c
|
||||
src/CpuArch.c
|
||||
src/Delta.c
|
||||
src/XzIn.c
|
||||
src/Alloc.c
|
||||
src/Xz.c
|
||||
src/LzmaDec.c
|
||||
src/LzmaLib.c
|
||||
src/7zCrc.c
|
||||
src/MtDec.c)
|
||||
target_include_directories(3rdparty_7z INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
|
||||
$<INSTALL_INTERFACE:/src>)
|
||||
|
||||
target_include_directories(3rdparty_7z INTERFACE 7z)
|
||||
|
||||
set_property(TARGET 3rdparty_7z PROPERTY FOLDER "3rdparty/")
|
||||
|
||||
else()
|
||||
add_library(3rdparty_7z INTERFACE)
|
||||
endif()
|
||||
Vendored
-218
@@ -1,218 +0,0 @@
|
||||
/* CpuArch.c -- CPU specific code
|
||||
2018-02-18: Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
#include "CpuArch.h"
|
||||
|
||||
#ifdef MY_CPU_X86_OR_AMD64
|
||||
|
||||
#if (defined(_MSC_VER) && !defined(MY_CPU_AMD64)) || defined(__GNUC__)
|
||||
#define USE_ASM
|
||||
#endif
|
||||
|
||||
#if !defined(USE_ASM) && _MSC_VER >= 1500
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
|
||||
#if defined(USE_ASM) && !defined(MY_CPU_AMD64)
|
||||
static UInt32 CheckFlag(UInt32 flag)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
__asm pushfd;
|
||||
__asm pop EAX;
|
||||
__asm mov EDX, EAX;
|
||||
__asm xor EAX, flag;
|
||||
__asm push EAX;
|
||||
__asm popfd;
|
||||
__asm pushfd;
|
||||
__asm pop EAX;
|
||||
__asm xor EAX, EDX;
|
||||
__asm push EDX;
|
||||
__asm popfd;
|
||||
__asm and flag, EAX;
|
||||
#else
|
||||
__asm__ __volatile__ (
|
||||
"pushf\n\t"
|
||||
"pop %%EAX\n\t"
|
||||
"movl %%EAX,%%EDX\n\t"
|
||||
"xorl %0,%%EAX\n\t"
|
||||
"push %%EAX\n\t"
|
||||
"popf\n\t"
|
||||
"pushf\n\t"
|
||||
"pop %%EAX\n\t"
|
||||
"xorl %%EDX,%%EAX\n\t"
|
||||
"push %%EDX\n\t"
|
||||
"popf\n\t"
|
||||
"andl %%EAX, %0\n\t":
|
||||
"=c" (flag) : "c" (flag) :
|
||||
"%eax", "%edx");
|
||||
#endif
|
||||
return flag;
|
||||
}
|
||||
#define CHECK_CPUID_IS_SUPPORTED if (CheckFlag(1 << 18) == 0 || CheckFlag(1 << 21) == 0) return False;
|
||||
#else
|
||||
#define CHECK_CPUID_IS_SUPPORTED
|
||||
#endif
|
||||
|
||||
void MyCPUID(UInt32 function, UInt32 *a, UInt32 *b, UInt32 *c, UInt32 *d)
|
||||
{
|
||||
#ifdef USE_ASM
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
UInt32 a2, b2, c2, d2;
|
||||
__asm xor EBX, EBX;
|
||||
__asm xor ECX, ECX;
|
||||
__asm xor EDX, EDX;
|
||||
__asm mov EAX, function;
|
||||
__asm cpuid;
|
||||
__asm mov a2, EAX;
|
||||
__asm mov b2, EBX;
|
||||
__asm mov c2, ECX;
|
||||
__asm mov d2, EDX;
|
||||
|
||||
*a = a2;
|
||||
*b = b2;
|
||||
*c = c2;
|
||||
*d = d2;
|
||||
|
||||
#else
|
||||
|
||||
__asm__ __volatile__ (
|
||||
#if defined(MY_CPU_AMD64) && defined(__PIC__)
|
||||
"mov %%rbx, %%rdi;"
|
||||
"cpuid;"
|
||||
"xchg %%rbx, %%rdi;"
|
||||
: "=a" (*a) ,
|
||||
"=D" (*b) ,
|
||||
#elif defined(MY_CPU_X86) && defined(__PIC__)
|
||||
"mov %%ebx, %%edi;"
|
||||
"cpuid;"
|
||||
"xchgl %%ebx, %%edi;"
|
||||
: "=a" (*a) ,
|
||||
"=D" (*b) ,
|
||||
#else
|
||||
"cpuid"
|
||||
: "=a" (*a) ,
|
||||
"=b" (*b) ,
|
||||
#endif
|
||||
"=c" (*c) ,
|
||||
"=d" (*d)
|
||||
: "0" (function)) ;
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
int CPUInfo[4];
|
||||
__cpuid(CPUInfo, function);
|
||||
*a = CPUInfo[0];
|
||||
*b = CPUInfo[1];
|
||||
*c = CPUInfo[2];
|
||||
*d = CPUInfo[3];
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
BoolInt x86cpuid_CheckAndRead(Cx86cpuid *p)
|
||||
{
|
||||
CHECK_CPUID_IS_SUPPORTED
|
||||
MyCPUID(0, &p->maxFunc, &p->vendor[0], &p->vendor[2], &p->vendor[1]);
|
||||
MyCPUID(1, &p->ver, &p->b, &p->c, &p->d);
|
||||
return True;
|
||||
}
|
||||
|
||||
static const UInt32 kVendors[][3] =
|
||||
{
|
||||
{ 0x756E6547, 0x49656E69, 0x6C65746E},
|
||||
{ 0x68747541, 0x69746E65, 0x444D4163},
|
||||
{ 0x746E6543, 0x48727561, 0x736C7561}
|
||||
};
|
||||
|
||||
int x86cpuid_GetFirm(const Cx86cpuid *p)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < sizeof(kVendors) / sizeof(kVendors[i]); i++)
|
||||
{
|
||||
const UInt32 *v = kVendors[i];
|
||||
if (v[0] == p->vendor[0] &&
|
||||
v[1] == p->vendor[1] &&
|
||||
v[2] == p->vendor[2])
|
||||
return (int)i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
BoolInt CPU_Is_InOrder()
|
||||
{
|
||||
Cx86cpuid p;
|
||||
int firm;
|
||||
UInt32 family, model;
|
||||
if (!x86cpuid_CheckAndRead(&p))
|
||||
return True;
|
||||
|
||||
family = x86cpuid_GetFamily(p.ver);
|
||||
model = x86cpuid_GetModel(p.ver);
|
||||
|
||||
firm = x86cpuid_GetFirm(&p);
|
||||
|
||||
switch (firm)
|
||||
{
|
||||
case CPU_FIRM_INTEL: return (family < 6 || (family == 6 && (
|
||||
/* In-Order Atom CPU */
|
||||
model == 0x1C /* 45 nm, N4xx, D4xx, N5xx, D5xx, 230, 330 */
|
||||
|| model == 0x26 /* 45 nm, Z6xx */
|
||||
|| model == 0x27 /* 32 nm, Z2460 */
|
||||
|| model == 0x35 /* 32 nm, Z2760 */
|
||||
|| model == 0x36 /* 32 nm, N2xxx, D2xxx */
|
||||
)));
|
||||
case CPU_FIRM_AMD: return (family < 5 || (family == 5 && (model < 6 || model == 0xA)));
|
||||
case CPU_FIRM_VIA: return (family < 6 || (family == 6 && model < 0xF));
|
||||
}
|
||||
return True;
|
||||
}
|
||||
|
||||
#if !defined(MY_CPU_AMD64) && defined(_WIN32)
|
||||
#include <windows.h>
|
||||
static BoolInt CPU_Sys_Is_SSE_Supported()
|
||||
{
|
||||
OSVERSIONINFO vi;
|
||||
vi.dwOSVersionInfoSize = sizeof(vi);
|
||||
if (!GetVersionEx(&vi))
|
||||
return False;
|
||||
return (vi.dwMajorVersion >= 5);
|
||||
}
|
||||
#define CHECK_SYS_SSE_SUPPORT if (!CPU_Sys_Is_SSE_Supported()) return False;
|
||||
#else
|
||||
#define CHECK_SYS_SSE_SUPPORT
|
||||
#endif
|
||||
|
||||
BoolInt CPU_Is_Aes_Supported()
|
||||
{
|
||||
Cx86cpuid p;
|
||||
CHECK_SYS_SSE_SUPPORT
|
||||
if (!x86cpuid_CheckAndRead(&p))
|
||||
return False;
|
||||
return (p.c >> 25) & 1;
|
||||
}
|
||||
|
||||
BoolInt CPU_IsSupported_PageGB()
|
||||
{
|
||||
Cx86cpuid cpuid;
|
||||
if (!x86cpuid_CheckAndRead(&cpuid))
|
||||
return False;
|
||||
{
|
||||
UInt32 d[4] = { 0 };
|
||||
MyCPUID(0x80000000, &d[0], &d[1], &d[2], &d[3]);
|
||||
if (d[0] < 0x80000001)
|
||||
return False;
|
||||
}
|
||||
{
|
||||
UInt32 d[4] = { 0 };
|
||||
MyCPUID(0x80000001, &d[0], &d[1], &d[2], &d[3]);
|
||||
return (d[3] >> 26) & 1;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Vendored
-64
@@ -1,64 +0,0 @@
|
||||
/* Delta.c -- Delta converter
|
||||
2009-05-26 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
#include "Delta.h"
|
||||
|
||||
void Delta_Init(Byte *state)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < DELTA_STATE_SIZE; i++)
|
||||
state[i] = 0;
|
||||
}
|
||||
|
||||
static void MyMemCpy(Byte *dest, const Byte *src, unsigned size)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < size; i++)
|
||||
dest[i] = src[i];
|
||||
}
|
||||
|
||||
void Delta_Encode(Byte *state, unsigned delta, Byte *data, SizeT size)
|
||||
{
|
||||
Byte buf[DELTA_STATE_SIZE];
|
||||
unsigned j = 0;
|
||||
MyMemCpy(buf, state, delta);
|
||||
{
|
||||
SizeT i;
|
||||
for (i = 0; i < size;)
|
||||
{
|
||||
for (j = 0; j < delta && i < size; i++, j++)
|
||||
{
|
||||
Byte b = data[i];
|
||||
data[i] = (Byte)(b - buf[j]);
|
||||
buf[j] = b;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (j == delta)
|
||||
j = 0;
|
||||
MyMemCpy(state, buf + j, delta - j);
|
||||
MyMemCpy(state + delta - j, buf, j);
|
||||
}
|
||||
|
||||
void Delta_Decode(Byte *state, unsigned delta, Byte *data, SizeT size)
|
||||
{
|
||||
Byte buf[DELTA_STATE_SIZE];
|
||||
unsigned j = 0;
|
||||
MyMemCpy(buf, state, delta);
|
||||
{
|
||||
SizeT i;
|
||||
for (i = 0; i < size;)
|
||||
{
|
||||
for (j = 0; j < delta && i < size; i++, j++)
|
||||
{
|
||||
buf[j] = data[i] = (Byte)(buf[j] + data[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (j == delta)
|
||||
j = 0;
|
||||
MyMemCpy(state, buf + j, delta - j);
|
||||
MyMemCpy(state + delta - j, buf, j);
|
||||
}
|
||||
Vendored
-1127
File diff suppressed because it is too large
Load Diff
Vendored
-853
@@ -1,853 +0,0 @@
|
||||
/* LzFindMt.c -- multithreaded Match finder for LZ algorithms
|
||||
2018-12-29 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
#include "LzHash.h"
|
||||
|
||||
#include "LzFindMt.h"
|
||||
|
||||
static void MtSync_Construct(CMtSync *p)
|
||||
{
|
||||
p->wasCreated = False;
|
||||
p->csWasInitialized = False;
|
||||
p->csWasEntered = False;
|
||||
Thread_Construct(&p->thread);
|
||||
Event_Construct(&p->canStart);
|
||||
Event_Construct(&p->wasStarted);
|
||||
Event_Construct(&p->wasStopped);
|
||||
Semaphore_Construct(&p->freeSemaphore);
|
||||
Semaphore_Construct(&p->filledSemaphore);
|
||||
}
|
||||
|
||||
static void MtSync_GetNextBlock(CMtSync *p)
|
||||
{
|
||||
if (p->needStart)
|
||||
{
|
||||
p->numProcessedBlocks = 1;
|
||||
p->needStart = False;
|
||||
p->stopWriting = False;
|
||||
p->exit = False;
|
||||
Event_Reset(&p->wasStarted);
|
||||
Event_Reset(&p->wasStopped);
|
||||
|
||||
Event_Set(&p->canStart);
|
||||
Event_Wait(&p->wasStarted);
|
||||
|
||||
// if (mt) MatchFinder_Init_LowHash(mt->MatchFinder);
|
||||
}
|
||||
else
|
||||
{
|
||||
CriticalSection_Leave(&p->cs);
|
||||
p->csWasEntered = False;
|
||||
p->numProcessedBlocks++;
|
||||
Semaphore_Release1(&p->freeSemaphore);
|
||||
}
|
||||
Semaphore_Wait(&p->filledSemaphore);
|
||||
CriticalSection_Enter(&p->cs);
|
||||
p->csWasEntered = True;
|
||||
}
|
||||
|
||||
/* MtSync_StopWriting must be called if Writing was started */
|
||||
|
||||
static void MtSync_StopWriting(CMtSync *p)
|
||||
{
|
||||
UInt32 myNumBlocks = p->numProcessedBlocks;
|
||||
if (!Thread_WasCreated(&p->thread) || p->needStart)
|
||||
return;
|
||||
p->stopWriting = True;
|
||||
if (p->csWasEntered)
|
||||
{
|
||||
CriticalSection_Leave(&p->cs);
|
||||
p->csWasEntered = False;
|
||||
}
|
||||
Semaphore_Release1(&p->freeSemaphore);
|
||||
|
||||
Event_Wait(&p->wasStopped);
|
||||
|
||||
while (myNumBlocks++ != p->numProcessedBlocks)
|
||||
{
|
||||
Semaphore_Wait(&p->filledSemaphore);
|
||||
Semaphore_Release1(&p->freeSemaphore);
|
||||
}
|
||||
p->needStart = True;
|
||||
}
|
||||
|
||||
static void MtSync_Destruct(CMtSync *p)
|
||||
{
|
||||
if (Thread_WasCreated(&p->thread))
|
||||
{
|
||||
MtSync_StopWriting(p);
|
||||
p->exit = True;
|
||||
if (p->needStart)
|
||||
Event_Set(&p->canStart);
|
||||
Thread_Wait(&p->thread);
|
||||
Thread_Close(&p->thread);
|
||||
}
|
||||
if (p->csWasInitialized)
|
||||
{
|
||||
CriticalSection_Delete(&p->cs);
|
||||
p->csWasInitialized = False;
|
||||
}
|
||||
|
||||
Event_Close(&p->canStart);
|
||||
Event_Close(&p->wasStarted);
|
||||
Event_Close(&p->wasStopped);
|
||||
Semaphore_Close(&p->freeSemaphore);
|
||||
Semaphore_Close(&p->filledSemaphore);
|
||||
|
||||
p->wasCreated = False;
|
||||
}
|
||||
|
||||
#define RINOK_THREAD(x) { if ((x) != 0) return SZ_ERROR_THREAD; }
|
||||
|
||||
static SRes MtSync_Create2(CMtSync *p, THREAD_FUNC_TYPE startAddress, void *obj, UInt32 numBlocks)
|
||||
{
|
||||
if (p->wasCreated)
|
||||
return SZ_OK;
|
||||
|
||||
RINOK_THREAD(CriticalSection_Init(&p->cs));
|
||||
p->csWasInitialized = True;
|
||||
|
||||
RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->canStart));
|
||||
RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->wasStarted));
|
||||
RINOK_THREAD(AutoResetEvent_CreateNotSignaled(&p->wasStopped));
|
||||
|
||||
RINOK_THREAD(Semaphore_Create(&p->freeSemaphore, numBlocks, numBlocks));
|
||||
RINOK_THREAD(Semaphore_Create(&p->filledSemaphore, 0, numBlocks));
|
||||
|
||||
p->needStart = True;
|
||||
|
||||
RINOK_THREAD(Thread_Create(&p->thread, startAddress, obj));
|
||||
p->wasCreated = True;
|
||||
return SZ_OK;
|
||||
}
|
||||
|
||||
static SRes MtSync_Create(CMtSync *p, THREAD_FUNC_TYPE startAddress, void *obj, UInt32 numBlocks)
|
||||
{
|
||||
SRes res = MtSync_Create2(p, startAddress, obj, numBlocks);
|
||||
if (res != SZ_OK)
|
||||
MtSync_Destruct(p);
|
||||
return res;
|
||||
}
|
||||
|
||||
void MtSync_Init(CMtSync *p) { p->needStart = True; }
|
||||
|
||||
#define kMtMaxValForNormalize 0xFFFFFFFF
|
||||
|
||||
#define DEF_GetHeads2(name, v, action) \
|
||||
static void GetHeads ## name(const Byte *p, UInt32 pos, \
|
||||
UInt32 *hash, UInt32 hashMask, UInt32 *heads, UInt32 numHeads, const UInt32 *crc) \
|
||||
{ action; for (; numHeads != 0; numHeads--) { \
|
||||
const UInt32 value = (v); p++; *heads++ = pos - hash[value]; hash[value] = pos++; } }
|
||||
|
||||
#define DEF_GetHeads(name, v) DEF_GetHeads2(name, v, ;)
|
||||
|
||||
DEF_GetHeads2(2, (p[0] | ((UInt32)p[1] << 8)), UNUSED_VAR(hashMask); UNUSED_VAR(crc); )
|
||||
DEF_GetHeads(3, (crc[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8)) & hashMask)
|
||||
DEF_GetHeads(4, (crc[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8) ^ (crc[p[3]] << 5)) & hashMask)
|
||||
DEF_GetHeads(4b, (crc[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8) ^ ((UInt32)p[3] << 16)) & hashMask)
|
||||
/* DEF_GetHeads(5, (crc[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8) ^ (crc[p[3]] << 5) ^ (crc[p[4]] << 3)) & hashMask) */
|
||||
|
||||
static void HashThreadFunc(CMatchFinderMt *mt)
|
||||
{
|
||||
CMtSync *p = &mt->hashSync;
|
||||
for (;;)
|
||||
{
|
||||
UInt32 numProcessedBlocks = 0;
|
||||
Event_Wait(&p->canStart);
|
||||
Event_Set(&p->wasStarted);
|
||||
|
||||
MatchFinder_Init_HighHash(mt->MatchFinder);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (p->exit)
|
||||
return;
|
||||
if (p->stopWriting)
|
||||
{
|
||||
p->numProcessedBlocks = numProcessedBlocks;
|
||||
Event_Set(&p->wasStopped);
|
||||
break;
|
||||
}
|
||||
|
||||
{
|
||||
CMatchFinder *mf = mt->MatchFinder;
|
||||
if (MatchFinder_NeedMove(mf))
|
||||
{
|
||||
CriticalSection_Enter(&mt->btSync.cs);
|
||||
CriticalSection_Enter(&mt->hashSync.cs);
|
||||
{
|
||||
const Byte *beforePtr = Inline_MatchFinder_GetPointerToCurrentPos(mf);
|
||||
ptrdiff_t offset;
|
||||
MatchFinder_MoveBlock(mf);
|
||||
offset = beforePtr - Inline_MatchFinder_GetPointerToCurrentPos(mf);
|
||||
mt->pointerToCurPos -= offset;
|
||||
mt->buffer -= offset;
|
||||
}
|
||||
CriticalSection_Leave(&mt->btSync.cs);
|
||||
CriticalSection_Leave(&mt->hashSync.cs);
|
||||
continue;
|
||||
}
|
||||
|
||||
Semaphore_Wait(&p->freeSemaphore);
|
||||
|
||||
MatchFinder_ReadIfRequired(mf);
|
||||
if (mf->pos > (kMtMaxValForNormalize - kMtHashBlockSize))
|
||||
{
|
||||
UInt32 subValue = (mf->pos - mf->historySize - 1);
|
||||
MatchFinder_ReduceOffsets(mf, subValue);
|
||||
MatchFinder_Normalize3(subValue, mf->hash + mf->fixedHashSize, (size_t)mf->hashMask + 1);
|
||||
}
|
||||
{
|
||||
UInt32 *heads = mt->hashBuf + ((numProcessedBlocks++) & kMtHashNumBlocksMask) * kMtHashBlockSize;
|
||||
UInt32 num = mf->streamPos - mf->pos;
|
||||
heads[0] = 2;
|
||||
heads[1] = num;
|
||||
if (num >= mf->numHashBytes)
|
||||
{
|
||||
num = num - mf->numHashBytes + 1;
|
||||
if (num > kMtHashBlockSize - 2)
|
||||
num = kMtHashBlockSize - 2;
|
||||
mt->GetHeadsFunc(mf->buffer, mf->pos, mf->hash + mf->fixedHashSize, mf->hashMask, heads + 2, num, mf->crc);
|
||||
heads[0] = 2 + num;
|
||||
}
|
||||
mf->pos += num;
|
||||
mf->buffer += num;
|
||||
}
|
||||
}
|
||||
|
||||
Semaphore_Release1(&p->filledSemaphore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void MatchFinderMt_GetNextBlock_Hash(CMatchFinderMt *p)
|
||||
{
|
||||
MtSync_GetNextBlock(&p->hashSync);
|
||||
p->hashBufPosLimit = p->hashBufPos = ((p->hashSync.numProcessedBlocks - 1) & kMtHashNumBlocksMask) * kMtHashBlockSize;
|
||||
p->hashBufPosLimit += p->hashBuf[p->hashBufPos++];
|
||||
p->hashNumAvail = p->hashBuf[p->hashBufPos++];
|
||||
}
|
||||
|
||||
#define kEmptyHashValue 0
|
||||
|
||||
#define MFMT_GM_INLINE
|
||||
|
||||
#ifdef MFMT_GM_INLINE
|
||||
|
||||
/*
|
||||
we use size_t for _cyclicBufferPos instead of UInt32
|
||||
to eliminate "movsx" BUG in old MSVC x64 compiler.
|
||||
*/
|
||||
|
||||
MY_NO_INLINE
|
||||
static UInt32 *GetMatchesSpecN(UInt32 lenLimit, UInt32 pos, const Byte *cur, CLzRef *son,
|
||||
size_t _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
|
||||
UInt32 *distances, UInt32 _maxLen, const UInt32 *hash, const UInt32 *limit, UInt32 size, UInt32 *posRes)
|
||||
{
|
||||
do
|
||||
{
|
||||
UInt32 *_distances = ++distances;
|
||||
UInt32 delta = *hash++;
|
||||
|
||||
CLzRef *ptr0 = son + ((size_t)_cyclicBufferPos << 1) + 1;
|
||||
CLzRef *ptr1 = son + ((size_t)_cyclicBufferPos << 1);
|
||||
unsigned len0 = 0, len1 = 0;
|
||||
UInt32 cutValue = _cutValue;
|
||||
unsigned maxLen = (unsigned)_maxLen;
|
||||
|
||||
/*
|
||||
if (size > 1)
|
||||
{
|
||||
UInt32 delta = *hash;
|
||||
if (delta < _cyclicBufferSize)
|
||||
{
|
||||
UInt32 cyc1 = _cyclicBufferPos + 1;
|
||||
CLzRef *pair = son + ((size_t)(cyc1 - delta + ((delta > cyc1) ? _cyclicBufferSize : 0)) << 1);
|
||||
Byte b = *(cur + 1 - delta);
|
||||
_distances[0] = pair[0];
|
||||
_distances[1] = b;
|
||||
}
|
||||
}
|
||||
*/
|
||||
if (cutValue == 0 || delta >= _cyclicBufferSize)
|
||||
{
|
||||
*ptr0 = *ptr1 = kEmptyHashValue;
|
||||
}
|
||||
else
|
||||
for(;;)
|
||||
{
|
||||
{
|
||||
CLzRef *pair = son + ((size_t)(_cyclicBufferPos - delta + ((_cyclicBufferPos < delta) ? _cyclicBufferSize : 0)) << 1);
|
||||
const Byte *pb = cur - delta;
|
||||
unsigned len = (len0 < len1 ? len0 : len1);
|
||||
UInt32 pair0 = *pair;
|
||||
if (pb[len] == cur[len])
|
||||
{
|
||||
if (++len != lenLimit && pb[len] == cur[len])
|
||||
while (++len != lenLimit)
|
||||
if (pb[len] != cur[len])
|
||||
break;
|
||||
if (maxLen < len)
|
||||
{
|
||||
maxLen = len;
|
||||
*distances++ = (UInt32)len;
|
||||
*distances++ = delta - 1;
|
||||
if (len == lenLimit)
|
||||
{
|
||||
UInt32 pair1 = pair[1];
|
||||
*ptr1 = pair0;
|
||||
*ptr0 = pair1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
UInt32 curMatch = pos - delta;
|
||||
// delta = pos - *pair;
|
||||
// delta = pos - pair[((UInt32)pb[len] - (UInt32)cur[len]) >> 31];
|
||||
if (pb[len] < cur[len])
|
||||
{
|
||||
delta = pos - pair[1];
|
||||
*ptr1 = curMatch;
|
||||
ptr1 = pair + 1;
|
||||
len1 = len;
|
||||
}
|
||||
else
|
||||
{
|
||||
delta = pos - *pair;
|
||||
*ptr0 = curMatch;
|
||||
ptr0 = pair;
|
||||
len0 = len;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (--cutValue == 0 || delta >= _cyclicBufferSize)
|
||||
{
|
||||
*ptr0 = *ptr1 = kEmptyHashValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
pos++;
|
||||
_cyclicBufferPos++;
|
||||
cur++;
|
||||
{
|
||||
UInt32 num = (UInt32)(distances - _distances);
|
||||
_distances[-1] = num;
|
||||
}
|
||||
}
|
||||
while (distances < limit && --size != 0);
|
||||
*posRes = pos;
|
||||
return distances;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static void BtGetMatches(CMatchFinderMt *p, UInt32 *distances)
|
||||
{
|
||||
UInt32 numProcessed = 0;
|
||||
UInt32 curPos = 2;
|
||||
UInt32 limit = kMtBtBlockSize - (p->matchMaxLen * 2); // * 2
|
||||
|
||||
distances[1] = p->hashNumAvail;
|
||||
|
||||
while (curPos < limit)
|
||||
{
|
||||
if (p->hashBufPos == p->hashBufPosLimit)
|
||||
{
|
||||
MatchFinderMt_GetNextBlock_Hash(p);
|
||||
distances[1] = numProcessed + p->hashNumAvail;
|
||||
if (p->hashNumAvail >= p->numHashBytes)
|
||||
continue;
|
||||
distances[0] = curPos + p->hashNumAvail;
|
||||
distances += curPos;
|
||||
for (; p->hashNumAvail != 0; p->hashNumAvail--)
|
||||
*distances++ = 0;
|
||||
return;
|
||||
}
|
||||
{
|
||||
UInt32 size = p->hashBufPosLimit - p->hashBufPos;
|
||||
UInt32 lenLimit = p->matchMaxLen;
|
||||
UInt32 pos = p->pos;
|
||||
UInt32 cyclicBufferPos = p->cyclicBufferPos;
|
||||
if (lenLimit >= p->hashNumAvail)
|
||||
lenLimit = p->hashNumAvail;
|
||||
{
|
||||
UInt32 size2 = p->hashNumAvail - lenLimit + 1;
|
||||
if (size2 < size)
|
||||
size = size2;
|
||||
size2 = p->cyclicBufferSize - cyclicBufferPos;
|
||||
if (size2 < size)
|
||||
size = size2;
|
||||
}
|
||||
|
||||
#ifndef MFMT_GM_INLINE
|
||||
while (curPos < limit && size-- != 0)
|
||||
{
|
||||
UInt32 *startDistances = distances + curPos;
|
||||
UInt32 num = (UInt32)(GetMatchesSpec1(lenLimit, pos - p->hashBuf[p->hashBufPos++],
|
||||
pos, p->buffer, p->son, cyclicBufferPos, p->cyclicBufferSize, p->cutValue,
|
||||
startDistances + 1, p->numHashBytes - 1) - startDistances);
|
||||
*startDistances = num - 1;
|
||||
curPos += num;
|
||||
cyclicBufferPos++;
|
||||
pos++;
|
||||
p->buffer++;
|
||||
}
|
||||
#else
|
||||
{
|
||||
UInt32 posRes;
|
||||
curPos = (UInt32)(GetMatchesSpecN(lenLimit, pos, p->buffer, p->son, cyclicBufferPos, p->cyclicBufferSize, p->cutValue,
|
||||
distances + curPos, p->numHashBytes - 1, p->hashBuf + p->hashBufPos,
|
||||
distances + limit,
|
||||
size, &posRes) - distances);
|
||||
p->hashBufPos += posRes - pos;
|
||||
cyclicBufferPos += posRes - pos;
|
||||
p->buffer += posRes - pos;
|
||||
pos = posRes;
|
||||
}
|
||||
#endif
|
||||
|
||||
numProcessed += pos - p->pos;
|
||||
p->hashNumAvail -= pos - p->pos;
|
||||
p->pos = pos;
|
||||
if (cyclicBufferPos == p->cyclicBufferSize)
|
||||
cyclicBufferPos = 0;
|
||||
p->cyclicBufferPos = cyclicBufferPos;
|
||||
}
|
||||
}
|
||||
|
||||
distances[0] = curPos;
|
||||
}
|
||||
|
||||
static void BtFillBlock(CMatchFinderMt *p, UInt32 globalBlockIndex)
|
||||
{
|
||||
CMtSync *sync = &p->hashSync;
|
||||
if (!sync->needStart)
|
||||
{
|
||||
CriticalSection_Enter(&sync->cs);
|
||||
sync->csWasEntered = True;
|
||||
}
|
||||
|
||||
BtGetMatches(p, p->btBuf + (globalBlockIndex & kMtBtNumBlocksMask) * kMtBtBlockSize);
|
||||
|
||||
if (p->pos > kMtMaxValForNormalize - kMtBtBlockSize)
|
||||
{
|
||||
UInt32 subValue = p->pos - p->cyclicBufferSize;
|
||||
MatchFinder_Normalize3(subValue, p->son, (size_t)p->cyclicBufferSize * 2);
|
||||
p->pos -= subValue;
|
||||
}
|
||||
|
||||
if (!sync->needStart)
|
||||
{
|
||||
CriticalSection_Leave(&sync->cs);
|
||||
sync->csWasEntered = False;
|
||||
}
|
||||
}
|
||||
|
||||
void BtThreadFunc(CMatchFinderMt *mt)
|
||||
{
|
||||
CMtSync *p = &mt->btSync;
|
||||
for (;;)
|
||||
{
|
||||
UInt32 blockIndex = 0;
|
||||
Event_Wait(&p->canStart);
|
||||
Event_Set(&p->wasStarted);
|
||||
for (;;)
|
||||
{
|
||||
if (p->exit)
|
||||
return;
|
||||
if (p->stopWriting)
|
||||
{
|
||||
p->numProcessedBlocks = blockIndex;
|
||||
MtSync_StopWriting(&mt->hashSync);
|
||||
Event_Set(&p->wasStopped);
|
||||
break;
|
||||
}
|
||||
Semaphore_Wait(&p->freeSemaphore);
|
||||
BtFillBlock(mt, blockIndex++);
|
||||
Semaphore_Release1(&p->filledSemaphore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MatchFinderMt_Construct(CMatchFinderMt *p)
|
||||
{
|
||||
p->hashBuf = NULL;
|
||||
MtSync_Construct(&p->hashSync);
|
||||
MtSync_Construct(&p->btSync);
|
||||
}
|
||||
|
||||
static void MatchFinderMt_FreeMem(CMatchFinderMt *p, ISzAllocPtr alloc)
|
||||
{
|
||||
ISzAlloc_Free(alloc, p->hashBuf);
|
||||
p->hashBuf = NULL;
|
||||
}
|
||||
|
||||
void MatchFinderMt_Destruct(CMatchFinderMt *p, ISzAllocPtr alloc)
|
||||
{
|
||||
MtSync_Destruct(&p->hashSync);
|
||||
MtSync_Destruct(&p->btSync);
|
||||
MatchFinderMt_FreeMem(p, alloc);
|
||||
}
|
||||
|
||||
#define kHashBufferSize (kMtHashBlockSize * kMtHashNumBlocks)
|
||||
#define kBtBufferSize (kMtBtBlockSize * kMtBtNumBlocks)
|
||||
|
||||
static THREAD_FUNC_RET_TYPE THREAD_FUNC_CALL_TYPE HashThreadFunc2(void *p) { HashThreadFunc((CMatchFinderMt *)p); return 0; }
|
||||
static THREAD_FUNC_RET_TYPE THREAD_FUNC_CALL_TYPE BtThreadFunc2(void *p)
|
||||
{
|
||||
Byte allocaDummy[0x180];
|
||||
unsigned i = 0;
|
||||
for (i = 0; i < 16; i++)
|
||||
allocaDummy[i] = (Byte)0;
|
||||
if (allocaDummy[0] == 0)
|
||||
BtThreadFunc((CMatchFinderMt *)p);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SRes MatchFinderMt_Create(CMatchFinderMt *p, UInt32 historySize, UInt32 keepAddBufferBefore,
|
||||
UInt32 matchMaxLen, UInt32 keepAddBufferAfter, ISzAllocPtr alloc)
|
||||
{
|
||||
CMatchFinder *mf = p->MatchFinder;
|
||||
p->historySize = historySize;
|
||||
if (kMtBtBlockSize <= matchMaxLen * 4)
|
||||
return SZ_ERROR_PARAM;
|
||||
if (!p->hashBuf)
|
||||
{
|
||||
p->hashBuf = (UInt32 *)ISzAlloc_Alloc(alloc, (kHashBufferSize + kBtBufferSize) * sizeof(UInt32));
|
||||
if (!p->hashBuf)
|
||||
return SZ_ERROR_MEM;
|
||||
p->btBuf = p->hashBuf + kHashBufferSize;
|
||||
}
|
||||
keepAddBufferBefore += (kHashBufferSize + kBtBufferSize);
|
||||
keepAddBufferAfter += kMtHashBlockSize;
|
||||
if (!MatchFinder_Create(mf, historySize, keepAddBufferBefore, matchMaxLen, keepAddBufferAfter, alloc))
|
||||
return SZ_ERROR_MEM;
|
||||
|
||||
RINOK(MtSync_Create(&p->hashSync, HashThreadFunc2, p, kMtHashNumBlocks));
|
||||
RINOK(MtSync_Create(&p->btSync, BtThreadFunc2, p, kMtBtNumBlocks));
|
||||
return SZ_OK;
|
||||
}
|
||||
|
||||
/* Call it after ReleaseStream / SetStream */
|
||||
static void MatchFinderMt_Init(CMatchFinderMt *p)
|
||||
{
|
||||
CMatchFinder *mf = p->MatchFinder;
|
||||
|
||||
p->btBufPos =
|
||||
p->btBufPosLimit = 0;
|
||||
p->hashBufPos =
|
||||
p->hashBufPosLimit = 0;
|
||||
|
||||
/* Init without data reading. We don't want to read data in this thread */
|
||||
MatchFinder_Init_3(mf, False);
|
||||
MatchFinder_Init_LowHash(mf);
|
||||
|
||||
p->pointerToCurPos = Inline_MatchFinder_GetPointerToCurrentPos(mf);
|
||||
p->btNumAvailBytes = 0;
|
||||
p->lzPos = p->historySize + 1;
|
||||
|
||||
p->hash = mf->hash;
|
||||
p->fixedHashSize = mf->fixedHashSize;
|
||||
p->crc = mf->crc;
|
||||
|
||||
p->son = mf->son;
|
||||
p->matchMaxLen = mf->matchMaxLen;
|
||||
p->numHashBytes = mf->numHashBytes;
|
||||
p->pos = mf->pos;
|
||||
p->buffer = mf->buffer;
|
||||
p->cyclicBufferPos = mf->cyclicBufferPos;
|
||||
p->cyclicBufferSize = mf->cyclicBufferSize;
|
||||
p->cutValue = mf->cutValue;
|
||||
}
|
||||
|
||||
/* ReleaseStream is required to finish multithreading */
|
||||
void MatchFinderMt_ReleaseStream(CMatchFinderMt *p)
|
||||
{
|
||||
MtSync_StopWriting(&p->btSync);
|
||||
/* p->MatchFinder->ReleaseStream(); */
|
||||
}
|
||||
|
||||
static void MatchFinderMt_Normalize(CMatchFinderMt *p)
|
||||
{
|
||||
MatchFinder_Normalize3(p->lzPos - p->historySize - 1, p->hash, p->fixedHashSize);
|
||||
p->lzPos = p->historySize + 1;
|
||||
}
|
||||
|
||||
static void MatchFinderMt_GetNextBlock_Bt(CMatchFinderMt *p)
|
||||
{
|
||||
UInt32 blockIndex;
|
||||
MtSync_GetNextBlock(&p->btSync);
|
||||
blockIndex = ((p->btSync.numProcessedBlocks - 1) & kMtBtNumBlocksMask);
|
||||
p->btBufPosLimit = p->btBufPos = blockIndex * kMtBtBlockSize;
|
||||
p->btBufPosLimit += p->btBuf[p->btBufPos++];
|
||||
p->btNumAvailBytes = p->btBuf[p->btBufPos++];
|
||||
if (p->lzPos >= kMtMaxValForNormalize - kMtBtBlockSize)
|
||||
MatchFinderMt_Normalize(p);
|
||||
}
|
||||
|
||||
static const Byte * MatchFinderMt_GetPointerToCurrentPos(CMatchFinderMt *p)
|
||||
{
|
||||
return p->pointerToCurPos;
|
||||
}
|
||||
|
||||
#define GET_NEXT_BLOCK_IF_REQUIRED if (p->btBufPos == p->btBufPosLimit) MatchFinderMt_GetNextBlock_Bt(p);
|
||||
|
||||
static UInt32 MatchFinderMt_GetNumAvailableBytes(CMatchFinderMt *p)
|
||||
{
|
||||
GET_NEXT_BLOCK_IF_REQUIRED;
|
||||
return p->btNumAvailBytes;
|
||||
}
|
||||
|
||||
static UInt32 * MixMatches2(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances)
|
||||
{
|
||||
UInt32 h2, curMatch2;
|
||||
UInt32 *hash = p->hash;
|
||||
const Byte *cur = p->pointerToCurPos;
|
||||
UInt32 lzPos = p->lzPos;
|
||||
MT_HASH2_CALC
|
||||
|
||||
curMatch2 = hash[h2];
|
||||
hash[h2] = lzPos;
|
||||
|
||||
if (curMatch2 >= matchMinPos)
|
||||
if (cur[(ptrdiff_t)curMatch2 - lzPos] == cur[0])
|
||||
{
|
||||
*distances++ = 2;
|
||||
*distances++ = lzPos - curMatch2 - 1;
|
||||
}
|
||||
|
||||
return distances;
|
||||
}
|
||||
|
||||
static UInt32 * MixMatches3(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances)
|
||||
{
|
||||
UInt32 h2, h3, curMatch2, curMatch3;
|
||||
UInt32 *hash = p->hash;
|
||||
const Byte *cur = p->pointerToCurPos;
|
||||
UInt32 lzPos = p->lzPos;
|
||||
MT_HASH3_CALC
|
||||
|
||||
curMatch2 = hash[ h2];
|
||||
curMatch3 = (hash + kFix3HashSize)[h3];
|
||||
|
||||
hash[ h2] = lzPos;
|
||||
(hash + kFix3HashSize)[h3] = lzPos;
|
||||
|
||||
if (curMatch2 >= matchMinPos && cur[(ptrdiff_t)curMatch2 - lzPos] == cur[0])
|
||||
{
|
||||
distances[1] = lzPos - curMatch2 - 1;
|
||||
if (cur[(ptrdiff_t)curMatch2 - lzPos + 2] == cur[2])
|
||||
{
|
||||
distances[0] = 3;
|
||||
return distances + 2;
|
||||
}
|
||||
distances[0] = 2;
|
||||
distances += 2;
|
||||
}
|
||||
|
||||
if (curMatch3 >= matchMinPos && cur[(ptrdiff_t)curMatch3 - lzPos] == cur[0])
|
||||
{
|
||||
*distances++ = 3;
|
||||
*distances++ = lzPos - curMatch3 - 1;
|
||||
}
|
||||
|
||||
return distances;
|
||||
}
|
||||
|
||||
/*
|
||||
static UInt32 *MixMatches4(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances)
|
||||
{
|
||||
UInt32 h2, h3, h4, curMatch2, curMatch3, curMatch4;
|
||||
UInt32 *hash = p->hash;
|
||||
const Byte *cur = p->pointerToCurPos;
|
||||
UInt32 lzPos = p->lzPos;
|
||||
MT_HASH4_CALC
|
||||
|
||||
curMatch2 = hash[ h2];
|
||||
curMatch3 = (hash + kFix3HashSize)[h3];
|
||||
curMatch4 = (hash + kFix4HashSize)[h4];
|
||||
|
||||
hash[ h2] = lzPos;
|
||||
(hash + kFix3HashSize)[h3] = lzPos;
|
||||
(hash + kFix4HashSize)[h4] = lzPos;
|
||||
|
||||
if (curMatch2 >= matchMinPos && cur[(ptrdiff_t)curMatch2 - lzPos] == cur[0])
|
||||
{
|
||||
distances[1] = lzPos - curMatch2 - 1;
|
||||
if (cur[(ptrdiff_t)curMatch2 - lzPos + 2] == cur[2])
|
||||
{
|
||||
distances[0] = (cur[(ptrdiff_t)curMatch2 - lzPos + 3] == cur[3]) ? 4 : 3;
|
||||
return distances + 2;
|
||||
}
|
||||
distances[0] = 2;
|
||||
distances += 2;
|
||||
}
|
||||
|
||||
if (curMatch3 >= matchMinPos && cur[(ptrdiff_t)curMatch3 - lzPos] == cur[0])
|
||||
{
|
||||
distances[1] = lzPos - curMatch3 - 1;
|
||||
if (cur[(ptrdiff_t)curMatch3 - lzPos + 3] == cur[3])
|
||||
{
|
||||
distances[0] = 4;
|
||||
return distances + 2;
|
||||
}
|
||||
distances[0] = 3;
|
||||
distances += 2;
|
||||
}
|
||||
|
||||
if (curMatch4 >= matchMinPos)
|
||||
if (
|
||||
cur[(ptrdiff_t)curMatch4 - lzPos] == cur[0] &&
|
||||
cur[(ptrdiff_t)curMatch4 - lzPos + 3] == cur[3]
|
||||
)
|
||||
{
|
||||
*distances++ = 4;
|
||||
*distances++ = lzPos - curMatch4 - 1;
|
||||
}
|
||||
|
||||
return distances;
|
||||
}
|
||||
*/
|
||||
|
||||
#define INCREASE_LZ_POS p->lzPos++; p->pointerToCurPos++;
|
||||
|
||||
static UInt32 MatchFinderMt2_GetMatches(CMatchFinderMt *p, UInt32 *distances)
|
||||
{
|
||||
const UInt32 *btBuf = p->btBuf + p->btBufPos;
|
||||
UInt32 len = *btBuf++;
|
||||
p->btBufPos += 1 + len;
|
||||
p->btNumAvailBytes--;
|
||||
{
|
||||
UInt32 i;
|
||||
for (i = 0; i < len; i += 2)
|
||||
{
|
||||
UInt32 v0 = btBuf[0];
|
||||
UInt32 v1 = btBuf[1];
|
||||
btBuf += 2;
|
||||
distances[0] = v0;
|
||||
distances[1] = v1;
|
||||
distances += 2;
|
||||
}
|
||||
}
|
||||
INCREASE_LZ_POS
|
||||
return len;
|
||||
}
|
||||
|
||||
static UInt32 MatchFinderMt_GetMatches(CMatchFinderMt *p, UInt32 *distances)
|
||||
{
|
||||
const UInt32 *btBuf = p->btBuf + p->btBufPos;
|
||||
UInt32 len = *btBuf++;
|
||||
p->btBufPos += 1 + len;
|
||||
|
||||
if (len == 0)
|
||||
{
|
||||
/* change for bt5 ! */
|
||||
if (p->btNumAvailBytes-- >= 4)
|
||||
len = (UInt32)(p->MixMatchesFunc(p, p->lzPos - p->historySize, distances) - (distances));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Condition: there are matches in btBuf with length < p->numHashBytes */
|
||||
UInt32 *distances2;
|
||||
p->btNumAvailBytes--;
|
||||
distances2 = p->MixMatchesFunc(p, p->lzPos - btBuf[1], distances);
|
||||
do
|
||||
{
|
||||
UInt32 v0 = btBuf[0];
|
||||
UInt32 v1 = btBuf[1];
|
||||
btBuf += 2;
|
||||
distances2[0] = v0;
|
||||
distances2[1] = v1;
|
||||
distances2 += 2;
|
||||
}
|
||||
while ((len -= 2) != 0);
|
||||
len = (UInt32)(distances2 - (distances));
|
||||
}
|
||||
INCREASE_LZ_POS
|
||||
return len;
|
||||
}
|
||||
|
||||
#define SKIP_HEADER2_MT do { GET_NEXT_BLOCK_IF_REQUIRED
|
||||
#define SKIP_HEADER_MT(n) SKIP_HEADER2_MT if (p->btNumAvailBytes-- >= (n)) { const Byte *cur = p->pointerToCurPos; UInt32 *hash = p->hash;
|
||||
#define SKIP_FOOTER_MT } INCREASE_LZ_POS p->btBufPos += p->btBuf[p->btBufPos] + 1; } while (--num != 0);
|
||||
|
||||
static void MatchFinderMt0_Skip(CMatchFinderMt *p, UInt32 num)
|
||||
{
|
||||
SKIP_HEADER2_MT { p->btNumAvailBytes--;
|
||||
SKIP_FOOTER_MT
|
||||
}
|
||||
|
||||
static void MatchFinderMt2_Skip(CMatchFinderMt *p, UInt32 num)
|
||||
{
|
||||
SKIP_HEADER_MT(2)
|
||||
UInt32 h2;
|
||||
MT_HASH2_CALC
|
||||
hash[h2] = p->lzPos;
|
||||
SKIP_FOOTER_MT
|
||||
}
|
||||
|
||||
static void MatchFinderMt3_Skip(CMatchFinderMt *p, UInt32 num)
|
||||
{
|
||||
SKIP_HEADER_MT(3)
|
||||
UInt32 h2, h3;
|
||||
MT_HASH3_CALC
|
||||
(hash + kFix3HashSize)[h3] =
|
||||
hash[ h2] =
|
||||
p->lzPos;
|
||||
SKIP_FOOTER_MT
|
||||
}
|
||||
|
||||
/*
|
||||
static void MatchFinderMt4_Skip(CMatchFinderMt *p, UInt32 num)
|
||||
{
|
||||
SKIP_HEADER_MT(4)
|
||||
UInt32 h2, h3, h4;
|
||||
MT_HASH4_CALC
|
||||
(hash + kFix4HashSize)[h4] =
|
||||
(hash + kFix3HashSize)[h3] =
|
||||
hash[ h2] =
|
||||
p->lzPos;
|
||||
SKIP_FOOTER_MT
|
||||
}
|
||||
*/
|
||||
|
||||
void MatchFinderMt_CreateVTable(CMatchFinderMt *p, IMatchFinder *vTable)
|
||||
{
|
||||
vTable->Init = (Mf_Init_Func)MatchFinderMt_Init;
|
||||
vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinderMt_GetNumAvailableBytes;
|
||||
vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinderMt_GetPointerToCurrentPos;
|
||||
vTable->GetMatches = (Mf_GetMatches_Func)MatchFinderMt_GetMatches;
|
||||
|
||||
switch (p->MatchFinder->numHashBytes)
|
||||
{
|
||||
case 2:
|
||||
p->GetHeadsFunc = GetHeads2;
|
||||
p->MixMatchesFunc = (Mf_Mix_Matches)NULL;
|
||||
vTable->Skip = (Mf_Skip_Func)MatchFinderMt0_Skip;
|
||||
vTable->GetMatches = (Mf_GetMatches_Func)MatchFinderMt2_GetMatches;
|
||||
break;
|
||||
case 3:
|
||||
p->GetHeadsFunc = GetHeads3;
|
||||
p->MixMatchesFunc = (Mf_Mix_Matches)MixMatches2;
|
||||
vTable->Skip = (Mf_Skip_Func)MatchFinderMt2_Skip;
|
||||
break;
|
||||
default:
|
||||
/* case 4: */
|
||||
p->GetHeadsFunc = p->MatchFinder->bigHash ? GetHeads4b : GetHeads4;
|
||||
p->MixMatchesFunc = (Mf_Mix_Matches)MixMatches3;
|
||||
vTable->Skip = (Mf_Skip_Func)MatchFinderMt3_Skip;
|
||||
break;
|
||||
/*
|
||||
default:
|
||||
p->GetHeadsFunc = GetHeads5;
|
||||
p->MixMatchesFunc = (Mf_Mix_Matches)MixMatches4;
|
||||
vTable->Skip = (Mf_Skip_Func)MatchFinderMt4_Skip;
|
||||
break;
|
||||
*/
|
||||
}
|
||||
}
|
||||
Vendored
-57
@@ -1,57 +0,0 @@
|
||||
/* LzHash.h -- HASH functions for LZ algorithms
|
||||
2015-04-12 : Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef __LZ_HASH_H
|
||||
#define __LZ_HASH_H
|
||||
|
||||
#define kHash2Size (1 << 10)
|
||||
#define kHash3Size (1 << 16)
|
||||
#define kHash4Size (1 << 20)
|
||||
|
||||
#define kFix3HashSize (kHash2Size)
|
||||
#define kFix4HashSize (kHash2Size + kHash3Size)
|
||||
#define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size)
|
||||
|
||||
#define HASH2_CALC hv = cur[0] | ((UInt32)cur[1] << 8);
|
||||
|
||||
#define HASH3_CALC { \
|
||||
UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
|
||||
h2 = temp & (kHash2Size - 1); \
|
||||
hv = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; }
|
||||
|
||||
#define HASH4_CALC { \
|
||||
UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
|
||||
h2 = temp & (kHash2Size - 1); \
|
||||
temp ^= ((UInt32)cur[2] << 8); \
|
||||
h3 = temp & (kHash3Size - 1); \
|
||||
hv = (temp ^ (p->crc[cur[3]] << 5)) & p->hashMask; }
|
||||
|
||||
#define HASH5_CALC { \
|
||||
UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
|
||||
h2 = temp & (kHash2Size - 1); \
|
||||
temp ^= ((UInt32)cur[2] << 8); \
|
||||
h3 = temp & (kHash3Size - 1); \
|
||||
temp ^= (p->crc[cur[3]] << 5); \
|
||||
h4 = temp & (kHash4Size - 1); \
|
||||
hv = (temp ^ (p->crc[cur[4]] << 3)) & p->hashMask; }
|
||||
|
||||
/* #define HASH_ZIP_CALC hv = ((cur[0] | ((UInt32)cur[1] << 8)) ^ p->crc[cur[2]]) & 0xFFFF; */
|
||||
#define HASH_ZIP_CALC hv = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF;
|
||||
|
||||
|
||||
#define MT_HASH2_CALC \
|
||||
h2 = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1);
|
||||
|
||||
#define MT_HASH3_CALC { \
|
||||
UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
|
||||
h2 = temp & (kHash2Size - 1); \
|
||||
h3 = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); }
|
||||
|
||||
#define MT_HASH4_CALC { \
|
||||
UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
|
||||
h2 = temp & (kHash2Size - 1); \
|
||||
temp ^= ((UInt32)cur[2] << 8); \
|
||||
h3 = temp & (kHash3Size - 1); \
|
||||
h4 = (temp ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); }
|
||||
|
||||
#endif
|
||||
Vendored
-85
@@ -1,85 +0,0 @@
|
||||
/* Ppmd.h -- PPMD codec common code
|
||||
2017-04-03 : Igor Pavlov : Public domain
|
||||
This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */
|
||||
|
||||
#ifndef __PPMD_H
|
||||
#define __PPMD_H
|
||||
|
||||
#include "CpuArch.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
#ifdef MY_CPU_32BIT
|
||||
#define PPMD_32BIT
|
||||
#endif
|
||||
|
||||
#define PPMD_INT_BITS 7
|
||||
#define PPMD_PERIOD_BITS 7
|
||||
#define PPMD_BIN_SCALE (1 << (PPMD_INT_BITS + PPMD_PERIOD_BITS))
|
||||
|
||||
#define PPMD_GET_MEAN_SPEC(summ, shift, round) (((summ) + (1 << ((shift) - (round)))) >> (shift))
|
||||
#define PPMD_GET_MEAN(summ) PPMD_GET_MEAN_SPEC((summ), PPMD_PERIOD_BITS, 2)
|
||||
#define PPMD_UPDATE_PROB_0(prob) ((prob) + (1 << PPMD_INT_BITS) - PPMD_GET_MEAN(prob))
|
||||
#define PPMD_UPDATE_PROB_1(prob) ((prob) - PPMD_GET_MEAN(prob))
|
||||
|
||||
#define PPMD_N1 4
|
||||
#define PPMD_N2 4
|
||||
#define PPMD_N3 4
|
||||
#define PPMD_N4 ((128 + 3 - 1 * PPMD_N1 - 2 * PPMD_N2 - 3 * PPMD_N3) / 4)
|
||||
#define PPMD_NUM_INDEXES (PPMD_N1 + PPMD_N2 + PPMD_N3 + PPMD_N4)
|
||||
|
||||
#pragma pack(push, 1)
|
||||
/* Most compilers works OK here even without #pragma pack(push, 1), but some GCC compilers need it. */
|
||||
|
||||
/* SEE-contexts for PPM-contexts with masked symbols */
|
||||
typedef struct
|
||||
{
|
||||
UInt16 Summ; /* Freq */
|
||||
Byte Shift; /* Speed of Freq change; low Shift is for fast change */
|
||||
Byte Count; /* Count to next change of Shift */
|
||||
} CPpmd_See;
|
||||
|
||||
#define Ppmd_See_Update(p) if ((p)->Shift < PPMD_PERIOD_BITS && --(p)->Count == 0) \
|
||||
{ (p)->Summ <<= 1; (p)->Count = (Byte)(3 << (p)->Shift++); }
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Byte Symbol;
|
||||
Byte Freq;
|
||||
UInt16 SuccessorLow;
|
||||
UInt16 SuccessorHigh;
|
||||
} CPpmd_State;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
typedef
|
||||
#ifdef PPMD_32BIT
|
||||
CPpmd_State *
|
||||
#else
|
||||
UInt32
|
||||
#endif
|
||||
CPpmd_State_Ref;
|
||||
|
||||
typedef
|
||||
#ifdef PPMD_32BIT
|
||||
void *
|
||||
#else
|
||||
UInt32
|
||||
#endif
|
||||
CPpmd_Void_Ref;
|
||||
|
||||
typedef
|
||||
#ifdef PPMD_32BIT
|
||||
Byte *
|
||||
#else
|
||||
UInt32
|
||||
#endif
|
||||
CPpmd_Byte_Ref;
|
||||
|
||||
#define PPMD_SetAllBitsIn256Bytes(p) \
|
||||
{ size_t z; for (z = 0; z < 256 / sizeof(p[0]); z += 8) { \
|
||||
p[z+7] = p[z+6] = p[z+5] = p[z+4] = p[z+3] = p[z+2] = p[z+1] = p[z+0] = ~(size_t)0; }}
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif
|
||||
Vendored
-712
@@ -1,712 +0,0 @@
|
||||
/* Ppmd7.c -- PPMdH codec
|
||||
2018-07-04 : Igor Pavlov : Public domain
|
||||
This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "Ppmd7.h"
|
||||
|
||||
const Byte PPMD7_kExpEscape[16] = { 25, 14, 9, 7, 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 2 };
|
||||
static const UInt16 kInitBinEsc[] = { 0x3CDD, 0x1F3F, 0x59BF, 0x48F3, 0x64A1, 0x5ABC, 0x6632, 0x6051};
|
||||
|
||||
#define MAX_FREQ 124
|
||||
#define UNIT_SIZE 12
|
||||
|
||||
#define U2B(nu) ((UInt32)(nu) * UNIT_SIZE)
|
||||
#define U2I(nu) (p->Units2Indx[(size_t)(nu) - 1])
|
||||
#define I2U(indx) (p->Indx2Units[indx])
|
||||
|
||||
#ifdef PPMD_32BIT
|
||||
#define REF(ptr) (ptr)
|
||||
#else
|
||||
#define REF(ptr) ((UInt32)((Byte *)(ptr) - (p)->Base))
|
||||
#endif
|
||||
|
||||
#define STATS_REF(ptr) ((CPpmd_State_Ref)REF(ptr))
|
||||
|
||||
#define CTX(ref) ((CPpmd7_Context *)Ppmd7_GetContext(p, ref))
|
||||
#define STATS(ctx) Ppmd7_GetStats(p, ctx)
|
||||
#define ONE_STATE(ctx) Ppmd7Context_OneState(ctx)
|
||||
#define SUFFIX(ctx) CTX((ctx)->Suffix)
|
||||
|
||||
typedef CPpmd7_Context * CTX_PTR;
|
||||
|
||||
struct CPpmd7_Node_;
|
||||
|
||||
typedef
|
||||
#ifdef PPMD_32BIT
|
||||
struct CPpmd7_Node_ *
|
||||
#else
|
||||
UInt32
|
||||
#endif
|
||||
CPpmd7_Node_Ref;
|
||||
|
||||
typedef struct CPpmd7_Node_
|
||||
{
|
||||
UInt16 Stamp; /* must be at offset 0 as CPpmd7_Context::NumStats. Stamp=0 means free */
|
||||
UInt16 NU;
|
||||
CPpmd7_Node_Ref Next; /* must be at offset >= 4 */
|
||||
CPpmd7_Node_Ref Prev;
|
||||
} CPpmd7_Node;
|
||||
|
||||
#ifdef PPMD_32BIT
|
||||
#define NODE(ptr) (ptr)
|
||||
#else
|
||||
#define NODE(offs) ((CPpmd7_Node *)(p->Base + (offs)))
|
||||
#endif
|
||||
|
||||
void Ppmd7_Construct(CPpmd7 *p)
|
||||
{
|
||||
unsigned i, k, m;
|
||||
|
||||
p->Base = 0;
|
||||
|
||||
for (i = 0, k = 0; i < PPMD_NUM_INDEXES; i++)
|
||||
{
|
||||
unsigned step = (i >= 12 ? 4 : (i >> 2) + 1);
|
||||
do { p->Units2Indx[k++] = (Byte)i; } while (--step);
|
||||
p->Indx2Units[i] = (Byte)k;
|
||||
}
|
||||
|
||||
p->NS2BSIndx[0] = (0 << 1);
|
||||
p->NS2BSIndx[1] = (1 << 1);
|
||||
memset(p->NS2BSIndx + 2, (2 << 1), 9);
|
||||
memset(p->NS2BSIndx + 11, (3 << 1), 256 - 11);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
p->NS2Indx[i] = (Byte)i;
|
||||
for (m = i, k = 1; i < 256; i++)
|
||||
{
|
||||
p->NS2Indx[i] = (Byte)m;
|
||||
if (--k == 0)
|
||||
k = (++m) - 2;
|
||||
}
|
||||
|
||||
memset(p->HB2Flag, 0, 0x40);
|
||||
memset(p->HB2Flag + 0x40, 8, 0x100 - 0x40);
|
||||
}
|
||||
|
||||
void Ppmd7_Free(CPpmd7 *p, ISzAllocPtr alloc)
|
||||
{
|
||||
ISzAlloc_Free(alloc, p->Base);
|
||||
p->Size = 0;
|
||||
p->Base = 0;
|
||||
}
|
||||
|
||||
BoolInt Ppmd7_Alloc(CPpmd7 *p, UInt32 size, ISzAllocPtr alloc)
|
||||
{
|
||||
if (!p->Base || p->Size != size)
|
||||
{
|
||||
size_t size2;
|
||||
Ppmd7_Free(p, alloc);
|
||||
size2 = 0
|
||||
#ifndef PPMD_32BIT
|
||||
+ UNIT_SIZE
|
||||
#endif
|
||||
;
|
||||
p->AlignOffset =
|
||||
#ifdef PPMD_32BIT
|
||||
(4 - size) & 3;
|
||||
#else
|
||||
4 - (size & 3);
|
||||
#endif
|
||||
if ((p->Base = (Byte *)ISzAlloc_Alloc(alloc, p->AlignOffset + size + size2)) == 0)
|
||||
return False;
|
||||
p->Size = size;
|
||||
}
|
||||
return True;
|
||||
}
|
||||
|
||||
static void InsertNode(CPpmd7 *p, void *node, unsigned indx)
|
||||
{
|
||||
*((CPpmd_Void_Ref *)node) = p->FreeList[indx];
|
||||
p->FreeList[indx] = REF(node);
|
||||
}
|
||||
|
||||
static void *RemoveNode(CPpmd7 *p, unsigned indx)
|
||||
{
|
||||
CPpmd_Void_Ref *node = (CPpmd_Void_Ref *)Ppmd7_GetPtr(p, p->FreeList[indx]);
|
||||
p->FreeList[indx] = *node;
|
||||
return node;
|
||||
}
|
||||
|
||||
static void SplitBlock(CPpmd7 *p, void *ptr, unsigned oldIndx, unsigned newIndx)
|
||||
{
|
||||
unsigned i, nu = I2U(oldIndx) - I2U(newIndx);
|
||||
ptr = (Byte *)ptr + U2B(I2U(newIndx));
|
||||
if (I2U(i = U2I(nu)) != nu)
|
||||
{
|
||||
unsigned k = I2U(--i);
|
||||
InsertNode(p, ((Byte *)ptr) + U2B(k), nu - k - 1);
|
||||
}
|
||||
InsertNode(p, ptr, i);
|
||||
}
|
||||
|
||||
static void GlueFreeBlocks(CPpmd7 *p)
|
||||
{
|
||||
#ifdef PPMD_32BIT
|
||||
CPpmd7_Node headItem;
|
||||
CPpmd7_Node_Ref head = &headItem;
|
||||
#else
|
||||
CPpmd7_Node_Ref head = p->AlignOffset + p->Size;
|
||||
#endif
|
||||
|
||||
CPpmd7_Node_Ref n = head;
|
||||
unsigned i;
|
||||
|
||||
p->GlueCount = 255;
|
||||
|
||||
/* create doubly-linked list of free blocks */
|
||||
for (i = 0; i < PPMD_NUM_INDEXES; i++)
|
||||
{
|
||||
UInt16 nu = I2U(i);
|
||||
CPpmd7_Node_Ref next = (CPpmd7_Node_Ref)p->FreeList[i];
|
||||
p->FreeList[i] = 0;
|
||||
while (next != 0)
|
||||
{
|
||||
CPpmd7_Node *node = NODE(next);
|
||||
node->Next = n;
|
||||
n = NODE(n)->Prev = next;
|
||||
next = *(const CPpmd7_Node_Ref *)node;
|
||||
node->Stamp = 0;
|
||||
node->NU = (UInt16)nu;
|
||||
}
|
||||
}
|
||||
NODE(head)->Stamp = 1;
|
||||
NODE(head)->Next = n;
|
||||
NODE(n)->Prev = head;
|
||||
if (p->LoUnit != p->HiUnit)
|
||||
((CPpmd7_Node *)p->LoUnit)->Stamp = 1;
|
||||
|
||||
/* Glue free blocks */
|
||||
while (n != head)
|
||||
{
|
||||
CPpmd7_Node *node = NODE(n);
|
||||
UInt32 nu = (UInt32)node->NU;
|
||||
for (;;)
|
||||
{
|
||||
CPpmd7_Node *node2 = NODE(n) + nu;
|
||||
nu += node2->NU;
|
||||
if (node2->Stamp != 0 || nu >= 0x10000)
|
||||
break;
|
||||
NODE(node2->Prev)->Next = node2->Next;
|
||||
NODE(node2->Next)->Prev = node2->Prev;
|
||||
node->NU = (UInt16)nu;
|
||||
}
|
||||
n = node->Next;
|
||||
}
|
||||
|
||||
/* Fill lists of free blocks */
|
||||
for (n = NODE(head)->Next; n != head;)
|
||||
{
|
||||
CPpmd7_Node *node = NODE(n);
|
||||
unsigned nu;
|
||||
CPpmd7_Node_Ref next = node->Next;
|
||||
for (nu = node->NU; nu > 128; nu -= 128, node += 128)
|
||||
InsertNode(p, node, PPMD_NUM_INDEXES - 1);
|
||||
if (I2U(i = U2I(nu)) != nu)
|
||||
{
|
||||
unsigned k = I2U(--i);
|
||||
InsertNode(p, node + k, nu - k - 1);
|
||||
}
|
||||
InsertNode(p, node, i);
|
||||
n = next;
|
||||
}
|
||||
}
|
||||
|
||||
static void *AllocUnitsRare(CPpmd7 *p, unsigned indx)
|
||||
{
|
||||
unsigned i;
|
||||
void *retVal;
|
||||
if (p->GlueCount == 0)
|
||||
{
|
||||
GlueFreeBlocks(p);
|
||||
if (p->FreeList[indx] != 0)
|
||||
return RemoveNode(p, indx);
|
||||
}
|
||||
i = indx;
|
||||
do
|
||||
{
|
||||
if (++i == PPMD_NUM_INDEXES)
|
||||
{
|
||||
UInt32 numBytes = U2B(I2U(indx));
|
||||
p->GlueCount--;
|
||||
return ((UInt32)(p->UnitsStart - p->Text) > numBytes) ? (p->UnitsStart -= numBytes) : (NULL);
|
||||
}
|
||||
}
|
||||
while (p->FreeList[i] == 0);
|
||||
retVal = RemoveNode(p, i);
|
||||
SplitBlock(p, retVal, i, indx);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
static void *AllocUnits(CPpmd7 *p, unsigned indx)
|
||||
{
|
||||
UInt32 numBytes;
|
||||
if (p->FreeList[indx] != 0)
|
||||
return RemoveNode(p, indx);
|
||||
numBytes = U2B(I2U(indx));
|
||||
if (numBytes <= (UInt32)(p->HiUnit - p->LoUnit))
|
||||
{
|
||||
void *retVal = p->LoUnit;
|
||||
p->LoUnit += numBytes;
|
||||
return retVal;
|
||||
}
|
||||
return AllocUnitsRare(p, indx);
|
||||
}
|
||||
|
||||
#define MyMem12Cpy(dest, src, num) \
|
||||
{ UInt32 *d = (UInt32 *)dest; const UInt32 *s = (const UInt32 *)src; UInt32 n = num; \
|
||||
do { d[0] = s[0]; d[1] = s[1]; d[2] = s[2]; s += 3; d += 3; } while (--n); }
|
||||
|
||||
static void *ShrinkUnits(CPpmd7 *p, void *oldPtr, unsigned oldNU, unsigned newNU)
|
||||
{
|
||||
unsigned i0 = U2I(oldNU);
|
||||
unsigned i1 = U2I(newNU);
|
||||
if (i0 == i1)
|
||||
return oldPtr;
|
||||
if (p->FreeList[i1] != 0)
|
||||
{
|
||||
void *ptr = RemoveNode(p, i1);
|
||||
MyMem12Cpy(ptr, oldPtr, newNU);
|
||||
InsertNode(p, oldPtr, i0);
|
||||
return ptr;
|
||||
}
|
||||
SplitBlock(p, oldPtr, i0, i1);
|
||||
return oldPtr;
|
||||
}
|
||||
|
||||
#define SUCCESSOR(p) ((CPpmd_Void_Ref)((p)->SuccessorLow | ((UInt32)(p)->SuccessorHigh << 16)))
|
||||
|
||||
static void SetSuccessor(CPpmd_State *p, CPpmd_Void_Ref v)
|
||||
{
|
||||
(p)->SuccessorLow = (UInt16)((UInt32)(v) & 0xFFFF);
|
||||
(p)->SuccessorHigh = (UInt16)(((UInt32)(v) >> 16) & 0xFFFF);
|
||||
}
|
||||
|
||||
static void RestartModel(CPpmd7 *p)
|
||||
{
|
||||
unsigned i, k, m;
|
||||
|
||||
memset(p->FreeList, 0, sizeof(p->FreeList));
|
||||
p->Text = p->Base + p->AlignOffset;
|
||||
p->HiUnit = p->Text + p->Size;
|
||||
p->LoUnit = p->UnitsStart = p->HiUnit - p->Size / 8 / UNIT_SIZE * 7 * UNIT_SIZE;
|
||||
p->GlueCount = 0;
|
||||
|
||||
p->OrderFall = p->MaxOrder;
|
||||
p->RunLength = p->InitRL = -(Int32)((p->MaxOrder < 12) ? p->MaxOrder : 12) - 1;
|
||||
p->PrevSuccess = 0;
|
||||
|
||||
p->MinContext = p->MaxContext = (CTX_PTR)(p->HiUnit -= UNIT_SIZE); /* AllocContext(p); */
|
||||
p->MinContext->Suffix = 0;
|
||||
p->MinContext->NumStats = 256;
|
||||
p->MinContext->SummFreq = 256 + 1;
|
||||
p->FoundState = (CPpmd_State *)p->LoUnit; /* AllocUnits(p, PPMD_NUM_INDEXES - 1); */
|
||||
p->LoUnit += U2B(256 / 2);
|
||||
p->MinContext->Stats = REF(p->FoundState);
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
CPpmd_State *s = &p->FoundState[i];
|
||||
s->Symbol = (Byte)i;
|
||||
s->Freq = 1;
|
||||
SetSuccessor(s, 0);
|
||||
}
|
||||
|
||||
for (i = 0; i < 128; i++)
|
||||
for (k = 0; k < 8; k++)
|
||||
{
|
||||
UInt16 *dest = p->BinSumm[i] + k;
|
||||
UInt16 val = (UInt16)(PPMD_BIN_SCALE - kInitBinEsc[k] / (i + 2));
|
||||
for (m = 0; m < 64; m += 8)
|
||||
dest[m] = val;
|
||||
}
|
||||
|
||||
for (i = 0; i < 25; i++)
|
||||
for (k = 0; k < 16; k++)
|
||||
{
|
||||
CPpmd_See *s = &p->See[i][k];
|
||||
s->Summ = (UInt16)((5 * i + 10) << (s->Shift = PPMD_PERIOD_BITS - 4));
|
||||
s->Count = 4;
|
||||
}
|
||||
}
|
||||
|
||||
void Ppmd7_Init(CPpmd7 *p, unsigned maxOrder)
|
||||
{
|
||||
p->MaxOrder = maxOrder;
|
||||
RestartModel(p);
|
||||
p->DummySee.Shift = PPMD_PERIOD_BITS;
|
||||
p->DummySee.Summ = 0; /* unused */
|
||||
p->DummySee.Count = 64; /* unused */
|
||||
}
|
||||
|
||||
static CTX_PTR CreateSuccessors(CPpmd7 *p, BoolInt skip)
|
||||
{
|
||||
CPpmd_State upState;
|
||||
CTX_PTR c = p->MinContext;
|
||||
CPpmd_Byte_Ref upBranch = (CPpmd_Byte_Ref)SUCCESSOR(p->FoundState);
|
||||
CPpmd_State *ps[PPMD7_MAX_ORDER];
|
||||
unsigned numPs = 0;
|
||||
|
||||
if (!skip)
|
||||
ps[numPs++] = p->FoundState;
|
||||
|
||||
while (c->Suffix)
|
||||
{
|
||||
CPpmd_Void_Ref successor;
|
||||
CPpmd_State *s;
|
||||
c = SUFFIX(c);
|
||||
if (c->NumStats != 1)
|
||||
{
|
||||
for (s = STATS(c); s->Symbol != p->FoundState->Symbol; s++);
|
||||
}
|
||||
else
|
||||
s = ONE_STATE(c);
|
||||
successor = SUCCESSOR(s);
|
||||
if (successor != upBranch)
|
||||
{
|
||||
c = CTX(successor);
|
||||
if (numPs == 0)
|
||||
return c;
|
||||
break;
|
||||
}
|
||||
ps[numPs++] = s;
|
||||
}
|
||||
|
||||
upState.Symbol = *(const Byte *)Ppmd7_GetPtr(p, upBranch);
|
||||
SetSuccessor(&upState, upBranch + 1);
|
||||
|
||||
if (c->NumStats == 1)
|
||||
upState.Freq = ONE_STATE(c)->Freq;
|
||||
else
|
||||
{
|
||||
UInt32 cf, s0;
|
||||
CPpmd_State *s;
|
||||
for (s = STATS(c); s->Symbol != upState.Symbol; s++);
|
||||
cf = s->Freq - 1;
|
||||
s0 = c->SummFreq - c->NumStats - cf;
|
||||
upState.Freq = (Byte)(1 + ((2 * cf <= s0) ? (5 * cf > s0) : ((2 * cf + 3 * s0 - 1) / (2 * s0))));
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
/* Create Child */
|
||||
CTX_PTR c1; /* = AllocContext(p); */
|
||||
if (p->HiUnit != p->LoUnit)
|
||||
c1 = (CTX_PTR)(p->HiUnit -= UNIT_SIZE);
|
||||
else if (p->FreeList[0] != 0)
|
||||
c1 = (CTX_PTR)RemoveNode(p, 0);
|
||||
else
|
||||
{
|
||||
c1 = (CTX_PTR)AllocUnitsRare(p, 0);
|
||||
if (!c1)
|
||||
return NULL;
|
||||
}
|
||||
c1->NumStats = 1;
|
||||
*ONE_STATE(c1) = upState;
|
||||
c1->Suffix = REF(c);
|
||||
SetSuccessor(ps[--numPs], REF(c1));
|
||||
c = c1;
|
||||
}
|
||||
while (numPs != 0);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
static void SwapStates(CPpmd_State *t1, CPpmd_State *t2)
|
||||
{
|
||||
CPpmd_State tmp = *t1;
|
||||
*t1 = *t2;
|
||||
*t2 = tmp;
|
||||
}
|
||||
|
||||
static void UpdateModel(CPpmd7 *p)
|
||||
{
|
||||
CPpmd_Void_Ref successor, fSuccessor = SUCCESSOR(p->FoundState);
|
||||
CTX_PTR c;
|
||||
unsigned s0, ns;
|
||||
|
||||
if (p->FoundState->Freq < MAX_FREQ / 4 && p->MinContext->Suffix != 0)
|
||||
{
|
||||
c = SUFFIX(p->MinContext);
|
||||
|
||||
if (c->NumStats == 1)
|
||||
{
|
||||
CPpmd_State *s = ONE_STATE(c);
|
||||
if (s->Freq < 32)
|
||||
s->Freq++;
|
||||
}
|
||||
else
|
||||
{
|
||||
CPpmd_State *s = STATS(c);
|
||||
if (s->Symbol != p->FoundState->Symbol)
|
||||
{
|
||||
do { s++; } while (s->Symbol != p->FoundState->Symbol);
|
||||
if (s[0].Freq >= s[-1].Freq)
|
||||
{
|
||||
SwapStates(&s[0], &s[-1]);
|
||||
s--;
|
||||
}
|
||||
}
|
||||
if (s->Freq < MAX_FREQ - 9)
|
||||
{
|
||||
s->Freq += 2;
|
||||
c->SummFreq += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (p->OrderFall == 0)
|
||||
{
|
||||
p->MinContext = p->MaxContext = CreateSuccessors(p, True);
|
||||
if (p->MinContext == 0)
|
||||
{
|
||||
RestartModel(p);
|
||||
return;
|
||||
}
|
||||
SetSuccessor(p->FoundState, REF(p->MinContext));
|
||||
return;
|
||||
}
|
||||
|
||||
*p->Text++ = p->FoundState->Symbol;
|
||||
successor = REF(p->Text);
|
||||
if (p->Text >= p->UnitsStart)
|
||||
{
|
||||
RestartModel(p);
|
||||
return;
|
||||
}
|
||||
|
||||
if (fSuccessor)
|
||||
{
|
||||
if (fSuccessor <= successor)
|
||||
{
|
||||
CTX_PTR cs = CreateSuccessors(p, False);
|
||||
if (cs == NULL)
|
||||
{
|
||||
RestartModel(p);
|
||||
return;
|
||||
}
|
||||
fSuccessor = REF(cs);
|
||||
}
|
||||
if (--p->OrderFall == 0)
|
||||
{
|
||||
successor = fSuccessor;
|
||||
p->Text -= (p->MaxContext != p->MinContext);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetSuccessor(p->FoundState, successor);
|
||||
fSuccessor = REF(p->MinContext);
|
||||
}
|
||||
|
||||
s0 = p->MinContext->SummFreq - (ns = p->MinContext->NumStats) - (p->FoundState->Freq - 1);
|
||||
|
||||
for (c = p->MaxContext; c != p->MinContext; c = SUFFIX(c))
|
||||
{
|
||||
unsigned ns1;
|
||||
UInt32 cf, sf;
|
||||
if ((ns1 = c->NumStats) != 1)
|
||||
{
|
||||
if ((ns1 & 1) == 0)
|
||||
{
|
||||
/* Expand for one UNIT */
|
||||
unsigned oldNU = ns1 >> 1;
|
||||
unsigned i = U2I(oldNU);
|
||||
if (i != U2I((size_t)oldNU + 1))
|
||||
{
|
||||
void *ptr = AllocUnits(p, i + 1);
|
||||
void *oldPtr;
|
||||
if (!ptr)
|
||||
{
|
||||
RestartModel(p);
|
||||
return;
|
||||
}
|
||||
oldPtr = STATS(c);
|
||||
MyMem12Cpy(ptr, oldPtr, oldNU);
|
||||
InsertNode(p, oldPtr, i);
|
||||
c->Stats = STATS_REF(ptr);
|
||||
}
|
||||
}
|
||||
c->SummFreq = (UInt16)(c->SummFreq + (2 * ns1 < ns) + 2 * ((4 * ns1 <= ns) & (c->SummFreq <= 8 * ns1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
CPpmd_State *s = (CPpmd_State*)AllocUnits(p, 0);
|
||||
if (!s)
|
||||
{
|
||||
RestartModel(p);
|
||||
return;
|
||||
}
|
||||
*s = *ONE_STATE(c);
|
||||
c->Stats = REF(s);
|
||||
if (s->Freq < MAX_FREQ / 4 - 1)
|
||||
s->Freq <<= 1;
|
||||
else
|
||||
s->Freq = MAX_FREQ - 4;
|
||||
c->SummFreq = (UInt16)(s->Freq + p->InitEsc + (ns > 3));
|
||||
}
|
||||
cf = 2 * (UInt32)p->FoundState->Freq * (c->SummFreq + 6);
|
||||
sf = (UInt32)s0 + c->SummFreq;
|
||||
if (cf < 6 * sf)
|
||||
{
|
||||
cf = 1 + (cf > sf) + (cf >= 4 * sf);
|
||||
c->SummFreq += 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
cf = 4 + (cf >= 9 * sf) + (cf >= 12 * sf) + (cf >= 15 * sf);
|
||||
c->SummFreq = (UInt16)(c->SummFreq + cf);
|
||||
}
|
||||
{
|
||||
CPpmd_State *s = STATS(c) + ns1;
|
||||
SetSuccessor(s, successor);
|
||||
s->Symbol = p->FoundState->Symbol;
|
||||
s->Freq = (Byte)cf;
|
||||
c->NumStats = (UInt16)(ns1 + 1);
|
||||
}
|
||||
}
|
||||
p->MaxContext = p->MinContext = CTX(fSuccessor);
|
||||
}
|
||||
|
||||
static void Rescale(CPpmd7 *p)
|
||||
{
|
||||
unsigned i, adder, sumFreq, escFreq;
|
||||
CPpmd_State *stats = STATS(p->MinContext);
|
||||
CPpmd_State *s = p->FoundState;
|
||||
{
|
||||
CPpmd_State tmp = *s;
|
||||
for (; s != stats; s--)
|
||||
s[0] = s[-1];
|
||||
*s = tmp;
|
||||
}
|
||||
escFreq = p->MinContext->SummFreq - s->Freq;
|
||||
s->Freq += 4;
|
||||
adder = (p->OrderFall != 0);
|
||||
s->Freq = (Byte)((s->Freq + adder) >> 1);
|
||||
sumFreq = s->Freq;
|
||||
|
||||
i = p->MinContext->NumStats - 1;
|
||||
do
|
||||
{
|
||||
escFreq -= (++s)->Freq;
|
||||
s->Freq = (Byte)((s->Freq + adder) >> 1);
|
||||
sumFreq += s->Freq;
|
||||
if (s[0].Freq > s[-1].Freq)
|
||||
{
|
||||
CPpmd_State *s1 = s;
|
||||
CPpmd_State tmp = *s1;
|
||||
do
|
||||
s1[0] = s1[-1];
|
||||
while (--s1 != stats && tmp.Freq > s1[-1].Freq);
|
||||
*s1 = tmp;
|
||||
}
|
||||
}
|
||||
while (--i);
|
||||
|
||||
if (s->Freq == 0)
|
||||
{
|
||||
unsigned numStats = p->MinContext->NumStats;
|
||||
unsigned n0, n1;
|
||||
do { i++; } while ((--s)->Freq == 0);
|
||||
escFreq += i;
|
||||
p->MinContext->NumStats = (UInt16)(p->MinContext->NumStats - i);
|
||||
if (p->MinContext->NumStats == 1)
|
||||
{
|
||||
CPpmd_State tmp = *stats;
|
||||
do
|
||||
{
|
||||
tmp.Freq = (Byte)(tmp.Freq - (tmp.Freq >> 1));
|
||||
escFreq >>= 1;
|
||||
}
|
||||
while (escFreq > 1);
|
||||
InsertNode(p, stats, U2I(((numStats + 1) >> 1)));
|
||||
*(p->FoundState = ONE_STATE(p->MinContext)) = tmp;
|
||||
return;
|
||||
}
|
||||
n0 = (numStats + 1) >> 1;
|
||||
n1 = (p->MinContext->NumStats + 1) >> 1;
|
||||
if (n0 != n1)
|
||||
p->MinContext->Stats = STATS_REF(ShrinkUnits(p, stats, n0, n1));
|
||||
}
|
||||
p->MinContext->SummFreq = (UInt16)(sumFreq + escFreq - (escFreq >> 1));
|
||||
p->FoundState = STATS(p->MinContext);
|
||||
}
|
||||
|
||||
CPpmd_See *Ppmd7_MakeEscFreq(CPpmd7 *p, unsigned numMasked, UInt32 *escFreq)
|
||||
{
|
||||
CPpmd_See *see;
|
||||
unsigned nonMasked = p->MinContext->NumStats - numMasked;
|
||||
if (p->MinContext->NumStats != 256)
|
||||
{
|
||||
see = p->See[(unsigned)p->NS2Indx[(size_t)nonMasked - 1]] +
|
||||
(nonMasked < (unsigned)SUFFIX(p->MinContext)->NumStats - p->MinContext->NumStats) +
|
||||
2 * (unsigned)(p->MinContext->SummFreq < 11 * p->MinContext->NumStats) +
|
||||
4 * (unsigned)(numMasked > nonMasked) +
|
||||
p->HiBitsFlag;
|
||||
{
|
||||
unsigned r = (see->Summ >> see->Shift);
|
||||
see->Summ = (UInt16)(see->Summ - r);
|
||||
*escFreq = r + (r == 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
see = &p->DummySee;
|
||||
*escFreq = 1;
|
||||
}
|
||||
return see;
|
||||
}
|
||||
|
||||
static void NextContext(CPpmd7 *p)
|
||||
{
|
||||
CTX_PTR c = CTX(SUCCESSOR(p->FoundState));
|
||||
if (p->OrderFall == 0 && (Byte *)c > p->Text)
|
||||
p->MinContext = p->MaxContext = c;
|
||||
else
|
||||
UpdateModel(p);
|
||||
}
|
||||
|
||||
void Ppmd7_Update1(CPpmd7 *p)
|
||||
{
|
||||
CPpmd_State *s = p->FoundState;
|
||||
s->Freq += 4;
|
||||
p->MinContext->SummFreq += 4;
|
||||
if (s[0].Freq > s[-1].Freq)
|
||||
{
|
||||
SwapStates(&s[0], &s[-1]);
|
||||
p->FoundState = --s;
|
||||
if (s->Freq > MAX_FREQ)
|
||||
Rescale(p);
|
||||
}
|
||||
NextContext(p);
|
||||
}
|
||||
|
||||
void Ppmd7_Update1_0(CPpmd7 *p)
|
||||
{
|
||||
p->PrevSuccess = (2 * p->FoundState->Freq > p->MinContext->SummFreq);
|
||||
p->RunLength += p->PrevSuccess;
|
||||
p->MinContext->SummFreq += 4;
|
||||
if ((p->FoundState->Freq += 4) > MAX_FREQ)
|
||||
Rescale(p);
|
||||
NextContext(p);
|
||||
}
|
||||
|
||||
void Ppmd7_UpdateBin(CPpmd7 *p)
|
||||
{
|
||||
p->FoundState->Freq = (Byte)(p->FoundState->Freq + (p->FoundState->Freq < 128 ? 1: 0));
|
||||
p->PrevSuccess = 1;
|
||||
p->RunLength++;
|
||||
NextContext(p);
|
||||
}
|
||||
|
||||
void Ppmd7_Update2(CPpmd7 *p)
|
||||
{
|
||||
p->MinContext->SummFreq += 4;
|
||||
if ((p->FoundState->Freq += 4) > MAX_FREQ)
|
||||
Rescale(p);
|
||||
p->RunLength = p->InitRL;
|
||||
UpdateModel(p);
|
||||
}
|
||||
Vendored
-142
@@ -1,142 +0,0 @@
|
||||
/* Ppmd7.h -- PPMdH compression codec
|
||||
2018-07-04 : Igor Pavlov : Public domain
|
||||
This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */
|
||||
|
||||
/* This code supports virtual RangeDecoder and includes the implementation
|
||||
of RangeCoder from 7z, instead of RangeCoder from original PPMd var.H.
|
||||
If you need the compatibility with original PPMd var.H, you can use external RangeDecoder */
|
||||
|
||||
#ifndef __PPMD7_H
|
||||
#define __PPMD7_H
|
||||
|
||||
#include "Ppmd.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
#define PPMD7_MIN_ORDER 2
|
||||
#define PPMD7_MAX_ORDER 64
|
||||
|
||||
#define PPMD7_MIN_MEM_SIZE (1 << 11)
|
||||
#define PPMD7_MAX_MEM_SIZE (0xFFFFFFFF - 12 * 3)
|
||||
|
||||
struct CPpmd7_Context_;
|
||||
|
||||
typedef
|
||||
#ifdef PPMD_32BIT
|
||||
struct CPpmd7_Context_ *
|
||||
#else
|
||||
UInt32
|
||||
#endif
|
||||
CPpmd7_Context_Ref;
|
||||
|
||||
typedef struct CPpmd7_Context_
|
||||
{
|
||||
UInt16 NumStats;
|
||||
UInt16 SummFreq;
|
||||
CPpmd_State_Ref Stats;
|
||||
CPpmd7_Context_Ref Suffix;
|
||||
} CPpmd7_Context;
|
||||
|
||||
#define Ppmd7Context_OneState(p) ((CPpmd_State *)&(p)->SummFreq)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CPpmd7_Context *MinContext, *MaxContext;
|
||||
CPpmd_State *FoundState;
|
||||
unsigned OrderFall, InitEsc, PrevSuccess, MaxOrder, HiBitsFlag;
|
||||
Int32 RunLength, InitRL; /* must be 32-bit at least */
|
||||
|
||||
UInt32 Size;
|
||||
UInt32 GlueCount;
|
||||
Byte *Base, *LoUnit, *HiUnit, *Text, *UnitsStart;
|
||||
UInt32 AlignOffset;
|
||||
|
||||
Byte Indx2Units[PPMD_NUM_INDEXES];
|
||||
Byte Units2Indx[128];
|
||||
CPpmd_Void_Ref FreeList[PPMD_NUM_INDEXES];
|
||||
Byte NS2Indx[256], NS2BSIndx[256], HB2Flag[256];
|
||||
CPpmd_See DummySee, See[25][16];
|
||||
UInt16 BinSumm[128][64];
|
||||
} CPpmd7;
|
||||
|
||||
void Ppmd7_Construct(CPpmd7 *p);
|
||||
BoolInt Ppmd7_Alloc(CPpmd7 *p, UInt32 size, ISzAllocPtr alloc);
|
||||
void Ppmd7_Free(CPpmd7 *p, ISzAllocPtr alloc);
|
||||
void Ppmd7_Init(CPpmd7 *p, unsigned maxOrder);
|
||||
#define Ppmd7_WasAllocated(p) ((p)->Base != NULL)
|
||||
|
||||
|
||||
/* ---------- Internal Functions ---------- */
|
||||
|
||||
extern const Byte PPMD7_kExpEscape[16];
|
||||
|
||||
#ifdef PPMD_32BIT
|
||||
#define Ppmd7_GetPtr(p, ptr) (ptr)
|
||||
#define Ppmd7_GetContext(p, ptr) (ptr)
|
||||
#define Ppmd7_GetStats(p, ctx) ((ctx)->Stats)
|
||||
#else
|
||||
#define Ppmd7_GetPtr(p, offs) ((void *)((p)->Base + (offs)))
|
||||
#define Ppmd7_GetContext(p, offs) ((CPpmd7_Context *)Ppmd7_GetPtr((p), (offs)))
|
||||
#define Ppmd7_GetStats(p, ctx) ((CPpmd_State *)Ppmd7_GetPtr((p), ((ctx)->Stats)))
|
||||
#endif
|
||||
|
||||
void Ppmd7_Update1(CPpmd7 *p);
|
||||
void Ppmd7_Update1_0(CPpmd7 *p);
|
||||
void Ppmd7_Update2(CPpmd7 *p);
|
||||
void Ppmd7_UpdateBin(CPpmd7 *p);
|
||||
|
||||
#define Ppmd7_GetBinSumm(p) \
|
||||
&p->BinSumm[(size_t)(unsigned)Ppmd7Context_OneState(p->MinContext)->Freq - 1][p->PrevSuccess + \
|
||||
p->NS2BSIndx[(size_t)Ppmd7_GetContext(p, p->MinContext->Suffix)->NumStats - 1] + \
|
||||
(p->HiBitsFlag = p->HB2Flag[p->FoundState->Symbol]) + \
|
||||
2 * p->HB2Flag[(unsigned)Ppmd7Context_OneState(p->MinContext)->Symbol] + \
|
||||
((p->RunLength >> 26) & 0x20)]
|
||||
|
||||
CPpmd_See *Ppmd7_MakeEscFreq(CPpmd7 *p, unsigned numMasked, UInt32 *scale);
|
||||
|
||||
|
||||
/* ---------- Decode ---------- */
|
||||
|
||||
typedef struct IPpmd7_RangeDec IPpmd7_RangeDec;
|
||||
|
||||
struct IPpmd7_RangeDec
|
||||
{
|
||||
UInt32 (*GetThreshold)(const IPpmd7_RangeDec *p, UInt32 total);
|
||||
void (*Decode)(const IPpmd7_RangeDec *p, UInt32 start, UInt32 size);
|
||||
UInt32 (*DecodeBit)(const IPpmd7_RangeDec *p, UInt32 size0);
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
IPpmd7_RangeDec vt;
|
||||
UInt32 Range;
|
||||
UInt32 Code;
|
||||
IByteIn *Stream;
|
||||
} CPpmd7z_RangeDec;
|
||||
|
||||
void Ppmd7z_RangeDec_CreateVTable(CPpmd7z_RangeDec *p);
|
||||
BoolInt Ppmd7z_RangeDec_Init(CPpmd7z_RangeDec *p);
|
||||
#define Ppmd7z_RangeDec_IsFinishedOK(p) ((p)->Code == 0)
|
||||
|
||||
int Ppmd7_DecodeSymbol(CPpmd7 *p, const IPpmd7_RangeDec *rc);
|
||||
|
||||
|
||||
/* ---------- Encode ---------- */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UInt64 Low;
|
||||
UInt32 Range;
|
||||
Byte Cache;
|
||||
UInt64 CacheSize;
|
||||
IByteOut *Stream;
|
||||
} CPpmd7z_RangeEnc;
|
||||
|
||||
void Ppmd7z_RangeEnc_Init(CPpmd7z_RangeEnc *p);
|
||||
void Ppmd7z_RangeEnc_FlushData(CPpmd7z_RangeEnc *p);
|
||||
|
||||
void Ppmd7_EncodeSymbol(CPpmd7 *p, CPpmd7z_RangeEnc *rc, int symbol);
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif
|
||||
Vendored
-191
@@ -1,191 +0,0 @@
|
||||
/* Ppmd7Dec.c -- PPMdH Decoder
|
||||
2018-07-04 : Igor Pavlov : Public domain
|
||||
This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
#include "Ppmd7.h"
|
||||
|
||||
#define kTopValue (1 << 24)
|
||||
|
||||
BoolInt Ppmd7z_RangeDec_Init(CPpmd7z_RangeDec *p)
|
||||
{
|
||||
unsigned i;
|
||||
p->Code = 0;
|
||||
p->Range = 0xFFFFFFFF;
|
||||
if (IByteIn_Read(p->Stream) != 0)
|
||||
return False;
|
||||
for (i = 0; i < 4; i++)
|
||||
p->Code = (p->Code << 8) | IByteIn_Read(p->Stream);
|
||||
return (p->Code < 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
#define GET_Ppmd7z_RangeDec CPpmd7z_RangeDec *p = CONTAINER_FROM_VTBL(pp, CPpmd7z_RangeDec, vt);
|
||||
|
||||
static UInt32 Range_GetThreshold(const IPpmd7_RangeDec *pp, UInt32 total)
|
||||
{
|
||||
GET_Ppmd7z_RangeDec
|
||||
return p->Code / (p->Range /= total);
|
||||
}
|
||||
|
||||
static void Range_Normalize(CPpmd7z_RangeDec *p)
|
||||
{
|
||||
if (p->Range < kTopValue)
|
||||
{
|
||||
p->Code = (p->Code << 8) | IByteIn_Read(p->Stream);
|
||||
p->Range <<= 8;
|
||||
if (p->Range < kTopValue)
|
||||
{
|
||||
p->Code = (p->Code << 8) | IByteIn_Read(p->Stream);
|
||||
p->Range <<= 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Range_Decode(const IPpmd7_RangeDec *pp, UInt32 start, UInt32 size)
|
||||
{
|
||||
GET_Ppmd7z_RangeDec
|
||||
p->Code -= start * p->Range;
|
||||
p->Range *= size;
|
||||
Range_Normalize(p);
|
||||
}
|
||||
|
||||
static UInt32 Range_DecodeBit(const IPpmd7_RangeDec *pp, UInt32 size0)
|
||||
{
|
||||
GET_Ppmd7z_RangeDec
|
||||
UInt32 newBound = (p->Range >> 14) * size0;
|
||||
UInt32 symbol;
|
||||
if (p->Code < newBound)
|
||||
{
|
||||
symbol = 0;
|
||||
p->Range = newBound;
|
||||
}
|
||||
else
|
||||
{
|
||||
symbol = 1;
|
||||
p->Code -= newBound;
|
||||
p->Range -= newBound;
|
||||
}
|
||||
Range_Normalize(p);
|
||||
return symbol;
|
||||
}
|
||||
|
||||
void Ppmd7z_RangeDec_CreateVTable(CPpmd7z_RangeDec *p)
|
||||
{
|
||||
p->vt.GetThreshold = Range_GetThreshold;
|
||||
p->vt.Decode = Range_Decode;
|
||||
p->vt.DecodeBit = Range_DecodeBit;
|
||||
}
|
||||
|
||||
|
||||
#define MASK(sym) ((signed char *)charMask)[sym]
|
||||
|
||||
int Ppmd7_DecodeSymbol(CPpmd7 *p, const IPpmd7_RangeDec *rc)
|
||||
{
|
||||
size_t charMask[256 / sizeof(size_t)];
|
||||
if (p->MinContext->NumStats != 1)
|
||||
{
|
||||
CPpmd_State *s = Ppmd7_GetStats(p, p->MinContext);
|
||||
unsigned i;
|
||||
UInt32 count, hiCnt;
|
||||
if ((count = rc->GetThreshold(rc, p->MinContext->SummFreq)) < (hiCnt = s->Freq))
|
||||
{
|
||||
Byte symbol;
|
||||
rc->Decode(rc, 0, s->Freq);
|
||||
p->FoundState = s;
|
||||
symbol = s->Symbol;
|
||||
Ppmd7_Update1_0(p);
|
||||
return symbol;
|
||||
}
|
||||
p->PrevSuccess = 0;
|
||||
i = p->MinContext->NumStats - 1;
|
||||
do
|
||||
{
|
||||
if ((hiCnt += (++s)->Freq) > count)
|
||||
{
|
||||
Byte symbol;
|
||||
rc->Decode(rc, hiCnt - s->Freq, s->Freq);
|
||||
p->FoundState = s;
|
||||
symbol = s->Symbol;
|
||||
Ppmd7_Update1(p);
|
||||
return symbol;
|
||||
}
|
||||
}
|
||||
while (--i);
|
||||
if (count >= p->MinContext->SummFreq)
|
||||
return -2;
|
||||
p->HiBitsFlag = p->HB2Flag[p->FoundState->Symbol];
|
||||
rc->Decode(rc, hiCnt, p->MinContext->SummFreq - hiCnt);
|
||||
PPMD_SetAllBitsIn256Bytes(charMask);
|
||||
MASK(s->Symbol) = 0;
|
||||
i = p->MinContext->NumStats - 1;
|
||||
do { MASK((--s)->Symbol) = 0; } while (--i);
|
||||
}
|
||||
else
|
||||
{
|
||||
UInt16 *prob = Ppmd7_GetBinSumm(p);
|
||||
if (rc->DecodeBit(rc, *prob) == 0)
|
||||
{
|
||||
Byte symbol;
|
||||
*prob = (UInt16)PPMD_UPDATE_PROB_0(*prob);
|
||||
symbol = (p->FoundState = Ppmd7Context_OneState(p->MinContext))->Symbol;
|
||||
Ppmd7_UpdateBin(p);
|
||||
return symbol;
|
||||
}
|
||||
*prob = (UInt16)PPMD_UPDATE_PROB_1(*prob);
|
||||
p->InitEsc = PPMD7_kExpEscape[*prob >> 10];
|
||||
PPMD_SetAllBitsIn256Bytes(charMask);
|
||||
MASK(Ppmd7Context_OneState(p->MinContext)->Symbol) = 0;
|
||||
p->PrevSuccess = 0;
|
||||
}
|
||||
for (;;)
|
||||
{
|
||||
CPpmd_State *ps[256], *s;
|
||||
UInt32 freqSum, count, hiCnt;
|
||||
CPpmd_See *see;
|
||||
unsigned i, num, numMasked = p->MinContext->NumStats;
|
||||
do
|
||||
{
|
||||
p->OrderFall++;
|
||||
if (!p->MinContext->Suffix)
|
||||
return -1;
|
||||
p->MinContext = Ppmd7_GetContext(p, p->MinContext->Suffix);
|
||||
}
|
||||
while (p->MinContext->NumStats == numMasked);
|
||||
hiCnt = 0;
|
||||
s = Ppmd7_GetStats(p, p->MinContext);
|
||||
i = 0;
|
||||
num = p->MinContext->NumStats - numMasked;
|
||||
do
|
||||
{
|
||||
int k = (int)(MASK(s->Symbol));
|
||||
hiCnt += (s->Freq & k);
|
||||
ps[i] = s++;
|
||||
i -= k;
|
||||
}
|
||||
while (i != num);
|
||||
|
||||
see = Ppmd7_MakeEscFreq(p, numMasked, &freqSum);
|
||||
freqSum += hiCnt;
|
||||
count = rc->GetThreshold(rc, freqSum);
|
||||
|
||||
if (count < hiCnt)
|
||||
{
|
||||
Byte symbol;
|
||||
CPpmd_State **pps = ps;
|
||||
for (hiCnt = 0; (hiCnt += (*pps)->Freq) <= count; pps++);
|
||||
s = *pps;
|
||||
rc->Decode(rc, hiCnt - s->Freq, s->Freq);
|
||||
Ppmd_See_Update(see);
|
||||
p->FoundState = s;
|
||||
symbol = s->Symbol;
|
||||
Ppmd7_Update2(p);
|
||||
return symbol;
|
||||
}
|
||||
if (count >= freqSum)
|
||||
return -2;
|
||||
rc->Decode(rc, hiCnt, freqSum - hiCnt);
|
||||
see->Summ = (UInt16)(see->Summ + freqSum);
|
||||
do { MASK(ps[--i]->Symbol) = 0; } while (i != 0);
|
||||
}
|
||||
}
|
||||
Vendored
-187
@@ -1,187 +0,0 @@
|
||||
/* Ppmd7Enc.c -- PPMdH Encoder
|
||||
2017-04-03 : Igor Pavlov : Public domain
|
||||
This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
#include "Ppmd7.h"
|
||||
|
||||
#define kTopValue (1 << 24)
|
||||
|
||||
void Ppmd7z_RangeEnc_Init(CPpmd7z_RangeEnc *p)
|
||||
{
|
||||
p->Low = 0;
|
||||
p->Range = 0xFFFFFFFF;
|
||||
p->Cache = 0;
|
||||
p->CacheSize = 1;
|
||||
}
|
||||
|
||||
static void RangeEnc_ShiftLow(CPpmd7z_RangeEnc *p)
|
||||
{
|
||||
if ((UInt32)p->Low < (UInt32)0xFF000000 || (unsigned)(p->Low >> 32) != 0)
|
||||
{
|
||||
Byte temp = p->Cache;
|
||||
do
|
||||
{
|
||||
IByteOut_Write(p->Stream, (Byte)(temp + (Byte)(p->Low >> 32)));
|
||||
temp = 0xFF;
|
||||
}
|
||||
while (--p->CacheSize != 0);
|
||||
p->Cache = (Byte)((UInt32)p->Low >> 24);
|
||||
}
|
||||
p->CacheSize++;
|
||||
p->Low = (UInt32)p->Low << 8;
|
||||
}
|
||||
|
||||
static void RangeEnc_Encode(CPpmd7z_RangeEnc *p, UInt32 start, UInt32 size, UInt32 total)
|
||||
{
|
||||
p->Low += start * (p->Range /= total);
|
||||
p->Range *= size;
|
||||
while (p->Range < kTopValue)
|
||||
{
|
||||
p->Range <<= 8;
|
||||
RangeEnc_ShiftLow(p);
|
||||
}
|
||||
}
|
||||
|
||||
static void RangeEnc_EncodeBit_0(CPpmd7z_RangeEnc *p, UInt32 size0)
|
||||
{
|
||||
p->Range = (p->Range >> 14) * size0;
|
||||
while (p->Range < kTopValue)
|
||||
{
|
||||
p->Range <<= 8;
|
||||
RangeEnc_ShiftLow(p);
|
||||
}
|
||||
}
|
||||
|
||||
static void RangeEnc_EncodeBit_1(CPpmd7z_RangeEnc *p, UInt32 size0)
|
||||
{
|
||||
UInt32 newBound = (p->Range >> 14) * size0;
|
||||
p->Low += newBound;
|
||||
p->Range -= newBound;
|
||||
while (p->Range < kTopValue)
|
||||
{
|
||||
p->Range <<= 8;
|
||||
RangeEnc_ShiftLow(p);
|
||||
}
|
||||
}
|
||||
|
||||
void Ppmd7z_RangeEnc_FlushData(CPpmd7z_RangeEnc *p)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < 5; i++)
|
||||
RangeEnc_ShiftLow(p);
|
||||
}
|
||||
|
||||
|
||||
#define MASK(sym) ((signed char *)charMask)[sym]
|
||||
|
||||
void Ppmd7_EncodeSymbol(CPpmd7 *p, CPpmd7z_RangeEnc *rc, int symbol)
|
||||
{
|
||||
size_t charMask[256 / sizeof(size_t)];
|
||||
if (p->MinContext->NumStats != 1)
|
||||
{
|
||||
CPpmd_State *s = Ppmd7_GetStats(p, p->MinContext);
|
||||
UInt32 sum;
|
||||
unsigned i;
|
||||
if (s->Symbol == symbol)
|
||||
{
|
||||
RangeEnc_Encode(rc, 0, s->Freq, p->MinContext->SummFreq);
|
||||
p->FoundState = s;
|
||||
Ppmd7_Update1_0(p);
|
||||
return;
|
||||
}
|
||||
p->PrevSuccess = 0;
|
||||
sum = s->Freq;
|
||||
i = p->MinContext->NumStats - 1;
|
||||
do
|
||||
{
|
||||
if ((++s)->Symbol == symbol)
|
||||
{
|
||||
RangeEnc_Encode(rc, sum, s->Freq, p->MinContext->SummFreq);
|
||||
p->FoundState = s;
|
||||
Ppmd7_Update1(p);
|
||||
return;
|
||||
}
|
||||
sum += s->Freq;
|
||||
}
|
||||
while (--i);
|
||||
|
||||
p->HiBitsFlag = p->HB2Flag[p->FoundState->Symbol];
|
||||
PPMD_SetAllBitsIn256Bytes(charMask);
|
||||
MASK(s->Symbol) = 0;
|
||||
i = p->MinContext->NumStats - 1;
|
||||
do { MASK((--s)->Symbol) = 0; } while (--i);
|
||||
RangeEnc_Encode(rc, sum, p->MinContext->SummFreq - sum, p->MinContext->SummFreq);
|
||||
}
|
||||
else
|
||||
{
|
||||
UInt16 *prob = Ppmd7_GetBinSumm(p);
|
||||
CPpmd_State *s = Ppmd7Context_OneState(p->MinContext);
|
||||
if (s->Symbol == symbol)
|
||||
{
|
||||
RangeEnc_EncodeBit_0(rc, *prob);
|
||||
*prob = (UInt16)PPMD_UPDATE_PROB_0(*prob);
|
||||
p->FoundState = s;
|
||||
Ppmd7_UpdateBin(p);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
RangeEnc_EncodeBit_1(rc, *prob);
|
||||
*prob = (UInt16)PPMD_UPDATE_PROB_1(*prob);
|
||||
p->InitEsc = PPMD7_kExpEscape[*prob >> 10];
|
||||
PPMD_SetAllBitsIn256Bytes(charMask);
|
||||
MASK(s->Symbol) = 0;
|
||||
p->PrevSuccess = 0;
|
||||
}
|
||||
}
|
||||
for (;;)
|
||||
{
|
||||
UInt32 escFreq;
|
||||
CPpmd_See *see;
|
||||
CPpmd_State *s;
|
||||
UInt32 sum;
|
||||
unsigned i, numMasked = p->MinContext->NumStats;
|
||||
do
|
||||
{
|
||||
p->OrderFall++;
|
||||
if (!p->MinContext->Suffix)
|
||||
return; /* EndMarker (symbol = -1) */
|
||||
p->MinContext = Ppmd7_GetContext(p, p->MinContext->Suffix);
|
||||
}
|
||||
while (p->MinContext->NumStats == numMasked);
|
||||
|
||||
see = Ppmd7_MakeEscFreq(p, numMasked, &escFreq);
|
||||
s = Ppmd7_GetStats(p, p->MinContext);
|
||||
sum = 0;
|
||||
i = p->MinContext->NumStats;
|
||||
do
|
||||
{
|
||||
int cur = s->Symbol;
|
||||
if (cur == symbol)
|
||||
{
|
||||
UInt32 low = sum;
|
||||
CPpmd_State *s1 = s;
|
||||
do
|
||||
{
|
||||
sum += (s->Freq & (int)(MASK(s->Symbol)));
|
||||
s++;
|
||||
}
|
||||
while (--i);
|
||||
RangeEnc_Encode(rc, low, s1->Freq, sum + escFreq);
|
||||
Ppmd_See_Update(see);
|
||||
p->FoundState = s1;
|
||||
Ppmd7_Update2(p);
|
||||
return;
|
||||
}
|
||||
sum += (s->Freq & (int)(MASK(cur)));
|
||||
MASK(cur) = 0;
|
||||
s++;
|
||||
}
|
||||
while (--i);
|
||||
|
||||
RangeEnc_Encode(rc, sum, escFreq, sum + escFreq);
|
||||
see->Summ = (UInt16)(see->Summ + sum + escFreq);
|
||||
}
|
||||
}
|
||||
Vendored
-248
@@ -1,248 +0,0 @@
|
||||
/* Crypto/Sha256.c -- SHA-256 Hash
|
||||
2017-04-03 : Igor Pavlov : Public domain
|
||||
This code is based on public domain code from Wei Dai's Crypto++ library. */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "CpuArch.h"
|
||||
#include "RotateDefs.h"
|
||||
#include "Sha256.h"
|
||||
|
||||
/* define it for speed optimization */
|
||||
#ifndef _SFX
|
||||
#define _SHA256_UNROLL
|
||||
#define _SHA256_UNROLL2
|
||||
#endif
|
||||
|
||||
/* #define _SHA256_UNROLL2 */
|
||||
|
||||
void Sha256_Init(CSha256 *p)
|
||||
{
|
||||
p->state[0] = 0x6a09e667;
|
||||
p->state[1] = 0xbb67ae85;
|
||||
p->state[2] = 0x3c6ef372;
|
||||
p->state[3] = 0xa54ff53a;
|
||||
p->state[4] = 0x510e527f;
|
||||
p->state[5] = 0x9b05688c;
|
||||
p->state[6] = 0x1f83d9ab;
|
||||
p->state[7] = 0x5be0cd19;
|
||||
p->count = 0;
|
||||
}
|
||||
|
||||
#define S0(x) (rotrFixed(x, 2) ^ rotrFixed(x,13) ^ rotrFixed(x, 22))
|
||||
#define S1(x) (rotrFixed(x, 6) ^ rotrFixed(x,11) ^ rotrFixed(x, 25))
|
||||
#define s0(x) (rotrFixed(x, 7) ^ rotrFixed(x,18) ^ (x >> 3))
|
||||
#define s1(x) (rotrFixed(x,17) ^ rotrFixed(x,19) ^ (x >> 10))
|
||||
|
||||
#define blk0(i) (W[i])
|
||||
#define blk2(i) (W[i] += s1(W[((i)-2)&15]) + W[((i)-7)&15] + s0(W[((i)-15)&15]))
|
||||
|
||||
#define Ch(x,y,z) (z^(x&(y^z)))
|
||||
#define Maj(x,y,z) ((x&y)|(z&(x|y)))
|
||||
|
||||
#ifdef _SHA256_UNROLL2
|
||||
|
||||
#define R(a,b,c,d,e,f,g,h, i) \
|
||||
h += S1(e) + Ch(e,f,g) + K[(i)+(size_t)(j)] + (j ? blk2(i) : blk0(i)); \
|
||||
d += h; \
|
||||
h += S0(a) + Maj(a, b, c)
|
||||
|
||||
#define RX_8(i) \
|
||||
R(a,b,c,d,e,f,g,h, i); \
|
||||
R(h,a,b,c,d,e,f,g, i+1); \
|
||||
R(g,h,a,b,c,d,e,f, i+2); \
|
||||
R(f,g,h,a,b,c,d,e, i+3); \
|
||||
R(e,f,g,h,a,b,c,d, i+4); \
|
||||
R(d,e,f,g,h,a,b,c, i+5); \
|
||||
R(c,d,e,f,g,h,a,b, i+6); \
|
||||
R(b,c,d,e,f,g,h,a, i+7)
|
||||
|
||||
#define RX_16 RX_8(0); RX_8(8);
|
||||
|
||||
#else
|
||||
|
||||
#define a(i) T[(0-(i))&7]
|
||||
#define b(i) T[(1-(i))&7]
|
||||
#define c(i) T[(2-(i))&7]
|
||||
#define d(i) T[(3-(i))&7]
|
||||
#define e(i) T[(4-(i))&7]
|
||||
#define f(i) T[(5-(i))&7]
|
||||
#define g(i) T[(6-(i))&7]
|
||||
#define h(i) T[(7-(i))&7]
|
||||
|
||||
#define R(i) \
|
||||
h(i) += S1(e(i)) + Ch(e(i),f(i),g(i)) + K[(i)+(size_t)(j)] + (j ? blk2(i) : blk0(i)); \
|
||||
d(i) += h(i); \
|
||||
h(i) += S0(a(i)) + Maj(a(i), b(i), c(i)) \
|
||||
|
||||
#ifdef _SHA256_UNROLL
|
||||
|
||||
#define RX_8(i) R(i+0); R(i+1); R(i+2); R(i+3); R(i+4); R(i+5); R(i+6); R(i+7);
|
||||
#define RX_16 RX_8(0); RX_8(8);
|
||||
|
||||
#else
|
||||
|
||||
#define RX_16 unsigned i; for (i = 0; i < 16; i++) { R(i); }
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
static const UInt32 K[64] = {
|
||||
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
|
||||
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
||||
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
|
||||
0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
||||
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
|
||||
0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
||||
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
|
||||
0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
||||
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
|
||||
0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
||||
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
|
||||
0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
||||
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
|
||||
0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
||||
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
|
||||
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
|
||||
};
|
||||
|
||||
static void Sha256_WriteByteBlock(CSha256 *p)
|
||||
{
|
||||
UInt32 W[16];
|
||||
unsigned j;
|
||||
UInt32 *state;
|
||||
|
||||
#ifdef _SHA256_UNROLL2
|
||||
UInt32 a,b,c,d,e,f,g,h;
|
||||
#else
|
||||
UInt32 T[8];
|
||||
#endif
|
||||
|
||||
for (j = 0; j < 16; j += 4)
|
||||
{
|
||||
const Byte *ccc = p->buffer + j * 4;
|
||||
W[j ] = GetBe32(ccc);
|
||||
W[j + 1] = GetBe32(ccc + 4);
|
||||
W[j + 2] = GetBe32(ccc + 8);
|
||||
W[j + 3] = GetBe32(ccc + 12);
|
||||
}
|
||||
|
||||
state = p->state;
|
||||
|
||||
#ifdef _SHA256_UNROLL2
|
||||
a = state[0];
|
||||
b = state[1];
|
||||
c = state[2];
|
||||
d = state[3];
|
||||
e = state[4];
|
||||
f = state[5];
|
||||
g = state[6];
|
||||
h = state[7];
|
||||
#else
|
||||
for (j = 0; j < 8; j++)
|
||||
T[j] = state[j];
|
||||
#endif
|
||||
|
||||
for (j = 0; j < 64; j += 16)
|
||||
{
|
||||
RX_16
|
||||
}
|
||||
|
||||
#ifdef _SHA256_UNROLL2
|
||||
state[0] += a;
|
||||
state[1] += b;
|
||||
state[2] += c;
|
||||
state[3] += d;
|
||||
state[4] += e;
|
||||
state[5] += f;
|
||||
state[6] += g;
|
||||
state[7] += h;
|
||||
#else
|
||||
for (j = 0; j < 8; j++)
|
||||
state[j] += T[j];
|
||||
#endif
|
||||
|
||||
/* Wipe variables */
|
||||
/* memset(W, 0, sizeof(W)); */
|
||||
/* memset(T, 0, sizeof(T)); */
|
||||
}
|
||||
|
||||
#undef S0
|
||||
#undef S1
|
||||
#undef s0
|
||||
#undef s1
|
||||
|
||||
void Sha256_Update(CSha256 *p, const Byte *data, size_t size)
|
||||
{
|
||||
if (size == 0)
|
||||
return;
|
||||
|
||||
{
|
||||
unsigned pos = (unsigned)p->count & 0x3F;
|
||||
unsigned num;
|
||||
|
||||
p->count += size;
|
||||
|
||||
num = 64 - pos;
|
||||
if (num > size)
|
||||
{
|
||||
memcpy(p->buffer + pos, data, size);
|
||||
return;
|
||||
}
|
||||
|
||||
size -= num;
|
||||
memcpy(p->buffer + pos, data, num);
|
||||
data += num;
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
Sha256_WriteByteBlock(p);
|
||||
if (size < 64)
|
||||
break;
|
||||
size -= 64;
|
||||
memcpy(p->buffer, data, 64);
|
||||
data += 64;
|
||||
}
|
||||
|
||||
if (size != 0)
|
||||
memcpy(p->buffer, data, size);
|
||||
}
|
||||
|
||||
void Sha256_Final(CSha256 *p, Byte *digest)
|
||||
{
|
||||
unsigned pos = (unsigned)p->count & 0x3F;
|
||||
unsigned i;
|
||||
|
||||
p->buffer[pos++] = 0x80;
|
||||
|
||||
while (pos != (64 - 8))
|
||||
{
|
||||
pos &= 0x3F;
|
||||
if (pos == 0)
|
||||
Sha256_WriteByteBlock(p);
|
||||
p->buffer[pos++] = 0;
|
||||
}
|
||||
|
||||
{
|
||||
UInt64 numBits = (p->count << 3);
|
||||
SetBe32(p->buffer + 64 - 8, (UInt32)(numBits >> 32));
|
||||
SetBe32(p->buffer + 64 - 4, (UInt32)(numBits));
|
||||
}
|
||||
|
||||
Sha256_WriteByteBlock(p);
|
||||
|
||||
for (i = 0; i < 8; i += 2)
|
||||
{
|
||||
UInt32 v0 = p->state[i];
|
||||
UInt32 v1 = p->state[i + 1];
|
||||
SetBe32(digest , v0);
|
||||
SetBe32(digest + 4, v1);
|
||||
digest += 8;
|
||||
}
|
||||
|
||||
Sha256_Init(p);
|
||||
}
|
||||
Vendored
-26
@@ -1,26 +0,0 @@
|
||||
/* Sha256.h -- SHA-256 Hash
|
||||
2013-01-18 : Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef __CRYPTO_SHA256_H
|
||||
#define __CRYPTO_SHA256_H
|
||||
|
||||
#include "7zTypes.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
#define SHA256_DIGEST_SIZE 32
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UInt32 state[8];
|
||||
UInt64 count;
|
||||
Byte buffer[64];
|
||||
} CSha256;
|
||||
|
||||
void Sha256_Init(CSha256 *p);
|
||||
void Sha256_Update(CSha256 *p, const Byte *data, size_t size);
|
||||
void Sha256_Final(CSha256 *p, Byte *digest);
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif
|
||||
Vendored
-95
@@ -1,95 +0,0 @@
|
||||
/* Threads.c -- multithreading library
|
||||
2017-06-26 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
#ifndef UNDER_CE
|
||||
#include <process.h>
|
||||
#endif
|
||||
|
||||
#include "Threads.h"
|
||||
|
||||
static WRes GetError()
|
||||
{
|
||||
DWORD res = GetLastError();
|
||||
return res ? (WRes)res : 1;
|
||||
}
|
||||
|
||||
static WRes HandleToWRes(HANDLE h) { return (h != NULL) ? 0 : GetError(); }
|
||||
static WRes BOOLToWRes(BOOL v) { return v ? 0 : GetError(); }
|
||||
|
||||
WRes HandlePtr_Close(HANDLE *p)
|
||||
{
|
||||
if (*p != NULL)
|
||||
{
|
||||
if (!CloseHandle(*p))
|
||||
return GetError();
|
||||
*p = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
WRes Handle_WaitObject(HANDLE h) { return (WRes)WaitForSingleObject(h, INFINITE); }
|
||||
|
||||
WRes Thread_Create(CThread *p, THREAD_FUNC_TYPE func, LPVOID param)
|
||||
{
|
||||
/* Windows Me/98/95: threadId parameter may not be NULL in _beginthreadex/CreateThread functions */
|
||||
|
||||
#ifdef UNDER_CE
|
||||
|
||||
DWORD threadId;
|
||||
*p = CreateThread(0, 0, func, param, 0, &threadId);
|
||||
|
||||
#else
|
||||
|
||||
unsigned threadId;
|
||||
*p = (HANDLE)_beginthreadex(NULL, 0, func, param, 0, &threadId);
|
||||
|
||||
#endif
|
||||
|
||||
/* maybe we must use errno here, but probably GetLastError() is also OK. */
|
||||
return HandleToWRes(*p);
|
||||
}
|
||||
|
||||
static WRes Event_Create(CEvent *p, BOOL manualReset, int signaled)
|
||||
{
|
||||
*p = CreateEvent(NULL, manualReset, (signaled ? TRUE : FALSE), NULL);
|
||||
return HandleToWRes(*p);
|
||||
}
|
||||
|
||||
WRes Event_Set(CEvent *p) { return BOOLToWRes(SetEvent(*p)); }
|
||||
WRes Event_Reset(CEvent *p) { return BOOLToWRes(ResetEvent(*p)); }
|
||||
|
||||
WRes ManualResetEvent_Create(CManualResetEvent *p, int signaled) { return Event_Create(p, TRUE, signaled); }
|
||||
WRes AutoResetEvent_Create(CAutoResetEvent *p, int signaled) { return Event_Create(p, FALSE, signaled); }
|
||||
WRes ManualResetEvent_CreateNotSignaled(CManualResetEvent *p) { return ManualResetEvent_Create(p, 0); }
|
||||
WRes AutoResetEvent_CreateNotSignaled(CAutoResetEvent *p) { return AutoResetEvent_Create(p, 0); }
|
||||
|
||||
|
||||
WRes Semaphore_Create(CSemaphore *p, UInt32 initCount, UInt32 maxCount)
|
||||
{
|
||||
*p = CreateSemaphore(NULL, (LONG)initCount, (LONG)maxCount, NULL);
|
||||
return HandleToWRes(*p);
|
||||
}
|
||||
|
||||
static WRes Semaphore_Release(CSemaphore *p, LONG releaseCount, LONG *previousCount)
|
||||
{ return BOOLToWRes(ReleaseSemaphore(*p, releaseCount, previousCount)); }
|
||||
WRes Semaphore_ReleaseN(CSemaphore *p, UInt32 num)
|
||||
{ return Semaphore_Release(p, (LONG)num, NULL); }
|
||||
WRes Semaphore_Release1(CSemaphore *p) { return Semaphore_ReleaseN(p, 1); }
|
||||
|
||||
WRes CriticalSection_Init(CCriticalSection *p)
|
||||
{
|
||||
/* InitializeCriticalSection can raise only STATUS_NO_MEMORY exception */
|
||||
#ifdef _MSC_VER
|
||||
__try
|
||||
#endif
|
||||
{
|
||||
InitializeCriticalSection(p);
|
||||
/* InitializeCriticalSectionAndSpinCount(p, 0); */
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
__except (EXCEPTION_EXECUTE_HANDLER) { return 1; }
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
Vendored
-68
@@ -1,68 +0,0 @@
|
||||
/* Threads.h -- multithreading library
|
||||
2017-06-18 : Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef __7Z_THREADS_H
|
||||
#define __7Z_THREADS_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "7zTypes.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
WRes HandlePtr_Close(HANDLE *h);
|
||||
WRes Handle_WaitObject(HANDLE h);
|
||||
|
||||
typedef HANDLE CThread;
|
||||
#define Thread_Construct(p) *(p) = NULL
|
||||
#define Thread_WasCreated(p) (*(p) != NULL)
|
||||
#define Thread_Close(p) HandlePtr_Close(p)
|
||||
#define Thread_Wait(p) Handle_WaitObject(*(p))
|
||||
|
||||
typedef
|
||||
#ifdef UNDER_CE
|
||||
DWORD
|
||||
#else
|
||||
unsigned
|
||||
#endif
|
||||
THREAD_FUNC_RET_TYPE;
|
||||
|
||||
#define THREAD_FUNC_CALL_TYPE MY_STD_CALL
|
||||
#define THREAD_FUNC_DECL THREAD_FUNC_RET_TYPE THREAD_FUNC_CALL_TYPE
|
||||
typedef THREAD_FUNC_RET_TYPE (THREAD_FUNC_CALL_TYPE * THREAD_FUNC_TYPE)(void *);
|
||||
WRes Thread_Create(CThread *p, THREAD_FUNC_TYPE func, LPVOID param);
|
||||
|
||||
typedef HANDLE CEvent;
|
||||
typedef CEvent CAutoResetEvent;
|
||||
typedef CEvent CManualResetEvent;
|
||||
#define Event_Construct(p) *(p) = NULL
|
||||
#define Event_IsCreated(p) (*(p) != NULL)
|
||||
#define Event_Close(p) HandlePtr_Close(p)
|
||||
#define Event_Wait(p) Handle_WaitObject(*(p))
|
||||
WRes Event_Set(CEvent *p);
|
||||
WRes Event_Reset(CEvent *p);
|
||||
WRes ManualResetEvent_Create(CManualResetEvent *p, int signaled);
|
||||
WRes ManualResetEvent_CreateNotSignaled(CManualResetEvent *p);
|
||||
WRes AutoResetEvent_Create(CAutoResetEvent *p, int signaled);
|
||||
WRes AutoResetEvent_CreateNotSignaled(CAutoResetEvent *p);
|
||||
|
||||
typedef HANDLE CSemaphore;
|
||||
#define Semaphore_Construct(p) *(p) = NULL
|
||||
#define Semaphore_IsCreated(p) (*(p) != NULL)
|
||||
#define Semaphore_Close(p) HandlePtr_Close(p)
|
||||
#define Semaphore_Wait(p) Handle_WaitObject(*(p))
|
||||
WRes Semaphore_Create(CSemaphore *p, UInt32 initCount, UInt32 maxCount);
|
||||
WRes Semaphore_ReleaseN(CSemaphore *p, UInt32 num);
|
||||
WRes Semaphore_Release1(CSemaphore *p);
|
||||
|
||||
typedef CRITICAL_SECTION CCriticalSection;
|
||||
WRes CriticalSection_Init(CCriticalSection *p);
|
||||
#define CriticalSection_Delete(p) DeleteCriticalSection(p)
|
||||
#define CriticalSection_Enter(p) EnterCriticalSection(p)
|
||||
#define CriticalSection_Leave(p) LeaveCriticalSection(p)
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/* 7z.h -- 7z interface
|
||||
2017-04-03 : Igor Pavlov : Public domain */
|
||||
2018-07-02 : Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef __7Z_H
|
||||
#define __7Z_H
|
||||
@@ -91,6 +91,8 @@ typedef struct
|
||||
UInt64 *CoderUnpackSizes; // for all coders in all folders
|
||||
|
||||
Byte *CodersData;
|
||||
|
||||
UInt64 RangeLimit;
|
||||
} CSzAr;
|
||||
|
||||
UInt64 SzAr_GetFolderUnpackSize(const CSzAr *p, UInt32 folderIndex);
|
||||
+28
-16
@@ -1,5 +1,5 @@
|
||||
/* 7zArcIn.c -- 7z Input functions
|
||||
2018-12-31 : Igor Pavlov : Public domain */
|
||||
2021-02-09 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
@@ -75,7 +75,7 @@ static SRes SzBitUi32s_Alloc(CSzBitUi32s *p, size_t num, ISzAllocPtr alloc)
|
||||
return SZ_OK;
|
||||
}
|
||||
|
||||
void SzBitUi32s_Free(CSzBitUi32s *p, ISzAllocPtr alloc)
|
||||
static void SzBitUi32s_Free(CSzBitUi32s *p, ISzAllocPtr alloc)
|
||||
{
|
||||
ISzAlloc_Free(alloc, p->Defs); p->Defs = NULL;
|
||||
ISzAlloc_Free(alloc, p->Vals); p->Vals = NULL;
|
||||
@@ -83,7 +83,7 @@ void SzBitUi32s_Free(CSzBitUi32s *p, ISzAllocPtr alloc)
|
||||
|
||||
#define SzBitUi64s_Init(p) { (p)->Defs = NULL; (p)->Vals = NULL; }
|
||||
|
||||
void SzBitUi64s_Free(CSzBitUi64s *p, ISzAllocPtr alloc)
|
||||
static void SzBitUi64s_Free(CSzBitUi64s *p, ISzAllocPtr alloc)
|
||||
{
|
||||
ISzAlloc_Free(alloc, p->Defs); p->Defs = NULL;
|
||||
ISzAlloc_Free(alloc, p->Vals); p->Vals = NULL;
|
||||
@@ -105,6 +105,8 @@ static void SzAr_Init(CSzAr *p)
|
||||
p->CoderUnpackSizes = NULL;
|
||||
|
||||
p->CodersData = NULL;
|
||||
|
||||
p->RangeLimit = 0;
|
||||
}
|
||||
|
||||
static void SzAr_Free(CSzAr *p, ISzAllocPtr alloc)
|
||||
@@ -502,7 +504,7 @@ SRes SzGetNextFolderItem(CSzFolder *f, CSzData *sd)
|
||||
return SZ_ERROR_ARCHIVE;
|
||||
if (propsSize >= 0x80)
|
||||
return SZ_ERROR_UNSUPPORTED;
|
||||
coder->PropsOffset = sd->Data - dataStart;
|
||||
coder->PropsOffset = (size_t)(sd->Data - dataStart);
|
||||
coder->PropsSize = (Byte)propsSize;
|
||||
sd->Data += (size_t)propsSize;
|
||||
sd->Size -= (size_t)propsSize;
|
||||
@@ -677,7 +679,7 @@ static SRes ReadUnpackInfo(CSzAr *p,
|
||||
{
|
||||
UInt32 numCoders, ci, numInStreams = 0;
|
||||
|
||||
p->FoCodersOffsets[fo] = sd.Data - startBufPtr;
|
||||
p->FoCodersOffsets[fo] = (size_t)(sd.Data - startBufPtr);
|
||||
|
||||
RINOK(SzReadNumber32(&sd, &numCoders));
|
||||
if (numCoders == 0 || numCoders > k_Scan_NumCoders_MAX)
|
||||
@@ -797,7 +799,7 @@ static SRes ReadUnpackInfo(CSzAr *p,
|
||||
p->FoToCoderUnpackSizes[fo] = numCodersOutStreams;
|
||||
|
||||
{
|
||||
size_t dataSize = sd.Data - startBufPtr;
|
||||
const size_t dataSize = (size_t)(sd.Data - startBufPtr);
|
||||
p->FoStartPackStreamIndex[fo] = packStreamIndex;
|
||||
p->FoCodersOffsets[fo] = dataSize;
|
||||
MY_ALLOC_ZE_AND_CPY(p->CodersData, dataSize, startBufPtr, alloc);
|
||||
@@ -885,7 +887,7 @@ static SRes ReadSubStreamsInfo(CSzAr *p, CSzData *sd, CSubStreamInfo *ssi)
|
||||
if (numStreams != 1 || !SzBitWithVals_Check(&p->FolderCRCs, i))
|
||||
numSubDigests += numStreams;
|
||||
}
|
||||
ssi->sdNumSubStreams.Size = sd->Data - ssi->sdNumSubStreams.Data;
|
||||
ssi->sdNumSubStreams.Size = (size_t)(sd->Data - ssi->sdNumSubStreams.Data);
|
||||
continue;
|
||||
}
|
||||
if (type == k7zIdCRC || type == k7zIdSize || type == k7zIdEnd)
|
||||
@@ -907,7 +909,7 @@ static SRes ReadSubStreamsInfo(CSzAr *p, CSzData *sd, CSubStreamInfo *ssi)
|
||||
{
|
||||
ssi->sdSizes.Data = sd->Data;
|
||||
RINOK(SkipNumbers(sd, numUnpackSizesInData));
|
||||
ssi->sdSizes.Size = sd->Data - ssi->sdSizes.Data;
|
||||
ssi->sdSizes.Size = (size_t)(sd->Data - ssi->sdSizes.Data);
|
||||
RINOK(ReadID(sd, &type));
|
||||
}
|
||||
|
||||
@@ -919,7 +921,7 @@ static SRes ReadSubStreamsInfo(CSzAr *p, CSzData *sd, CSubStreamInfo *ssi)
|
||||
{
|
||||
ssi->sdCRCs.Data = sd->Data;
|
||||
RINOK(SkipBitUi32s(sd, numSubDigests));
|
||||
ssi->sdCRCs.Size = sd->Data - ssi->sdCRCs.Data;
|
||||
ssi->sdCRCs.Size = (size_t)(sd->Data - ssi->sdCRCs.Data);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -947,7 +949,11 @@ static SRes SzReadStreamsInfo(CSzAr *p,
|
||||
if (type == k7zIdPackInfo)
|
||||
{
|
||||
RINOK(ReadNumber(sd, dataOffset));
|
||||
if (*dataOffset > p->RangeLimit)
|
||||
return SZ_ERROR_ARCHIVE;
|
||||
RINOK(ReadPackInfo(p, sd, alloc));
|
||||
if (p->PackPositions[p->NumPackStreams] > p->RangeLimit - *dataOffset)
|
||||
return SZ_ERROR_ARCHIVE;
|
||||
RINOK(ReadID(sd, &type));
|
||||
}
|
||||
if (type == k7zIdUnpackInfo)
|
||||
@@ -1028,12 +1034,12 @@ static SRes SzReadFileNames(const Byte *data, size_t size, UInt32 numFiles, size
|
||||
return SZ_ERROR_ARCHIVE;
|
||||
for (p = data + pos;
|
||||
#ifdef _WIN32
|
||||
*(const UInt16 *)p != 0
|
||||
*(const UInt16 *)(const void *)p != 0
|
||||
#else
|
||||
p[0] != 0 || p[1] != 0
|
||||
#endif
|
||||
; p += 2);
|
||||
pos = p - data + 2;
|
||||
pos = (size_t)(p - data) + 2;
|
||||
*offsets++ = (pos >> 1);
|
||||
}
|
||||
while (--numFiles);
|
||||
@@ -1133,6 +1139,8 @@ static SRes SzReadHeader2(
|
||||
SRes res;
|
||||
|
||||
SzAr_Init(&tempAr);
|
||||
tempAr.RangeLimit = p->db.RangeLimit;
|
||||
|
||||
res = SzReadAndDecodePackedStreams(inStream, sd, tempBufs, NUM_ADDITIONAL_STREAMS_MAX,
|
||||
p->startPosAfterHeader, &tempAr, allocTemp);
|
||||
*numTempBufs = tempAr.NumFolders;
|
||||
@@ -1526,11 +1534,13 @@ static SRes SzArEx_Open2(
|
||||
nextHeaderSize = GetUi64(header + 20);
|
||||
nextHeaderCRC = GetUi32(header + 28);
|
||||
|
||||
p->startPosAfterHeader = startArcPos + k7zStartHeaderSize;
|
||||
p->startPosAfterHeader = (UInt64)startArcPos + k7zStartHeaderSize;
|
||||
|
||||
if (CrcCalc(header + 12, 20) != GetUi32(header + 8))
|
||||
return SZ_ERROR_CRC;
|
||||
|
||||
p->db.RangeLimit = nextHeaderOffset;
|
||||
|
||||
nextHeaderSizeT = (size_t)nextHeaderSize;
|
||||
if (nextHeaderSizeT != nextHeaderSize)
|
||||
return SZ_ERROR_MEM;
|
||||
@@ -1543,13 +1553,13 @@ static SRes SzArEx_Open2(
|
||||
{
|
||||
Int64 pos = 0;
|
||||
RINOK(ILookInStream_Seek(inStream, &pos, SZ_SEEK_END));
|
||||
if ((UInt64)pos < startArcPos + nextHeaderOffset ||
|
||||
(UInt64)pos < startArcPos + k7zStartHeaderSize + nextHeaderOffset ||
|
||||
(UInt64)pos < startArcPos + k7zStartHeaderSize + nextHeaderOffset + nextHeaderSize)
|
||||
if ((UInt64)pos < (UInt64)startArcPos + nextHeaderOffset ||
|
||||
(UInt64)pos < (UInt64)startArcPos + k7zStartHeaderSize + nextHeaderOffset ||
|
||||
(UInt64)pos < (UInt64)startArcPos + k7zStartHeaderSize + nextHeaderOffset + nextHeaderSize)
|
||||
return SZ_ERROR_INPUT_EOF;
|
||||
}
|
||||
|
||||
RINOK(LookInStream_SeekTo(inStream, startArcPos + k7zStartHeaderSize + nextHeaderOffset));
|
||||
RINOK(LookInStream_SeekTo(inStream, (UInt64)startArcPos + k7zStartHeaderSize + nextHeaderOffset));
|
||||
|
||||
if (!Buf_Create(&buf, nextHeaderSizeT, allocTemp))
|
||||
return SZ_ERROR_MEM;
|
||||
@@ -1575,6 +1585,8 @@ static SRes SzArEx_Open2(
|
||||
Buf_Init(&tempBuf);
|
||||
|
||||
SzAr_Init(&tempAr);
|
||||
tempAr.RangeLimit = p->db.RangeLimit;
|
||||
|
||||
res = SzReadAndDecodePackedStreams(inStream, &sd, &tempBuf, 1, p->startPosAfterHeader, &tempAr, allocTemp);
|
||||
SzAr_Free(&tempAr, allocTemp);
|
||||
|
||||
Vendored
+322
@@ -0,0 +1,322 @@
|
||||
/* 7zCrc.c -- CRC32 init
|
||||
2021-04-01 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
#include "7zCrc.h"
|
||||
#include "CpuArch.h"
|
||||
|
||||
#define kCrcPoly 0xEDB88320
|
||||
|
||||
#ifdef MY_CPU_LE
|
||||
#define CRC_NUM_TABLES 8
|
||||
#else
|
||||
#define CRC_NUM_TABLES 9
|
||||
|
||||
#define CRC_UINT32_SWAP(v) ((v >> 24) | ((v >> 8) & 0xFF00) | ((v << 8) & 0xFF0000) | (v << 24))
|
||||
|
||||
UInt32 MY_FAST_CALL CrcUpdateT1_BeT4(UInt32 v, const void *data, size_t size, const UInt32 *table);
|
||||
UInt32 MY_FAST_CALL CrcUpdateT1_BeT8(UInt32 v, const void *data, size_t size, const UInt32 *table);
|
||||
#endif
|
||||
|
||||
#ifndef MY_CPU_BE
|
||||
UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table);
|
||||
UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table);
|
||||
#endif
|
||||
|
||||
typedef UInt32 (MY_FAST_CALL *CRC_FUNC)(UInt32 v, const void *data, size_t size, const UInt32 *table);
|
||||
|
||||
extern
|
||||
CRC_FUNC g_CrcUpdateT4;
|
||||
CRC_FUNC g_CrcUpdateT4;
|
||||
extern
|
||||
CRC_FUNC g_CrcUpdateT8;
|
||||
CRC_FUNC g_CrcUpdateT8;
|
||||
extern
|
||||
CRC_FUNC g_CrcUpdateT0_32;
|
||||
CRC_FUNC g_CrcUpdateT0_32;
|
||||
extern
|
||||
CRC_FUNC g_CrcUpdateT0_64;
|
||||
CRC_FUNC g_CrcUpdateT0_64;
|
||||
extern
|
||||
CRC_FUNC g_CrcUpdate;
|
||||
CRC_FUNC g_CrcUpdate;
|
||||
|
||||
UInt32 g_CrcTable[256 * CRC_NUM_TABLES];
|
||||
|
||||
UInt32 MY_FAST_CALL CrcUpdate(UInt32 v, const void *data, size_t size)
|
||||
{
|
||||
return g_CrcUpdate(v, data, size, g_CrcTable);
|
||||
}
|
||||
|
||||
UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size)
|
||||
{
|
||||
return g_CrcUpdate(CRC_INIT_VAL, data, size, g_CrcTable) ^ CRC_INIT_VAL;
|
||||
}
|
||||
|
||||
#define CRC_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
|
||||
|
||||
UInt32 MY_FAST_CALL CrcUpdateT1(UInt32 v, const void *data, size_t size, const UInt32 *table);
|
||||
UInt32 MY_FAST_CALL CrcUpdateT1(UInt32 v, const void *data, size_t size, const UInt32 *table)
|
||||
{
|
||||
const Byte *p = (const Byte *)data;
|
||||
const Byte *pEnd = p + size;
|
||||
for (; p != pEnd; p++)
|
||||
v = CRC_UPDATE_BYTE_2(v, *p);
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
/* ---------- hardware CRC ---------- */
|
||||
|
||||
#ifdef MY_CPU_LE
|
||||
|
||||
#if defined(MY_CPU_ARM_OR_ARM64)
|
||||
|
||||
// #pragma message("ARM*")
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(MY_CPU_ARM64)
|
||||
#if (_MSC_VER >= 1910)
|
||||
#define USE_ARM64_CRC
|
||||
#endif
|
||||
#endif
|
||||
#elif (defined(__clang__) && (__clang_major__ >= 3)) \
|
||||
|| (defined(__GNUC__) && (__GNUC__ > 4))
|
||||
#if !defined(__ARM_FEATURE_CRC32)
|
||||
#define __ARM_FEATURE_CRC32 1
|
||||
#if (!defined(__clang__) || (__clang_major__ > 3)) // fix these numbers
|
||||
#define ATTRIB_CRC __attribute__((__target__("arch=armv8-a+crc")))
|
||||
#endif
|
||||
#endif
|
||||
#if defined(__ARM_FEATURE_CRC32)
|
||||
#define USE_ARM64_CRC
|
||||
#include <arm_acle.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
// no hardware CRC
|
||||
|
||||
// #define USE_CRC_EMU
|
||||
|
||||
#ifdef USE_CRC_EMU
|
||||
|
||||
#pragma message("ARM64 CRC emulation")
|
||||
|
||||
MY_FORCE_INLINE
|
||||
UInt32 __crc32b(UInt32 v, UInt32 data)
|
||||
{
|
||||
const UInt32 *table = g_CrcTable;
|
||||
v = CRC_UPDATE_BYTE_2(v, (Byte)data);
|
||||
return v;
|
||||
}
|
||||
|
||||
MY_FORCE_INLINE
|
||||
UInt32 __crc32w(UInt32 v, UInt32 data)
|
||||
{
|
||||
const UInt32 *table = g_CrcTable;
|
||||
v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
|
||||
v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
|
||||
v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
|
||||
v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
|
||||
return v;
|
||||
}
|
||||
|
||||
MY_FORCE_INLINE
|
||||
UInt32 __crc32d(UInt32 v, UInt64 data)
|
||||
{
|
||||
const UInt32 *table = g_CrcTable;
|
||||
v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
|
||||
v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
|
||||
v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
|
||||
v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
|
||||
v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
|
||||
v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
|
||||
v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
|
||||
v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
|
||||
return v;
|
||||
}
|
||||
|
||||
#endif // USE_CRC_EMU
|
||||
|
||||
#endif // defined(MY_CPU_ARM64) && defined(MY_CPU_LE)
|
||||
|
||||
|
||||
|
||||
#if defined(USE_ARM64_CRC) || defined(USE_CRC_EMU)
|
||||
|
||||
#define T0_32_UNROLL_BYTES (4 * 4)
|
||||
#define T0_64_UNROLL_BYTES (4 * 8)
|
||||
|
||||
#ifndef ATTRIB_CRC
|
||||
#define ATTRIB_CRC
|
||||
#endif
|
||||
// #pragma message("USE ARM HW CRC")
|
||||
|
||||
ATTRIB_CRC
|
||||
UInt32 MY_FAST_CALL CrcUpdateT0_32(UInt32 v, const void *data, size_t size, const UInt32 *table);
|
||||
ATTRIB_CRC
|
||||
UInt32 MY_FAST_CALL CrcUpdateT0_32(UInt32 v, const void *data, size_t size, const UInt32 *table)
|
||||
{
|
||||
const Byte *p = (const Byte *)data;
|
||||
UNUSED_VAR(table);
|
||||
|
||||
for (; size != 0 && ((unsigned)(ptrdiff_t)p & (T0_32_UNROLL_BYTES - 1)) != 0; size--)
|
||||
v = __crc32b(v, *p++);
|
||||
|
||||
if (size >= T0_32_UNROLL_BYTES)
|
||||
{
|
||||
const Byte *lim = p + size;
|
||||
size &= (T0_32_UNROLL_BYTES - 1);
|
||||
lim -= size;
|
||||
do
|
||||
{
|
||||
v = __crc32w(v, *(const UInt32 *)(const void *)(p));
|
||||
v = __crc32w(v, *(const UInt32 *)(const void *)(p + 4)); p += 2 * 4;
|
||||
v = __crc32w(v, *(const UInt32 *)(const void *)(p));
|
||||
v = __crc32w(v, *(const UInt32 *)(const void *)(p + 4)); p += 2 * 4;
|
||||
}
|
||||
while (p != lim);
|
||||
}
|
||||
|
||||
for (; size != 0; size--)
|
||||
v = __crc32b(v, *p++);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
ATTRIB_CRC
|
||||
UInt32 MY_FAST_CALL CrcUpdateT0_64(UInt32 v, const void *data, size_t size, const UInt32 *table);
|
||||
ATTRIB_CRC
|
||||
UInt32 MY_FAST_CALL CrcUpdateT0_64(UInt32 v, const void *data, size_t size, const UInt32 *table)
|
||||
{
|
||||
const Byte *p = (const Byte *)data;
|
||||
UNUSED_VAR(table);
|
||||
|
||||
for (; size != 0 && ((unsigned)(ptrdiff_t)p & (T0_64_UNROLL_BYTES - 1)) != 0; size--)
|
||||
v = __crc32b(v, *p++);
|
||||
|
||||
if (size >= T0_64_UNROLL_BYTES)
|
||||
{
|
||||
const Byte *lim = p + size;
|
||||
size &= (T0_64_UNROLL_BYTES - 1);
|
||||
lim -= size;
|
||||
do
|
||||
{
|
||||
v = __crc32d(v, *(const UInt64 *)(const void *)(p));
|
||||
v = __crc32d(v, *(const UInt64 *)(const void *)(p + 8)); p += 2 * 8;
|
||||
v = __crc32d(v, *(const UInt64 *)(const void *)(p));
|
||||
v = __crc32d(v, *(const UInt64 *)(const void *)(p + 8)); p += 2 * 8;
|
||||
}
|
||||
while (p != lim);
|
||||
}
|
||||
|
||||
for (; size != 0; size--)
|
||||
v = __crc32b(v, *p++);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
#endif // defined(USE_ARM64_CRC) || defined(USE_CRC_EMU)
|
||||
|
||||
#endif // MY_CPU_LE
|
||||
|
||||
|
||||
|
||||
|
||||
void MY_FAST_CALL CrcGenerateTable()
|
||||
{
|
||||
UInt32 i;
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
UInt32 r = i;
|
||||
unsigned j;
|
||||
for (j = 0; j < 8; j++)
|
||||
r = (r >> 1) ^ (kCrcPoly & ((UInt32)0 - (r & 1)));
|
||||
g_CrcTable[i] = r;
|
||||
}
|
||||
for (i = 256; i < 256 * CRC_NUM_TABLES; i++)
|
||||
{
|
||||
UInt32 r = g_CrcTable[(size_t)i - 256];
|
||||
g_CrcTable[i] = g_CrcTable[r & 0xFF] ^ (r >> 8);
|
||||
}
|
||||
|
||||
#if CRC_NUM_TABLES < 4
|
||||
|
||||
g_CrcUpdate = CrcUpdateT1;
|
||||
|
||||
#else
|
||||
|
||||
#ifdef MY_CPU_LE
|
||||
|
||||
g_CrcUpdateT4 = CrcUpdateT4;
|
||||
g_CrcUpdate = CrcUpdateT4;
|
||||
|
||||
#if CRC_NUM_TABLES >= 8
|
||||
g_CrcUpdateT8 = CrcUpdateT8;
|
||||
|
||||
#ifdef MY_CPU_X86_OR_AMD64
|
||||
if (!CPU_Is_InOrder())
|
||||
#endif
|
||||
g_CrcUpdate = CrcUpdateT8;
|
||||
#endif
|
||||
|
||||
#else
|
||||
{
|
||||
#ifndef MY_CPU_BE
|
||||
UInt32 k = 0x01020304;
|
||||
const Byte *p = (const Byte *)&k;
|
||||
if (p[0] == 4 && p[1] == 3)
|
||||
{
|
||||
g_CrcUpdateT4 = CrcUpdateT4;
|
||||
g_CrcUpdate = CrcUpdateT4;
|
||||
#if CRC_NUM_TABLES >= 8
|
||||
g_CrcUpdateT8 = CrcUpdateT8;
|
||||
g_CrcUpdate = CrcUpdateT8;
|
||||
#endif
|
||||
}
|
||||
else if (p[0] != 1 || p[1] != 2)
|
||||
g_CrcUpdate = CrcUpdateT1;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
for (i = 256 * CRC_NUM_TABLES - 1; i >= 256; i--)
|
||||
{
|
||||
UInt32 x = g_CrcTable[(size_t)i - 256];
|
||||
g_CrcTable[i] = CRC_UINT32_SWAP(x);
|
||||
}
|
||||
g_CrcUpdateT4 = CrcUpdateT1_BeT4;
|
||||
g_CrcUpdate = CrcUpdateT1_BeT4;
|
||||
#if CRC_NUM_TABLES >= 8
|
||||
g_CrcUpdateT8 = CrcUpdateT1_BeT8;
|
||||
g_CrcUpdate = CrcUpdateT1_BeT8;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef MY_CPU_LE
|
||||
#ifdef USE_ARM64_CRC
|
||||
if (CPU_IsSupported_CRC32())
|
||||
{
|
||||
g_CrcUpdateT0_32 = CrcUpdateT0_32;
|
||||
g_CrcUpdateT0_64 = CrcUpdateT0_64;
|
||||
g_CrcUpdate =
|
||||
#if defined(MY_CPU_ARM)
|
||||
CrcUpdateT0_32;
|
||||
#else
|
||||
CrcUpdateT0_64;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_CRC_EMU
|
||||
g_CrcUpdateT0_32 = CrcUpdateT0_32;
|
||||
g_CrcUpdateT0_64 = CrcUpdateT0_64;
|
||||
g_CrcUpdate = CrcUpdateT0_64;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
+9
-7
@@ -1,5 +1,5 @@
|
||||
/* 7zCrcOpt.c -- CRC32 calculation
|
||||
2017-04-03 : Igor Pavlov : Public domain */
|
||||
2021-02-09 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#define CRC_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
|
||||
|
||||
UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table);
|
||||
UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table)
|
||||
{
|
||||
const Byte *p = (const Byte *)data;
|
||||
@@ -16,7 +17,7 @@ UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const U
|
||||
v = CRC_UPDATE_BYTE_2(v, *p);
|
||||
for (; size >= 4; size -= 4, p += 4)
|
||||
{
|
||||
v ^= *(const UInt32 *)p;
|
||||
v ^= *(const UInt32 *)(const void *)p;
|
||||
v =
|
||||
(table + 0x300)[((v ) & 0xFF)]
|
||||
^ (table + 0x200)[((v >> 8) & 0xFF)]
|
||||
@@ -28,6 +29,7 @@ UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const U
|
||||
return v;
|
||||
}
|
||||
|
||||
UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table);
|
||||
UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table)
|
||||
{
|
||||
const Byte *p = (const Byte *)data;
|
||||
@@ -36,13 +38,13 @@ UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const U
|
||||
for (; size >= 8; size -= 8, p += 8)
|
||||
{
|
||||
UInt32 d;
|
||||
v ^= *(const UInt32 *)p;
|
||||
v ^= *(const UInt32 *)(const void *)p;
|
||||
v =
|
||||
(table + 0x700)[((v ) & 0xFF)]
|
||||
^ (table + 0x600)[((v >> 8) & 0xFF)]
|
||||
^ (table + 0x500)[((v >> 16) & 0xFF)]
|
||||
^ (table + 0x400)[((v >> 24))];
|
||||
d = *((const UInt32 *)p + 1);
|
||||
d = *((const UInt32 *)(const void *)p + 1);
|
||||
v ^=
|
||||
(table + 0x300)[((d ) & 0xFF)]
|
||||
^ (table + 0x200)[((d >> 8) & 0xFF)]
|
||||
@@ -72,7 +74,7 @@ UInt32 MY_FAST_CALL CrcUpdateT1_BeT4(UInt32 v, const void *data, size_t size, co
|
||||
v = CRC_UPDATE_BYTE_2_BE(v, *p);
|
||||
for (; size >= 4; size -= 4, p += 4)
|
||||
{
|
||||
v ^= *(const UInt32 *)p;
|
||||
v ^= *(const UInt32 *)(const void *)p;
|
||||
v =
|
||||
(table + 0x000)[((v ) & 0xFF)]
|
||||
^ (table + 0x100)[((v >> 8) & 0xFF)]
|
||||
@@ -94,13 +96,13 @@ UInt32 MY_FAST_CALL CrcUpdateT1_BeT8(UInt32 v, const void *data, size_t size, co
|
||||
for (; size >= 8; size -= 8, p += 8)
|
||||
{
|
||||
UInt32 d;
|
||||
v ^= *(const UInt32 *)p;
|
||||
v ^= *(const UInt32 *)(const void *)p;
|
||||
v =
|
||||
(table + 0x400)[((v ) & 0xFF)]
|
||||
^ (table + 0x500)[((v >> 8) & 0xFF)]
|
||||
^ (table + 0x600)[((v >> 16) & 0xFF)]
|
||||
^ (table + 0x700)[((v >> 24))];
|
||||
d = *((const UInt32 *)p + 1);
|
||||
d = *((const UInt32 *)(const void *)p + 1);
|
||||
v ^=
|
||||
(table + 0x000)[((d ) & 0xFF)]
|
||||
^ (table + 0x100)[((d >> 8) & 0xFF)]
|
||||
+28
-19
@@ -1,5 +1,5 @@
|
||||
/* 7zDec.c -- Decoding from 7z folder
|
||||
2019-02-02 : Igor Pavlov : Public domain */
|
||||
2021-02-09 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
@@ -21,17 +21,20 @@
|
||||
#endif
|
||||
|
||||
#define k_Copy 0
|
||||
#define k_Delta 3
|
||||
#ifndef _7Z_NO_METHOD_LZMA2
|
||||
#define k_LZMA2 0x21
|
||||
#endif
|
||||
#define k_LZMA 0x30101
|
||||
#define k_BCJ 0x3030103
|
||||
#define k_BCJ2 0x303011B
|
||||
#ifndef _7Z_NO_METHODS_FILTERS
|
||||
#define k_Delta 3
|
||||
#define k_BCJ 0x3030103
|
||||
#define k_PPC 0x3030205
|
||||
#define k_IA64 0x3030401
|
||||
#define k_ARM 0x3030501
|
||||
#define k_ARMT 0x3030701
|
||||
#define k_SPARC 0x3030805
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _7ZIP_PPMD_SUPPPORT
|
||||
|
||||
@@ -56,7 +59,7 @@ static Byte ReadByte(const IByteIn *pp)
|
||||
return *p->cur++;
|
||||
if (p->res == SZ_OK)
|
||||
{
|
||||
size_t size = p->cur - p->begin;
|
||||
size_t size = (size_t)(p->cur - p->begin);
|
||||
p->processed += size;
|
||||
p->res = ILookInStream_Skip(p->inStream, size);
|
||||
size = (1 << 25);
|
||||
@@ -101,28 +104,32 @@ static SRes SzDecodePpmd(const Byte *props, unsigned propsSize, UInt64 inSize, c
|
||||
Ppmd7_Init(&ppmd, order);
|
||||
}
|
||||
{
|
||||
CPpmd7z_RangeDec rc;
|
||||
Ppmd7z_RangeDec_CreateVTable(&rc);
|
||||
rc.Stream = &s.vt;
|
||||
if (!Ppmd7z_RangeDec_Init(&rc))
|
||||
ppmd.rc.dec.Stream = &s.vt;
|
||||
if (!Ppmd7z_RangeDec_Init(&ppmd.rc.dec))
|
||||
res = SZ_ERROR_DATA;
|
||||
else if (s.extra)
|
||||
res = (s.res != SZ_OK ? s.res : SZ_ERROR_DATA);
|
||||
else
|
||||
else if (!s.extra)
|
||||
{
|
||||
SizeT i;
|
||||
for (i = 0; i < outSize; i++)
|
||||
Byte *buf = outBuffer;
|
||||
const Byte *lim = buf + outSize;
|
||||
for (; buf != lim; buf++)
|
||||
{
|
||||
int sym = Ppmd7_DecodeSymbol(&ppmd, &rc.vt);
|
||||
int sym = Ppmd7z_DecodeSymbol(&ppmd);
|
||||
if (s.extra || sym < 0)
|
||||
break;
|
||||
outBuffer[i] = (Byte)sym;
|
||||
*buf = (Byte)sym;
|
||||
}
|
||||
if (i != outSize)
|
||||
res = (s.res != SZ_OK ? s.res : SZ_ERROR_DATA);
|
||||
else if (s.processed + (s.cur - s.begin) != inSize || !Ppmd7z_RangeDec_IsFinishedOK(&rc))
|
||||
if (buf != lim)
|
||||
res = SZ_ERROR_DATA;
|
||||
else if (!Ppmd7z_RangeDec_IsFinishedOK(&ppmd.rc.dec))
|
||||
{
|
||||
/* if (Ppmd7z_DecodeSymbol(&ppmd) != PPMD7_SYM_END || !Ppmd7z_RangeDec_IsFinishedOK(&ppmd.rc.dec)) */
|
||||
res = SZ_ERROR_DATA;
|
||||
}
|
||||
}
|
||||
if (s.extra)
|
||||
res = (s.res != SZ_OK ? s.res : SZ_ERROR_DATA);
|
||||
else if (s.processed + (size_t)(s.cur - s.begin) != inSize)
|
||||
res = SZ_ERROR_DATA;
|
||||
}
|
||||
Ppmd7_Free(&ppmd, allocMain);
|
||||
return res;
|
||||
@@ -365,7 +372,9 @@ static SRes CheckSupportedFolder(const CSzFolder *f)
|
||||
return SZ_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
#ifndef _7Z_NO_METHODS_FILTERS
|
||||
#define CASE_BRA_CONV(isa) case k_ ## isa: isa ## _Convert(outBuffer, outSize, 0, 0); break;
|
||||
#endif
|
||||
|
||||
static SRes SzFolder_Decode2(const CSzFolder *folder,
|
||||
const Byte *propsData,
|
||||
+204
-48
@@ -1,5 +1,5 @@
|
||||
/* 7zFile.c -- File IO
|
||||
2017-04-03 : Igor Pavlov : Public domain */
|
||||
2021-04-29 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
@@ -7,9 +7,19 @@
|
||||
|
||||
#ifndef USE_WINDOWS_FILE
|
||||
|
||||
#ifndef UNDER_CE
|
||||
#include <errno.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef USE_FOPEN
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
typedef int ssize_t;
|
||||
typedef int off_t;
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
@@ -23,30 +33,36 @@
|
||||
And message can be "Network connection was lost"
|
||||
*/
|
||||
|
||||
#define kChunkSizeMax (1 << 22)
|
||||
|
||||
#endif
|
||||
|
||||
#define kChunkSizeMax (1 << 22)
|
||||
|
||||
void File_Construct(CSzFile *p)
|
||||
{
|
||||
#ifdef USE_WINDOWS_FILE
|
||||
p->handle = INVALID_HANDLE_VALUE;
|
||||
#else
|
||||
#elif defined(USE_FOPEN)
|
||||
p->file = NULL;
|
||||
#else
|
||||
p->fd = -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(UNDER_CE) || !defined(USE_WINDOWS_FILE)
|
||||
|
||||
static WRes File_Open(CSzFile *p, const char *name, int writeMode)
|
||||
{
|
||||
#ifdef USE_WINDOWS_FILE
|
||||
|
||||
p->handle = CreateFileA(name,
|
||||
writeMode ? GENERIC_WRITE : GENERIC_READ,
|
||||
FILE_SHARE_READ, NULL,
|
||||
writeMode ? CREATE_ALWAYS : OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
return (p->handle != INVALID_HANDLE_VALUE) ? 0 : GetLastError();
|
||||
#else
|
||||
|
||||
#elif defined(USE_FOPEN)
|
||||
|
||||
p->file = fopen(name, writeMode ? "wb+" : "rb");
|
||||
return (p->file != 0) ? 0 :
|
||||
#ifdef UNDER_CE
|
||||
@@ -54,13 +70,34 @@ static WRes File_Open(CSzFile *p, const char *name, int writeMode)
|
||||
#else
|
||||
errno;
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
int flags = (writeMode ? (O_CREAT | O_EXCL | O_WRONLY) : O_RDONLY);
|
||||
#ifdef O_BINARY
|
||||
flags |= O_BINARY;
|
||||
#endif
|
||||
p->fd = open(name, flags, 0666);
|
||||
return (p->fd != -1) ? 0 : errno;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
WRes InFile_Open(CSzFile *p, const char *name) { return File_Open(p, name, 0); }
|
||||
WRes OutFile_Open(CSzFile *p, const char *name) { return File_Open(p, name, 1); }
|
||||
|
||||
WRes OutFile_Open(CSzFile *p, const char *name)
|
||||
{
|
||||
#if defined(USE_WINDOWS_FILE) || defined(USE_FOPEN)
|
||||
return File_Open(p, name, 1);
|
||||
#else
|
||||
p->fd = creat(name, 0666);
|
||||
return (p->fd != -1) ? 0 : errno;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USE_WINDOWS_FILE
|
||||
static WRes File_OpenW(CSzFile *p, const WCHAR *name, int writeMode)
|
||||
{
|
||||
@@ -78,74 +115,124 @@ WRes OutFile_OpenW(CSzFile *p, const WCHAR *name) { return File_OpenW(p, name, 1
|
||||
WRes File_Close(CSzFile *p)
|
||||
{
|
||||
#ifdef USE_WINDOWS_FILE
|
||||
|
||||
if (p->handle != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
if (!CloseHandle(p->handle))
|
||||
return GetLastError();
|
||||
p->handle = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
#else
|
||||
|
||||
#elif defined(USE_FOPEN)
|
||||
|
||||
if (p->file != NULL)
|
||||
{
|
||||
int res = fclose(p->file);
|
||||
if (res != 0)
|
||||
{
|
||||
if (res == EOF)
|
||||
return errno;
|
||||
return res;
|
||||
}
|
||||
p->file = NULL;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
if (p->fd != -1)
|
||||
{
|
||||
if (close(p->fd) != 0)
|
||||
return errno;
|
||||
p->fd = -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
WRes File_Read(CSzFile *p, void *data, size_t *size)
|
||||
{
|
||||
size_t originalSize = *size;
|
||||
*size = 0;
|
||||
if (originalSize == 0)
|
||||
return 0;
|
||||
|
||||
#ifdef USE_WINDOWS_FILE
|
||||
|
||||
*size = 0;
|
||||
do
|
||||
{
|
||||
DWORD curSize = (originalSize > kChunkSizeMax) ? kChunkSizeMax : (DWORD)originalSize;
|
||||
const DWORD curSize = (originalSize > kChunkSizeMax) ? kChunkSizeMax : (DWORD)originalSize;
|
||||
DWORD processed = 0;
|
||||
BOOL res = ReadFile(p->handle, data, curSize, &processed, NULL);
|
||||
const BOOL res = ReadFile(p->handle, data, curSize, &processed, NULL);
|
||||
data = (void *)((Byte *)data + processed);
|
||||
originalSize -= processed;
|
||||
*size += processed;
|
||||
if (!res)
|
||||
return GetLastError();
|
||||
// debug : we can break here for partial reading mode
|
||||
if (processed == 0)
|
||||
break;
|
||||
}
|
||||
while (originalSize > 0);
|
||||
|
||||
#elif defined(USE_FOPEN)
|
||||
|
||||
do
|
||||
{
|
||||
const size_t curSize = (originalSize > kChunkSizeMax) ? kChunkSizeMax : originalSize;
|
||||
const size_t processed = fread(data, 1, curSize, p->file);
|
||||
data = (void *)((Byte *)data + (size_t)processed);
|
||||
originalSize -= processed;
|
||||
*size += processed;
|
||||
if (processed != curSize)
|
||||
return ferror(p->file);
|
||||
// debug : we can break here for partial reading mode
|
||||
if (processed == 0)
|
||||
break;
|
||||
}
|
||||
while (originalSize > 0);
|
||||
return 0;
|
||||
|
||||
#else
|
||||
|
||||
*size = fread(data, 1, originalSize, p->file);
|
||||
if (*size == originalSize)
|
||||
return 0;
|
||||
return ferror(p->file);
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
const size_t curSize = (originalSize > kChunkSizeMax) ? kChunkSizeMax : originalSize;
|
||||
const ssize_t processed = read(p->fd, data, curSize);
|
||||
if (processed == -1)
|
||||
return errno;
|
||||
if (processed == 0)
|
||||
break;
|
||||
data = (void *)((Byte *)data + (size_t)processed);
|
||||
originalSize -= (size_t)processed;
|
||||
*size += (size_t)processed;
|
||||
// debug : we can break here for partial reading mode
|
||||
// break;
|
||||
}
|
||||
while (originalSize > 0);
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
WRes File_Write(CSzFile *p, const void *data, size_t *size)
|
||||
{
|
||||
size_t originalSize = *size;
|
||||
*size = 0;
|
||||
if (originalSize == 0)
|
||||
return 0;
|
||||
|
||||
#ifdef USE_WINDOWS_FILE
|
||||
|
||||
*size = 0;
|
||||
do
|
||||
{
|
||||
DWORD curSize = (originalSize > kChunkSizeMax) ? kChunkSizeMax : (DWORD)originalSize;
|
||||
const DWORD curSize = (originalSize > kChunkSizeMax) ? kChunkSizeMax : (DWORD)originalSize;
|
||||
DWORD processed = 0;
|
||||
BOOL res = WriteFile(p->handle, data, curSize, &processed, NULL);
|
||||
data = (void *)((Byte *)data + processed);
|
||||
const BOOL res = WriteFile(p->handle, data, curSize, &processed, NULL);
|
||||
data = (const void *)((const Byte *)data + processed);
|
||||
originalSize -= processed;
|
||||
*size += processed;
|
||||
if (!res)
|
||||
@@ -154,26 +241,52 @@ WRes File_Write(CSzFile *p, const void *data, size_t *size)
|
||||
break;
|
||||
}
|
||||
while (originalSize > 0);
|
||||
return 0;
|
||||
|
||||
#elif defined(USE_FOPEN)
|
||||
|
||||
do
|
||||
{
|
||||
const size_t curSize = (originalSize > kChunkSizeMax) ? kChunkSizeMax : originalSize;
|
||||
const size_t processed = fwrite(data, 1, curSize, p->file);
|
||||
data = (void *)((Byte *)data + (size_t)processed);
|
||||
originalSize -= processed;
|
||||
*size += processed;
|
||||
if (processed != curSize)
|
||||
return ferror(p->file);
|
||||
if (processed == 0)
|
||||
break;
|
||||
}
|
||||
while (originalSize > 0);
|
||||
|
||||
#else
|
||||
|
||||
*size = fwrite(data, 1, originalSize, p->file);
|
||||
if (*size == originalSize)
|
||||
return 0;
|
||||
return ferror(p->file);
|
||||
|
||||
do
|
||||
{
|
||||
const size_t curSize = (originalSize > kChunkSizeMax) ? kChunkSizeMax : originalSize;
|
||||
const ssize_t processed = write(p->fd, data, curSize);
|
||||
if (processed == -1)
|
||||
return errno;
|
||||
if (processed == 0)
|
||||
break;
|
||||
data = (void *)((Byte *)data + (size_t)processed);
|
||||
originalSize -= (size_t)processed;
|
||||
*size += (size_t)processed;
|
||||
}
|
||||
while (originalSize > 0);
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin)
|
||||
{
|
||||
#ifdef USE_WINDOWS_FILE
|
||||
|
||||
LARGE_INTEGER value;
|
||||
DWORD moveMethod;
|
||||
value.LowPart = (DWORD)*pos;
|
||||
value.HighPart = (LONG)((UInt64)*pos >> 16 >> 16); /* for case when UInt64 is 32-bit only */
|
||||
UInt32 low = (UInt32)*pos;
|
||||
LONG high = (LONG)((UInt64)*pos >> 16 >> 16); /* for case when UInt64 is 32-bit only */
|
||||
switch (origin)
|
||||
{
|
||||
case SZ_SEEK_SET: moveMethod = FILE_BEGIN; break;
|
||||
@@ -181,34 +294,52 @@ WRes File_Seek(CSzFile *p, Int64 *pos, ESzSeek origin)
|
||||
case SZ_SEEK_END: moveMethod = FILE_END; break;
|
||||
default: return ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
value.LowPart = SetFilePointer(p->handle, value.LowPart, &value.HighPart, moveMethod);
|
||||
if (value.LowPart == 0xFFFFFFFF)
|
||||
low = SetFilePointer(p->handle, (LONG)low, &high, moveMethod);
|
||||
if (low == (UInt32)0xFFFFFFFF)
|
||||
{
|
||||
WRes res = GetLastError();
|
||||
if (res != NO_ERROR)
|
||||
return res;
|
||||
}
|
||||
*pos = ((Int64)value.HighPart << 32) | value.LowPart;
|
||||
*pos = ((Int64)high << 32) | low;
|
||||
return 0;
|
||||
|
||||
#else
|
||||
|
||||
int moveMethod;
|
||||
int res;
|
||||
int moveMethod; // = origin;
|
||||
|
||||
switch (origin)
|
||||
{
|
||||
case SZ_SEEK_SET: moveMethod = SEEK_SET; break;
|
||||
case SZ_SEEK_CUR: moveMethod = SEEK_CUR; break;
|
||||
case SZ_SEEK_END: moveMethod = SEEK_END; break;
|
||||
default: return 1;
|
||||
default: return EINVAL;
|
||||
}
|
||||
res = fseek(p->file, (long)*pos, moveMethod);
|
||||
*pos = ftell(p->file);
|
||||
return res;
|
||||
|
||||
#endif
|
||||
#if defined(USE_FOPEN)
|
||||
{
|
||||
int res = fseek(p->file, (long)*pos, moveMethod);
|
||||
if (res == -1)
|
||||
return errno;
|
||||
*pos = ftell(p->file);
|
||||
if (*pos == -1)
|
||||
return errno;
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
{
|
||||
off_t res = lseek(p->fd, (off_t)*pos, moveMethod);
|
||||
if (res == -1)
|
||||
return errno;
|
||||
*pos = res;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // USE_FOPEN
|
||||
#endif // USE_WINDOWS_FILE
|
||||
}
|
||||
|
||||
|
||||
WRes File_GetLength(CSzFile *p, UInt64 *length)
|
||||
{
|
||||
#ifdef USE_WINDOWS_FILE
|
||||
@@ -224,13 +355,31 @@ WRes File_GetLength(CSzFile *p, UInt64 *length)
|
||||
*length = (((UInt64)sizeHigh) << 32) + sizeLow;
|
||||
return 0;
|
||||
|
||||
#else
|
||||
#elif defined(USE_FOPEN)
|
||||
|
||||
long pos = ftell(p->file);
|
||||
int res = fseek(p->file, 0, SEEK_END);
|
||||
*length = ftell(p->file);
|
||||
fseek(p->file, pos, SEEK_SET);
|
||||
return res;
|
||||
|
||||
#else
|
||||
|
||||
off_t pos;
|
||||
*length = 0;
|
||||
pos = lseek(p->fd, 0, SEEK_CUR);
|
||||
if (pos != -1)
|
||||
{
|
||||
const off_t len2 = lseek(p->fd, 0, SEEK_END);
|
||||
const off_t res2 = lseek(p->fd, pos, SEEK_SET);
|
||||
if (len2 != -1)
|
||||
{
|
||||
*length = (UInt64)len2;
|
||||
if (res2 != -1)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return errno;
|
||||
|
||||
#endif
|
||||
}
|
||||
@@ -241,7 +390,9 @@ WRes File_GetLength(CSzFile *p, UInt64 *length)
|
||||
static SRes FileSeqInStream_Read(const ISeqInStream *pp, void *buf, size_t *size)
|
||||
{
|
||||
CFileSeqInStream *p = CONTAINER_FROM_VTBL(pp, CFileSeqInStream, vt);
|
||||
return File_Read(&p->file, buf, size) == 0 ? SZ_OK : SZ_ERROR_READ;
|
||||
WRes wres = File_Read(&p->file, buf, size);
|
||||
p->wres = wres;
|
||||
return (wres == 0) ? SZ_OK : SZ_ERROR_READ;
|
||||
}
|
||||
|
||||
void FileSeqInStream_CreateVTable(CFileSeqInStream *p)
|
||||
@@ -255,13 +406,17 @@ void FileSeqInStream_CreateVTable(CFileSeqInStream *p)
|
||||
static SRes FileInStream_Read(const ISeekInStream *pp, void *buf, size_t *size)
|
||||
{
|
||||
CFileInStream *p = CONTAINER_FROM_VTBL(pp, CFileInStream, vt);
|
||||
return (File_Read(&p->file, buf, size) == 0) ? SZ_OK : SZ_ERROR_READ;
|
||||
WRes wres = File_Read(&p->file, buf, size);
|
||||
p->wres = wres;
|
||||
return (wres == 0) ? SZ_OK : SZ_ERROR_READ;
|
||||
}
|
||||
|
||||
static SRes FileInStream_Seek(const ISeekInStream *pp, Int64 *pos, ESzSeek origin)
|
||||
{
|
||||
CFileInStream *p = CONTAINER_FROM_VTBL(pp, CFileInStream, vt);
|
||||
return File_Seek(&p->file, pos, origin);
|
||||
WRes wres = File_Seek(&p->file, pos, origin);
|
||||
p->wres = wres;
|
||||
return (wres == 0) ? SZ_OK : SZ_ERROR_READ;
|
||||
}
|
||||
|
||||
void FileInStream_CreateVTable(CFileInStream *p)
|
||||
@@ -276,7 +431,8 @@ void FileInStream_CreateVTable(CFileInStream *p)
|
||||
static size_t FileOutStream_Write(const ISeqOutStream *pp, const void *data, size_t size)
|
||||
{
|
||||
CFileOutStream *p = CONTAINER_FROM_VTBL(pp, CFileOutStream, vt);
|
||||
File_Write(&p->file, data, &size);
|
||||
WRes wres = File_Write(&p->file, data, &size);
|
||||
p->wres = wres;
|
||||
return size;
|
||||
}
|
||||
|
||||
+11
-3
@@ -1,17 +1,20 @@
|
||||
/* 7zFile.h -- File IO
|
||||
2017-04-03 : Igor Pavlov : Public domain */
|
||||
2021-02-15 : Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef __7Z_FILE_H
|
||||
#define __7Z_FILE_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#define USE_WINDOWS_FILE
|
||||
// #include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_WINDOWS_FILE
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <stdio.h>
|
||||
// note: USE_FOPEN mode is limited to 32-bit file size
|
||||
// #define USE_FOPEN
|
||||
// #include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "7zTypes.h"
|
||||
@@ -24,8 +27,10 @@ typedef struct
|
||||
{
|
||||
#ifdef USE_WINDOWS_FILE
|
||||
HANDLE handle;
|
||||
#else
|
||||
#elif defined(USE_FOPEN)
|
||||
FILE *file;
|
||||
#else
|
||||
int fd;
|
||||
#endif
|
||||
} CSzFile;
|
||||
|
||||
@@ -56,6 +61,7 @@ typedef struct
|
||||
{
|
||||
ISeqInStream vt;
|
||||
CSzFile file;
|
||||
WRes wres;
|
||||
} CFileSeqInStream;
|
||||
|
||||
void FileSeqInStream_CreateVTable(CFileSeqInStream *p);
|
||||
@@ -65,6 +71,7 @@ typedef struct
|
||||
{
|
||||
ISeekInStream vt;
|
||||
CSzFile file;
|
||||
WRes wres;
|
||||
} CFileInStream;
|
||||
|
||||
void FileInStream_CreateVTable(CFileInStream *p);
|
||||
@@ -74,6 +81,7 @@ typedef struct
|
||||
{
|
||||
ISeqOutStream vt;
|
||||
CSzFile file;
|
||||
WRes wres;
|
||||
} CFileOutStream;
|
||||
|
||||
void FileOutStream_CreateVTable(CFileOutStream *p);
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/* 7zStream.c -- 7z Stream functions
|
||||
2017-04-03 : Igor Pavlov : Public domain */
|
||||
2021-02-09 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
@@ -37,7 +37,7 @@ SRes SeqInStream_ReadByte(const ISeqInStream *stream, Byte *buf)
|
||||
|
||||
SRes LookInStream_SeekTo(const ILookInStream *stream, UInt64 offset)
|
||||
{
|
||||
Int64 t = offset;
|
||||
Int64 t = (Int64)offset;
|
||||
return ILookInStream_Seek(stream, &t, SZ_SEEK_SET);
|
||||
}
|
||||
|
||||
+175
-21
@@ -1,11 +1,13 @@
|
||||
/* 7zTypes.h -- Basic types
|
||||
2018-08-04 : Igor Pavlov : Public domain */
|
||||
2022-04-01 : Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef __7Z_TYPES_H
|
||||
#define __7Z_TYPES_H
|
||||
|
||||
#ifdef _WIN32
|
||||
/* #include <windows.h> */
|
||||
#else
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
@@ -43,18 +45,112 @@ EXTERN_C_BEGIN
|
||||
typedef int SRes;
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if _MSC_VER > 1200
|
||||
#define MY_ALIGN(n) __declspec(align(n))
|
||||
#else
|
||||
#define MY_ALIGN(n)
|
||||
#endif
|
||||
#else
|
||||
#define MY_ALIGN(n) __attribute__ ((aligned(n)))
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
/* typedef DWORD WRes; */
|
||||
typedef unsigned WRes;
|
||||
#define MY_SRes_HRESULT_FROM_WRes(x) HRESULT_FROM_WIN32(x)
|
||||
|
||||
#else
|
||||
// #define MY_HRES_ERROR__INTERNAL_ERROR MY_SRes_HRESULT_FROM_WRes(ERROR_INTERNAL_ERROR)
|
||||
|
||||
#else // _WIN32
|
||||
|
||||
// #define ENV_HAVE_LSTAT
|
||||
typedef int WRes;
|
||||
#define MY__FACILITY_WIN32 7
|
||||
#define MY__FACILITY__WRes MY__FACILITY_WIN32
|
||||
#define MY_SRes_HRESULT_FROM_WRes(x) ((HRESULT)(x) <= 0 ? ((HRESULT)(x)) : ((HRESULT) (((x) & 0x0000FFFF) | (MY__FACILITY__WRes << 16) | 0x80000000)))
|
||||
|
||||
// (FACILITY_ERRNO = 0x800) is 7zip's FACILITY constant to represent (errno) errors in HRESULT
|
||||
#define MY__FACILITY_ERRNO 0x800
|
||||
#define MY__FACILITY_WIN32 7
|
||||
#define MY__FACILITY__WRes MY__FACILITY_ERRNO
|
||||
|
||||
#define MY_HRESULT_FROM_errno_CONST_ERROR(x) ((HRESULT)( \
|
||||
( (HRESULT)(x) & 0x0000FFFF) \
|
||||
| (MY__FACILITY__WRes << 16) \
|
||||
| (HRESULT)0x80000000 ))
|
||||
|
||||
#define MY_SRes_HRESULT_FROM_WRes(x) \
|
||||
((HRESULT)(x) <= 0 ? ((HRESULT)(x)) : MY_HRESULT_FROM_errno_CONST_ERROR(x))
|
||||
|
||||
// we call macro HRESULT_FROM_WIN32 for system errors (WRes) that are (errno)
|
||||
#define HRESULT_FROM_WIN32(x) MY_SRes_HRESULT_FROM_WRes(x)
|
||||
|
||||
/*
|
||||
#define ERROR_FILE_NOT_FOUND 2L
|
||||
#define ERROR_ACCESS_DENIED 5L
|
||||
#define ERROR_NO_MORE_FILES 18L
|
||||
#define ERROR_LOCK_VIOLATION 33L
|
||||
#define ERROR_FILE_EXISTS 80L
|
||||
#define ERROR_DISK_FULL 112L
|
||||
#define ERROR_NEGATIVE_SEEK 131L
|
||||
#define ERROR_ALREADY_EXISTS 183L
|
||||
#define ERROR_DIRECTORY 267L
|
||||
#define ERROR_TOO_MANY_POSTS 298L
|
||||
|
||||
#define ERROR_INTERNAL_ERROR 1359L
|
||||
#define ERROR_INVALID_REPARSE_DATA 4392L
|
||||
#define ERROR_REPARSE_TAG_INVALID 4393L
|
||||
#define ERROR_REPARSE_TAG_MISMATCH 4394L
|
||||
*/
|
||||
|
||||
// we use errno equivalents for some WIN32 errors:
|
||||
|
||||
#define ERROR_INVALID_PARAMETER EINVAL
|
||||
#define ERROR_INVALID_FUNCTION EINVAL
|
||||
#define ERROR_ALREADY_EXISTS EEXIST
|
||||
#define ERROR_FILE_EXISTS EEXIST
|
||||
#define ERROR_PATH_NOT_FOUND ENOENT
|
||||
#define ERROR_FILE_NOT_FOUND ENOENT
|
||||
#define ERROR_DISK_FULL ENOSPC
|
||||
// #define ERROR_INVALID_HANDLE EBADF
|
||||
|
||||
// we use FACILITY_WIN32 for errors that has no errno equivalent
|
||||
// Too many posts were made to a semaphore.
|
||||
#define ERROR_TOO_MANY_POSTS ((HRESULT)0x8007012AL)
|
||||
#define ERROR_INVALID_REPARSE_DATA ((HRESULT)0x80071128L)
|
||||
#define ERROR_REPARSE_TAG_INVALID ((HRESULT)0x80071129L)
|
||||
|
||||
// if (MY__FACILITY__WRes != FACILITY_WIN32),
|
||||
// we use FACILITY_WIN32 for COM errors:
|
||||
#define E_OUTOFMEMORY ((HRESULT)0x8007000EL)
|
||||
#define E_INVALIDARG ((HRESULT)0x80070057L)
|
||||
#define MY__E_ERROR_NEGATIVE_SEEK ((HRESULT)0x80070083L)
|
||||
|
||||
/*
|
||||
// we can use FACILITY_ERRNO for some COM errors, that have errno equivalents:
|
||||
#define E_OUTOFMEMORY MY_HRESULT_FROM_errno_CONST_ERROR(ENOMEM)
|
||||
#define E_INVALIDARG MY_HRESULT_FROM_errno_CONST_ERROR(EINVAL)
|
||||
#define MY__E_ERROR_NEGATIVE_SEEK MY_HRESULT_FROM_errno_CONST_ERROR(EINVAL)
|
||||
*/
|
||||
|
||||
#define TEXT(quote) quote
|
||||
|
||||
#define FILE_ATTRIBUTE_READONLY 0x0001
|
||||
#define FILE_ATTRIBUTE_HIDDEN 0x0002
|
||||
#define FILE_ATTRIBUTE_SYSTEM 0x0004
|
||||
#define FILE_ATTRIBUTE_DIRECTORY 0x0010
|
||||
#define FILE_ATTRIBUTE_ARCHIVE 0x0020
|
||||
#define FILE_ATTRIBUTE_DEVICE 0x0040
|
||||
#define FILE_ATTRIBUTE_NORMAL 0x0080
|
||||
#define FILE_ATTRIBUTE_TEMPORARY 0x0100
|
||||
#define FILE_ATTRIBUTE_SPARSE_FILE 0x0200
|
||||
#define FILE_ATTRIBUTE_REPARSE_POINT 0x0400
|
||||
#define FILE_ATTRIBUTE_COMPRESSED 0x0800
|
||||
#define FILE_ATTRIBUTE_OFFLINE 0x1000
|
||||
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x2000
|
||||
#define FILE_ATTRIBUTE_ENCRYPTED 0x4000
|
||||
|
||||
#define FILE_ATTRIBUTE_UNIX_EXTENSION 0x8000 /* trick for Unix */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -63,6 +159,10 @@ typedef int WRes;
|
||||
#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
|
||||
#endif
|
||||
|
||||
#ifndef RINOK_WRes
|
||||
#define RINOK_WRes(x) { WRes __result__ = (x); if (__result__ != 0) return __result__; }
|
||||
#endif
|
||||
|
||||
typedef unsigned char Byte;
|
||||
typedef short Int16;
|
||||
typedef unsigned short UInt16;
|
||||
@@ -75,6 +175,40 @@ typedef int Int32;
|
||||
typedef unsigned int UInt32;
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
typedef int INT;
|
||||
typedef Int32 INT32;
|
||||
typedef unsigned int UINT;
|
||||
typedef UInt32 UINT32;
|
||||
typedef INT32 LONG; // LONG, ULONG and DWORD must be 32-bit for _WIN32 compatibility
|
||||
typedef UINT32 ULONG;
|
||||
|
||||
#undef DWORD
|
||||
typedef UINT32 DWORD;
|
||||
|
||||
#define VOID void
|
||||
|
||||
#define HRESULT LONG
|
||||
|
||||
typedef void *LPVOID;
|
||||
// typedef void VOID;
|
||||
// typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
|
||||
// gcc / clang on Unix : sizeof(long==sizeof(void*) in 32 or 64 bits)
|
||||
typedef long INT_PTR;
|
||||
typedef unsigned long UINT_PTR;
|
||||
typedef long LONG_PTR;
|
||||
typedef unsigned long DWORD_PTR;
|
||||
|
||||
typedef size_t SIZE_T;
|
||||
|
||||
#endif // _WIN32
|
||||
|
||||
|
||||
#define MY_HRES_ERROR__INTERNAL_ERROR ((HRESULT)0x8007054FL)
|
||||
|
||||
|
||||
#ifdef _SZ_NO_INT_64
|
||||
|
||||
/* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers.
|
||||
@@ -128,25 +262,37 @@ typedef int BoolInt;
|
||||
#define MY_CDECL __cdecl
|
||||
#define MY_FAST_CALL __fastcall
|
||||
|
||||
#else
|
||||
#else // _MSC_VER
|
||||
|
||||
#define MY_NO_INLINE
|
||||
#define MY_FORCE_INLINE
|
||||
#define MY_CDECL
|
||||
#define MY_FAST_CALL
|
||||
|
||||
/* inline keyword : for C++ / C99 */
|
||||
|
||||
/* GCC, clang: */
|
||||
/*
|
||||
#if defined (__GNUC__) && (__GNUC__ >= 4)
|
||||
#define MY_FORCE_INLINE __attribute__((always_inline))
|
||||
#if (defined(__GNUC__) && (__GNUC__ >= 4)) \
|
||||
|| (defined(__clang__) && (__clang_major__ >= 4)) \
|
||||
|| defined(__INTEL_COMPILER) \
|
||||
|| defined(__xlC__)
|
||||
#define MY_NO_INLINE __attribute__((noinline))
|
||||
// #define MY_FORCE_INLINE __attribute__((always_inline)) inline
|
||||
#else
|
||||
#define MY_NO_INLINE
|
||||
#endif
|
||||
*/
|
||||
|
||||
#define MY_FORCE_INLINE
|
||||
|
||||
|
||||
#define MY_CDECL
|
||||
|
||||
#if defined(_M_IX86) \
|
||||
|| defined(__i386__)
|
||||
// #define MY_FAST_CALL __attribute__((fastcall))
|
||||
// #define MY_FAST_CALL __attribute__((cdecl))
|
||||
#define MY_FAST_CALL
|
||||
#elif defined(MY_CPU_AMD64)
|
||||
// #define MY_FAST_CALL __attribute__((ms_abi))
|
||||
#define MY_FAST_CALL
|
||||
#else
|
||||
#define MY_FAST_CALL
|
||||
#endif
|
||||
|
||||
#endif // _MSC_VER
|
||||
|
||||
|
||||
/* The following interfaces use first parameter as pointer to structure */
|
||||
|
||||
@@ -335,12 +481,11 @@ struct ISzAlloc
|
||||
GCC 4.8.1 : classes with non-public variable members"
|
||||
*/
|
||||
|
||||
#define MY_container_of(ptr, type, m) ((type *)((char *)(1 ? (ptr) : &((type *)0)->m) - MY_offsetof(type, m)))
|
||||
|
||||
#define MY_container_of(ptr, type, m) ((type *)(void *)((char *)(void *)(1 ? (ptr) : &((type *)0)->m) - MY_offsetof(type, m)))
|
||||
|
||||
#endif
|
||||
|
||||
#define CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m) ((type *)(ptr))
|
||||
#define CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m) ((type *)(void *)(ptr))
|
||||
|
||||
/*
|
||||
#define CONTAINER_FROM_VTBL(ptr, type, m) CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m)
|
||||
@@ -353,6 +498,7 @@ struct ISzAlloc
|
||||
*/
|
||||
|
||||
|
||||
#define MY_memset_0_ARRAY(a) memset((a), 0, sizeof(a))
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -370,6 +516,14 @@ struct ISzAlloc
|
||||
|
||||
#endif
|
||||
|
||||
#define k_PropVar_TimePrec_0 0
|
||||
#define k_PropVar_TimePrec_Unix 1
|
||||
#define k_PropVar_TimePrec_DOS 2
|
||||
#define k_PropVar_TimePrec_HighPrec 3
|
||||
#define k_PropVar_TimePrec_Base 16
|
||||
#define k_PropVar_TimePrec_100ns (k_PropVar_TimePrec_Base + 7)
|
||||
#define k_PropVar_TimePrec_1ns (k_PropVar_TimePrec_Base + 9)
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
#define MY_VER_MAJOR 19
|
||||
#define MY_VER_MINOR 00
|
||||
#define MY_VER_MAJOR 22
|
||||
#define MY_VER_MINOR 01
|
||||
#define MY_VER_BUILD 0
|
||||
#define MY_VERSION_NUMBERS "19.00"
|
||||
#define MY_VERSION_NUMBERS "22.01"
|
||||
#define MY_VERSION MY_VERSION_NUMBERS
|
||||
|
||||
#ifdef MY_CPU_NAME
|
||||
@@ -10,12 +10,12 @@
|
||||
#define MY_VERSION_CPU MY_VERSION
|
||||
#endif
|
||||
|
||||
#define MY_DATE "2019-02-21"
|
||||
#define MY_DATE "2022-07-15"
|
||||
#undef MY_COPYRIGHT
|
||||
#undef MY_VERSION_COPYRIGHT_DATE
|
||||
#define MY_AUTHOR_NAME "Igor Pavlov"
|
||||
#define MY_COPYRIGHT_PD "Igor Pavlov : Public domain"
|
||||
#define MY_COPYRIGHT_CR "Copyright (c) 1999-2018 Igor Pavlov"
|
||||
#define MY_COPYRIGHT_CR "Copyright (c) 1999-2022 Igor Pavlov"
|
||||
|
||||
#ifdef USE_COPYRIGHT_CR
|
||||
#define MY_COPYRIGHT MY_COPYRIGHT_CR
|
||||
+107
-38
@@ -1,10 +1,17 @@
|
||||
/* Aes.c -- AES encryption / decryption
|
||||
2017-01-24 : Igor Pavlov : Public domain */
|
||||
2021-05-13 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
#include "Aes.h"
|
||||
#include "CpuArch.h"
|
||||
#include "Aes.h"
|
||||
|
||||
AES_CODE_FUNC g_AesCbc_Decode;
|
||||
#ifndef _SFX
|
||||
AES_CODE_FUNC g_AesCbc_Encode;
|
||||
AES_CODE_FUNC g_AesCtr_Code;
|
||||
UInt32 g_Aes_SupportedFunctions_Flags;
|
||||
#endif
|
||||
|
||||
static UInt32 T[256 * 4];
|
||||
static const Byte Sbox[256] = {
|
||||
@@ -25,23 +32,10 @@ static const Byte Sbox[256] = {
|
||||
0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
|
||||
0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16};
|
||||
|
||||
void MY_FAST_CALL AesCbc_Encode(UInt32 *ivAes, Byte *data, size_t numBlocks);
|
||||
void MY_FAST_CALL AesCbc_Decode(UInt32 *ivAes, Byte *data, size_t numBlocks);
|
||||
void MY_FAST_CALL AesCtr_Code(UInt32 *ivAes, Byte *data, size_t numBlocks);
|
||||
|
||||
void MY_FAST_CALL AesCbc_Encode_Intel(UInt32 *ivAes, Byte *data, size_t numBlocks);
|
||||
void MY_FAST_CALL AesCbc_Decode_Intel(UInt32 *ivAes, Byte *data, size_t numBlocks);
|
||||
void MY_FAST_CALL AesCtr_Code_Intel(UInt32 *ivAes, Byte *data, size_t numBlocks);
|
||||
|
||||
AES_CODE_FUNC g_AesCbc_Encode;
|
||||
AES_CODE_FUNC g_AesCbc_Decode;
|
||||
AES_CODE_FUNC g_AesCtr_Code;
|
||||
|
||||
static UInt32 D[256 * 4];
|
||||
static Byte InvS[256];
|
||||
|
||||
static const Byte Rcon[11] = { 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36 };
|
||||
|
||||
#define xtime(x) ((((x) << 1) ^ (((x) & 0x80) != 0 ? 0x1B : 0)) & 0xFF)
|
||||
|
||||
#define Ui32(a0, a1, a2, a3) ((UInt32)(a0) | ((UInt32)(a1) << 8) | ((UInt32)(a2) << 16) | ((UInt32)(a3) << 24))
|
||||
@@ -57,6 +51,36 @@ static const Byte Rcon[11] = { 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0
|
||||
#define DD(x) (D + (x << 8))
|
||||
|
||||
|
||||
// #define _SHOW_AES_STATUS
|
||||
|
||||
#ifdef MY_CPU_X86_OR_AMD64
|
||||
#define USE_HW_AES
|
||||
#elif defined(MY_CPU_ARM_OR_ARM64) && defined(MY_CPU_LE)
|
||||
#if defined(__clang__)
|
||||
#if (__clang_major__ >= 8) // fix that check
|
||||
#define USE_HW_AES
|
||||
#endif
|
||||
#elif defined(__GNUC__)
|
||||
#if (__GNUC__ >= 6) // fix that check
|
||||
#define USE_HW_AES
|
||||
#endif
|
||||
#elif defined(_MSC_VER)
|
||||
#if _MSC_VER >= 1910
|
||||
#define USE_HW_AES
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_HW_AES
|
||||
#ifdef _SHOW_AES_STATUS
|
||||
#include <stdio.h>
|
||||
#define _PRF(x) x
|
||||
#else
|
||||
#define _PRF(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
void AesGenTables(void)
|
||||
{
|
||||
unsigned i;
|
||||
@@ -90,18 +114,48 @@ void AesGenTables(void)
|
||||
}
|
||||
}
|
||||
|
||||
g_AesCbc_Encode = AesCbc_Encode;
|
||||
g_AesCbc_Decode = AesCbc_Decode;
|
||||
g_AesCtr_Code = AesCtr_Code;
|
||||
|
||||
#ifdef MY_CPU_X86_OR_AMD64
|
||||
if (CPU_Is_Aes_Supported())
|
||||
{
|
||||
g_AesCbc_Encode = AesCbc_Encode_Intel;
|
||||
g_AesCbc_Decode = AesCbc_Decode_Intel;
|
||||
g_AesCtr_Code = AesCtr_Code_Intel;
|
||||
AES_CODE_FUNC d = AesCbc_Decode;
|
||||
#ifndef _SFX
|
||||
AES_CODE_FUNC e = AesCbc_Encode;
|
||||
AES_CODE_FUNC c = AesCtr_Code;
|
||||
UInt32 flags = 0;
|
||||
#endif
|
||||
|
||||
#ifdef USE_HW_AES
|
||||
if (CPU_IsSupported_AES())
|
||||
{
|
||||
// #pragma message ("AES HW")
|
||||
_PRF(printf("\n===AES HW\n"));
|
||||
d = AesCbc_Decode_HW;
|
||||
|
||||
#ifndef _SFX
|
||||
e = AesCbc_Encode_HW;
|
||||
c = AesCtr_Code_HW;
|
||||
flags = k_Aes_SupportedFunctions_HW;
|
||||
#endif
|
||||
|
||||
#ifdef MY_CPU_X86_OR_AMD64
|
||||
if (CPU_IsSupported_VAES_AVX2())
|
||||
{
|
||||
_PRF(printf("\n===vaes avx2\n"));
|
||||
d = AesCbc_Decode_HW_256;
|
||||
#ifndef _SFX
|
||||
c = AesCtr_Code_HW_256;
|
||||
flags |= k_Aes_SupportedFunctions_HW_256;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
g_AesCbc_Decode = d;
|
||||
#ifndef _SFX
|
||||
g_AesCbc_Encode = e;
|
||||
g_AesCtr_Code = c;
|
||||
g_Aes_SupportedFunctions_Flags = flags;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -142,8 +196,11 @@ void AesGenTables(void)
|
||||
|
||||
void MY_FAST_CALL Aes_SetKey_Enc(UInt32 *w, const Byte *key, unsigned keySize)
|
||||
{
|
||||
unsigned i, wSize;
|
||||
wSize = keySize + 28;
|
||||
unsigned i, m;
|
||||
const UInt32 *wLim;
|
||||
UInt32 t;
|
||||
UInt32 rcon = 1;
|
||||
|
||||
keySize /= 4;
|
||||
w[0] = ((UInt32)keySize / 2) + 3;
|
||||
w += 4;
|
||||
@@ -151,16 +208,26 @@ void MY_FAST_CALL Aes_SetKey_Enc(UInt32 *w, const Byte *key, unsigned keySize)
|
||||
for (i = 0; i < keySize; i++, key += 4)
|
||||
w[i] = GetUi32(key);
|
||||
|
||||
for (; i < wSize; i++)
|
||||
t = w[(size_t)keySize - 1];
|
||||
wLim = w + (size_t)keySize * 3 + 28;
|
||||
m = 0;
|
||||
do
|
||||
{
|
||||
UInt32 t = w[(size_t)i - 1];
|
||||
unsigned rem = i % keySize;
|
||||
if (rem == 0)
|
||||
t = Ui32(Sbox[gb1(t)] ^ Rcon[i / keySize], Sbox[gb2(t)], Sbox[gb3(t)], Sbox[gb0(t)]);
|
||||
else if (keySize > 6 && rem == 4)
|
||||
if (m == 0)
|
||||
{
|
||||
t = Ui32(Sbox[gb1(t)] ^ rcon, Sbox[gb2(t)], Sbox[gb3(t)], Sbox[gb0(t)]);
|
||||
rcon <<= 1;
|
||||
if (rcon & 0x100)
|
||||
rcon = 0x1b;
|
||||
m = keySize;
|
||||
}
|
||||
else if (m == 4 && keySize > 6)
|
||||
t = Ui32(Sbox[gb0(t)], Sbox[gb1(t)], Sbox[gb2(t)], Sbox[gb3(t)]);
|
||||
w[i] = w[i - keySize] ^ t;
|
||||
m--;
|
||||
t ^= w[0];
|
||||
w[keySize] = t;
|
||||
}
|
||||
while (++w != wLim);
|
||||
}
|
||||
|
||||
void MY_FAST_CALL Aes_SetKey_Dec(UInt32 *w, const Byte *key, unsigned keySize)
|
||||
@@ -184,6 +251,7 @@ void MY_FAST_CALL Aes_SetKey_Dec(UInt32 *w, const Byte *key, unsigned keySize)
|
||||
src and dest are pointers to 4 UInt32 words.
|
||||
src and dest can point to same block */
|
||||
|
||||
// MY_FORCE_INLINE
|
||||
static void Aes_Encode(const UInt32 *w, UInt32 *dest, const UInt32 *src)
|
||||
{
|
||||
UInt32 s[4];
|
||||
@@ -207,6 +275,7 @@ static void Aes_Encode(const UInt32 *w, UInt32 *dest, const UInt32 *src)
|
||||
FT4(0); FT4(1); FT4(2); FT4(3);
|
||||
}
|
||||
|
||||
MY_FORCE_INLINE
|
||||
static void Aes_Decode(const UInt32 *w, UInt32 *dest, const UInt32 *src)
|
||||
{
|
||||
UInt32 s[4];
|
||||
@@ -294,12 +363,12 @@ void MY_FAST_CALL AesCtr_Code(UInt32 *p, Byte *data, size_t numBlocks)
|
||||
UInt32 t = temp[i];
|
||||
|
||||
#ifdef MY_CPU_LE_UNALIGN
|
||||
*((UInt32 *)data) ^= t;
|
||||
*((UInt32 *)(void *)data) ^= t;
|
||||
#else
|
||||
data[0] ^= (t & 0xFF);
|
||||
data[1] ^= ((t >> 8) & 0xFF);
|
||||
data[2] ^= ((t >> 16) & 0xFF);
|
||||
data[3] ^= ((t >> 24));
|
||||
data[0] = (Byte)(data[0] ^ (t & 0xFF));
|
||||
data[1] = (Byte)(data[1] ^ ((t >> 8) & 0xFF));
|
||||
data[2] = (Byte)(data[2] ^ ((t >> 16) & 0xFF));
|
||||
data[3] = (Byte)(data[3] ^ ((t >> 24)));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
+24
-2
@@ -1,5 +1,5 @@
|
||||
/* Aes.h -- AES encryption / decryption
|
||||
2013-01-18 : Igor Pavlov : Public domain */
|
||||
2018-04-28 : Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef __AES_H
|
||||
#define __AES_H
|
||||
@@ -26,12 +26,34 @@ void MY_FAST_CALL Aes_SetKey_Dec(UInt32 *aes, const Byte *key, unsigned keySize)
|
||||
|
||||
/* ivAes - 16-byte aligned pointer to iv+keyMode+roundKeys sequence: UInt32[AES_NUM_IVMRK_WORDS] */
|
||||
void AesCbc_Init(UInt32 *ivAes, const Byte *iv); /* iv size is AES_BLOCK_SIZE */
|
||||
|
||||
/* data - 16-byte aligned pointer to data */
|
||||
/* numBlocks - the number of 16-byte blocks in data array */
|
||||
typedef void (MY_FAST_CALL *AES_CODE_FUNC)(UInt32 *ivAes, Byte *data, size_t numBlocks);
|
||||
extern AES_CODE_FUNC g_AesCbc_Encode;
|
||||
|
||||
extern AES_CODE_FUNC g_AesCbc_Decode;
|
||||
#ifndef _SFX
|
||||
extern AES_CODE_FUNC g_AesCbc_Encode;
|
||||
extern AES_CODE_FUNC g_AesCtr_Code;
|
||||
#define k_Aes_SupportedFunctions_HW (1 << 2)
|
||||
#define k_Aes_SupportedFunctions_HW_256 (1 << 3)
|
||||
extern UInt32 g_Aes_SupportedFunctions_Flags;
|
||||
#endif
|
||||
|
||||
|
||||
#define DECLARE__AES_CODE_FUNC(funcName) \
|
||||
void MY_FAST_CALL funcName(UInt32 *ivAes, Byte *data, size_t numBlocks);
|
||||
|
||||
DECLARE__AES_CODE_FUNC (AesCbc_Encode)
|
||||
DECLARE__AES_CODE_FUNC (AesCbc_Decode)
|
||||
DECLARE__AES_CODE_FUNC (AesCtr_Code)
|
||||
|
||||
DECLARE__AES_CODE_FUNC (AesCbc_Encode_HW)
|
||||
DECLARE__AES_CODE_FUNC (AesCbc_Decode_HW)
|
||||
DECLARE__AES_CODE_FUNC (AesCtr_Code_HW)
|
||||
|
||||
DECLARE__AES_CODE_FUNC (AesCbc_Decode_HW_256)
|
||||
DECLARE__AES_CODE_FUNC (AesCtr_Code_HW_256)
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
Vendored
+776
@@ -0,0 +1,776 @@
|
||||
/* AesOpt.c -- AES optimized code for x86 AES hardware instructions
|
||||
2021-04-01 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
#include "CpuArch.h"
|
||||
|
||||
#ifdef MY_CPU_X86_OR_AMD64
|
||||
|
||||
#if defined(__clang__)
|
||||
#if __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 8)
|
||||
#define USE_INTEL_AES
|
||||
#define ATTRIB_AES __attribute__((__target__("aes")))
|
||||
#if (__clang_major__ >= 8)
|
||||
#define USE_INTEL_VAES
|
||||
#define ATTRIB_VAES __attribute__((__target__("aes,vaes,avx2")))
|
||||
#endif
|
||||
#endif
|
||||
#elif defined(__GNUC__)
|
||||
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
|
||||
#define USE_INTEL_AES
|
||||
#ifndef __AES__
|
||||
#define ATTRIB_AES __attribute__((__target__("aes")))
|
||||
#endif
|
||||
#if (__GNUC__ >= 8)
|
||||
#define USE_INTEL_VAES
|
||||
#define ATTRIB_VAES __attribute__((__target__("aes,vaes,avx2")))
|
||||
#endif
|
||||
#endif
|
||||
#elif defined(__INTEL_COMPILER)
|
||||
#if (__INTEL_COMPILER >= 1110)
|
||||
#define USE_INTEL_AES
|
||||
#if (__INTEL_COMPILER >= 1900)
|
||||
#define USE_INTEL_VAES
|
||||
#endif
|
||||
#endif
|
||||
#elif defined(_MSC_VER)
|
||||
#if (_MSC_VER > 1500) || (_MSC_FULL_VER >= 150030729)
|
||||
#define USE_INTEL_AES
|
||||
#if (_MSC_VER >= 1910)
|
||||
#define USE_INTEL_VAES
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ATTRIB_AES
|
||||
#define ATTRIB_AES
|
||||
#endif
|
||||
#ifndef ATTRIB_VAES
|
||||
#define ATTRIB_VAES
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USE_INTEL_AES
|
||||
|
||||
#include <wmmintrin.h>
|
||||
|
||||
#ifndef USE_INTEL_VAES
|
||||
#define AES_TYPE_keys __m128i
|
||||
#define AES_TYPE_data __m128i
|
||||
#endif
|
||||
|
||||
#define AES_FUNC_START(name) \
|
||||
void MY_FAST_CALL name(__m128i *p, __m128i *data, size_t numBlocks)
|
||||
|
||||
#define AES_FUNC_START2(name) \
|
||||
AES_FUNC_START (name); \
|
||||
ATTRIB_AES \
|
||||
AES_FUNC_START (name)
|
||||
|
||||
#define MM_OP(op, dest, src) dest = op(dest, src);
|
||||
#define MM_OP_m(op, src) MM_OP(op, m, src);
|
||||
|
||||
#define MM_XOR( dest, src) MM_OP(_mm_xor_si128, dest, src);
|
||||
#define AVX_XOR(dest, src) MM_OP(_mm256_xor_si256, dest, src);
|
||||
|
||||
|
||||
AES_FUNC_START2 (AesCbc_Encode_HW)
|
||||
{
|
||||
__m128i m = *p;
|
||||
const __m128i k0 = p[2];
|
||||
const __m128i k1 = p[3];
|
||||
const UInt32 numRounds2 = *(const UInt32 *)(p + 1) - 1;
|
||||
for (; numBlocks != 0; numBlocks--, data++)
|
||||
{
|
||||
UInt32 r = numRounds2;
|
||||
const __m128i *w = p + 4;
|
||||
__m128i temp = *data;
|
||||
MM_XOR (temp, k0);
|
||||
MM_XOR (m, temp);
|
||||
MM_OP_m (_mm_aesenc_si128, k1);
|
||||
do
|
||||
{
|
||||
MM_OP_m (_mm_aesenc_si128, w[0]);
|
||||
MM_OP_m (_mm_aesenc_si128, w[1]);
|
||||
w += 2;
|
||||
}
|
||||
while (--r);
|
||||
MM_OP_m (_mm_aesenclast_si128, w[0]);
|
||||
*data = m;
|
||||
}
|
||||
*p = m;
|
||||
}
|
||||
|
||||
|
||||
#define WOP_1(op)
|
||||
#define WOP_2(op) WOP_1 (op) op (m1, 1);
|
||||
#define WOP_3(op) WOP_2 (op) op (m2, 2);
|
||||
#define WOP_4(op) WOP_3 (op) op (m3, 3);
|
||||
#ifdef MY_CPU_AMD64
|
||||
#define WOP_5(op) WOP_4 (op) op (m4, 4);
|
||||
#define WOP_6(op) WOP_5 (op) op (m5, 5);
|
||||
#define WOP_7(op) WOP_6 (op) op (m6, 6);
|
||||
#define WOP_8(op) WOP_7 (op) op (m7, 7);
|
||||
#endif
|
||||
/*
|
||||
#define WOP_9(op) WOP_8 (op) op (m8, 8);
|
||||
#define WOP_10(op) WOP_9 (op) op (m9, 9);
|
||||
#define WOP_11(op) WOP_10(op) op (m10, 10);
|
||||
#define WOP_12(op) WOP_11(op) op (m11, 11);
|
||||
#define WOP_13(op) WOP_12(op) op (m12, 12);
|
||||
#define WOP_14(op) WOP_13(op) op (m13, 13);
|
||||
*/
|
||||
|
||||
#ifdef MY_CPU_AMD64
|
||||
#define NUM_WAYS 8
|
||||
#define WOP_M1 WOP_8
|
||||
#else
|
||||
#define NUM_WAYS 4
|
||||
#define WOP_M1 WOP_4
|
||||
#endif
|
||||
|
||||
#define WOP(op) op (m0, 0); WOP_M1(op)
|
||||
|
||||
|
||||
#define DECLARE_VAR(reg, ii) __m128i reg
|
||||
#define LOAD_data( reg, ii) reg = data[ii];
|
||||
#define STORE_data( reg, ii) data[ii] = reg;
|
||||
#if (NUM_WAYS > 1)
|
||||
#define XOR_data_M1(reg, ii) MM_XOR (reg, data[ii- 1]);
|
||||
#endif
|
||||
|
||||
#define AVX__DECLARE_VAR(reg, ii) __m256i reg
|
||||
#define AVX__LOAD_data( reg, ii) reg = ((const __m256i *)(const void *)data)[ii];
|
||||
#define AVX__STORE_data( reg, ii) ((__m256i *)(void *)data)[ii] = reg;
|
||||
#define AVX__XOR_data_M1(reg, ii) AVX_XOR (reg, (((const __m256i *)(const void *)(data - 1))[ii]));
|
||||
|
||||
#define MM_OP_key(op, reg) MM_OP(op, reg, key);
|
||||
|
||||
#define AES_DEC( reg, ii) MM_OP_key (_mm_aesdec_si128, reg)
|
||||
#define AES_DEC_LAST( reg, ii) MM_OP_key (_mm_aesdeclast_si128, reg)
|
||||
#define AES_ENC( reg, ii) MM_OP_key (_mm_aesenc_si128, reg)
|
||||
#define AES_ENC_LAST( reg, ii) MM_OP_key (_mm_aesenclast_si128, reg)
|
||||
#define AES_XOR( reg, ii) MM_OP_key (_mm_xor_si128, reg)
|
||||
|
||||
|
||||
#define AVX__AES_DEC( reg, ii) MM_OP_key (_mm256_aesdec_epi128, reg)
|
||||
#define AVX__AES_DEC_LAST( reg, ii) MM_OP_key (_mm256_aesdeclast_epi128, reg)
|
||||
#define AVX__AES_ENC( reg, ii) MM_OP_key (_mm256_aesenc_epi128, reg)
|
||||
#define AVX__AES_ENC_LAST( reg, ii) MM_OP_key (_mm256_aesenclast_epi128, reg)
|
||||
#define AVX__AES_XOR( reg, ii) MM_OP_key (_mm256_xor_si256, reg)
|
||||
|
||||
#define CTR_START(reg, ii) MM_OP (_mm_add_epi64, ctr, one); reg = ctr;
|
||||
#define CTR_END( reg, ii) MM_XOR (data[ii], reg);
|
||||
|
||||
#define AVX__CTR_START(reg, ii) MM_OP (_mm256_add_epi64, ctr2, two); reg = _mm256_xor_si256(ctr2, key);
|
||||
#define AVX__CTR_END( reg, ii) AVX_XOR (((__m256i *)(void *)data)[ii], reg);
|
||||
|
||||
#define WOP_KEY(op, n) { \
|
||||
const __m128i key = w[n]; \
|
||||
WOP(op); }
|
||||
|
||||
#define AVX__WOP_KEY(op, n) { \
|
||||
const __m256i key = w[n]; \
|
||||
WOP(op); }
|
||||
|
||||
|
||||
#define WIDE_LOOP_START \
|
||||
dataEnd = data + numBlocks; \
|
||||
if (numBlocks >= NUM_WAYS) \
|
||||
{ dataEnd -= NUM_WAYS; do { \
|
||||
|
||||
|
||||
#define WIDE_LOOP_END \
|
||||
data += NUM_WAYS; \
|
||||
} while (data <= dataEnd); \
|
||||
dataEnd += NUM_WAYS; } \
|
||||
|
||||
|
||||
#define SINGLE_LOOP \
|
||||
for (; data < dataEnd; data++)
|
||||
|
||||
|
||||
#define NUM_AES_KEYS_MAX 15
|
||||
|
||||
#define WIDE_LOOP_START_AVX(OP) \
|
||||
dataEnd = data + numBlocks; \
|
||||
if (numBlocks >= NUM_WAYS * 2) \
|
||||
{ __m256i keys[NUM_AES_KEYS_MAX]; \
|
||||
UInt32 ii; \
|
||||
OP \
|
||||
for (ii = 0; ii < numRounds; ii++) \
|
||||
keys[ii] = _mm256_broadcastsi128_si256(p[ii]); \
|
||||
dataEnd -= NUM_WAYS * 2; do { \
|
||||
|
||||
|
||||
#define WIDE_LOOP_END_AVX(OP) \
|
||||
data += NUM_WAYS * 2; \
|
||||
} while (data <= dataEnd); \
|
||||
dataEnd += NUM_WAYS * 2; \
|
||||
OP \
|
||||
_mm256_zeroupper(); \
|
||||
} \
|
||||
|
||||
/* MSVC for x86: If we don't call _mm256_zeroupper(), and -arch:IA32 is not specified,
|
||||
MSVC still can insert vzeroupper instruction. */
|
||||
|
||||
|
||||
AES_FUNC_START2 (AesCbc_Decode_HW)
|
||||
{
|
||||
__m128i iv = *p;
|
||||
const __m128i *wStart = p + *(const UInt32 *)(p + 1) * 2 + 2 - 1;
|
||||
const __m128i *dataEnd;
|
||||
p += 2;
|
||||
|
||||
WIDE_LOOP_START
|
||||
{
|
||||
const __m128i *w = wStart;
|
||||
|
||||
WOP (DECLARE_VAR)
|
||||
WOP (LOAD_data);
|
||||
WOP_KEY (AES_XOR, 1)
|
||||
|
||||
do
|
||||
{
|
||||
WOP_KEY (AES_DEC, 0)
|
||||
w--;
|
||||
}
|
||||
while (w != p);
|
||||
WOP_KEY (AES_DEC_LAST, 0)
|
||||
|
||||
MM_XOR (m0, iv);
|
||||
WOP_M1 (XOR_data_M1)
|
||||
iv = data[NUM_WAYS - 1];
|
||||
WOP (STORE_data);
|
||||
}
|
||||
WIDE_LOOP_END
|
||||
|
||||
SINGLE_LOOP
|
||||
{
|
||||
const __m128i *w = wStart - 1;
|
||||
__m128i m = _mm_xor_si128 (w[2], *data);
|
||||
do
|
||||
{
|
||||
MM_OP_m (_mm_aesdec_si128, w[1]);
|
||||
MM_OP_m (_mm_aesdec_si128, w[0]);
|
||||
w -= 2;
|
||||
}
|
||||
while (w != p);
|
||||
MM_OP_m (_mm_aesdec_si128, w[1]);
|
||||
MM_OP_m (_mm_aesdeclast_si128, w[0]);
|
||||
|
||||
MM_XOR (m, iv);
|
||||
iv = *data;
|
||||
*data = m;
|
||||
}
|
||||
|
||||
p[-2] = iv;
|
||||
}
|
||||
|
||||
|
||||
AES_FUNC_START2 (AesCtr_Code_HW)
|
||||
{
|
||||
__m128i ctr = *p;
|
||||
UInt32 numRoundsMinus2 = *(const UInt32 *)(p + 1) * 2 - 1;
|
||||
const __m128i *dataEnd;
|
||||
__m128i one = _mm_cvtsi32_si128(1);
|
||||
|
||||
p += 2;
|
||||
|
||||
WIDE_LOOP_START
|
||||
{
|
||||
const __m128i *w = p;
|
||||
UInt32 r = numRoundsMinus2;
|
||||
WOP (DECLARE_VAR)
|
||||
WOP (CTR_START);
|
||||
WOP_KEY (AES_XOR, 0)
|
||||
w += 1;
|
||||
do
|
||||
{
|
||||
WOP_KEY (AES_ENC, 0)
|
||||
w += 1;
|
||||
}
|
||||
while (--r);
|
||||
WOP_KEY (AES_ENC_LAST, 0)
|
||||
|
||||
WOP (CTR_END);
|
||||
}
|
||||
WIDE_LOOP_END
|
||||
|
||||
SINGLE_LOOP
|
||||
{
|
||||
UInt32 numRounds2 = *(const UInt32 *)(p - 2 + 1) - 1;
|
||||
const __m128i *w = p;
|
||||
__m128i m;
|
||||
MM_OP (_mm_add_epi64, ctr, one);
|
||||
m = _mm_xor_si128 (ctr, p[0]);
|
||||
w += 1;
|
||||
do
|
||||
{
|
||||
MM_OP_m (_mm_aesenc_si128, w[0]);
|
||||
MM_OP_m (_mm_aesenc_si128, w[1]);
|
||||
w += 2;
|
||||
}
|
||||
while (--numRounds2);
|
||||
MM_OP_m (_mm_aesenc_si128, w[0]);
|
||||
MM_OP_m (_mm_aesenclast_si128, w[1]);
|
||||
MM_XOR (*data, m);
|
||||
}
|
||||
|
||||
p[-2] = ctr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef USE_INTEL_VAES
|
||||
|
||||
#if defined(__clang__) && defined(_MSC_VER)
|
||||
#define __SSE4_2__
|
||||
#define __AES__
|
||||
#define __AVX__
|
||||
#define __AVX2__
|
||||
#define __VAES__
|
||||
#define __AVX512F__
|
||||
#define __AVX512VL__
|
||||
#endif
|
||||
|
||||
#include <immintrin.h>
|
||||
|
||||
#define VAES_FUNC_START2(name) \
|
||||
AES_FUNC_START (name); \
|
||||
ATTRIB_VAES \
|
||||
AES_FUNC_START (name)
|
||||
|
||||
VAES_FUNC_START2 (AesCbc_Decode_HW_256)
|
||||
{
|
||||
__m128i iv = *p;
|
||||
const __m128i *dataEnd;
|
||||
UInt32 numRounds = *(const UInt32 *)(p + 1) * 2 + 1;
|
||||
p += 2;
|
||||
|
||||
WIDE_LOOP_START_AVX(;)
|
||||
{
|
||||
const __m256i *w = keys + numRounds - 2;
|
||||
|
||||
WOP (AVX__DECLARE_VAR)
|
||||
WOP (AVX__LOAD_data);
|
||||
AVX__WOP_KEY (AVX__AES_XOR, 1)
|
||||
|
||||
do
|
||||
{
|
||||
AVX__WOP_KEY (AVX__AES_DEC, 0)
|
||||
w--;
|
||||
}
|
||||
while (w != keys);
|
||||
AVX__WOP_KEY (AVX__AES_DEC_LAST, 0)
|
||||
|
||||
AVX_XOR (m0, _mm256_setr_m128i(iv, data[0]));
|
||||
WOP_M1 (AVX__XOR_data_M1)
|
||||
iv = data[NUM_WAYS * 2 - 1];
|
||||
WOP (AVX__STORE_data);
|
||||
}
|
||||
WIDE_LOOP_END_AVX(;)
|
||||
|
||||
SINGLE_LOOP
|
||||
{
|
||||
const __m128i *w = p + *(const UInt32 *)(p + 1 - 2) * 2 + 1 - 3;
|
||||
__m128i m = _mm_xor_si128 (w[2], *data);
|
||||
do
|
||||
{
|
||||
MM_OP_m (_mm_aesdec_si128, w[1]);
|
||||
MM_OP_m (_mm_aesdec_si128, w[0]);
|
||||
w -= 2;
|
||||
}
|
||||
while (w != p);
|
||||
MM_OP_m (_mm_aesdec_si128, w[1]);
|
||||
MM_OP_m (_mm_aesdeclast_si128, w[0]);
|
||||
|
||||
MM_XOR (m, iv);
|
||||
iv = *data;
|
||||
*data = m;
|
||||
}
|
||||
|
||||
p[-2] = iv;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
SSE2: _mm_cvtsi32_si128 : movd
|
||||
AVX: _mm256_setr_m128i : vinsertf128
|
||||
AVX2: _mm256_add_epi64 : vpaddq ymm, ymm, ymm
|
||||
_mm256_extracti128_si256 : vextracti128
|
||||
_mm256_broadcastsi128_si256 : vbroadcasti128
|
||||
*/
|
||||
|
||||
#define AVX__CTR_LOOP_START \
|
||||
ctr2 = _mm256_setr_m128i(_mm_sub_epi64(ctr, one), ctr); \
|
||||
two = _mm256_setr_m128i(one, one); \
|
||||
two = _mm256_add_epi64(two, two); \
|
||||
|
||||
// two = _mm256_setr_epi64x(2, 0, 2, 0);
|
||||
|
||||
#define AVX__CTR_LOOP_ENC \
|
||||
ctr = _mm256_extracti128_si256 (ctr2, 1); \
|
||||
|
||||
VAES_FUNC_START2 (AesCtr_Code_HW_256)
|
||||
{
|
||||
__m128i ctr = *p;
|
||||
UInt32 numRounds = *(const UInt32 *)(p + 1) * 2 + 1;
|
||||
const __m128i *dataEnd;
|
||||
__m128i one = _mm_cvtsi32_si128(1);
|
||||
__m256i ctr2, two;
|
||||
p += 2;
|
||||
|
||||
WIDE_LOOP_START_AVX (AVX__CTR_LOOP_START)
|
||||
{
|
||||
const __m256i *w = keys;
|
||||
UInt32 r = numRounds - 2;
|
||||
WOP (AVX__DECLARE_VAR)
|
||||
AVX__WOP_KEY (AVX__CTR_START, 0);
|
||||
|
||||
w += 1;
|
||||
do
|
||||
{
|
||||
AVX__WOP_KEY (AVX__AES_ENC, 0)
|
||||
w += 1;
|
||||
}
|
||||
while (--r);
|
||||
AVX__WOP_KEY (AVX__AES_ENC_LAST, 0)
|
||||
|
||||
WOP (AVX__CTR_END);
|
||||
}
|
||||
WIDE_LOOP_END_AVX (AVX__CTR_LOOP_ENC)
|
||||
|
||||
SINGLE_LOOP
|
||||
{
|
||||
UInt32 numRounds2 = *(const UInt32 *)(p - 2 + 1) - 1;
|
||||
const __m128i *w = p;
|
||||
__m128i m;
|
||||
MM_OP (_mm_add_epi64, ctr, one);
|
||||
m = _mm_xor_si128 (ctr, p[0]);
|
||||
w += 1;
|
||||
do
|
||||
{
|
||||
MM_OP_m (_mm_aesenc_si128, w[0]);
|
||||
MM_OP_m (_mm_aesenc_si128, w[1]);
|
||||
w += 2;
|
||||
}
|
||||
while (--numRounds2);
|
||||
MM_OP_m (_mm_aesenc_si128, w[0]);
|
||||
MM_OP_m (_mm_aesenclast_si128, w[1]);
|
||||
MM_XOR (*data, m);
|
||||
}
|
||||
|
||||
p[-2] = ctr;
|
||||
}
|
||||
|
||||
#endif // USE_INTEL_VAES
|
||||
|
||||
#else // USE_INTEL_AES
|
||||
|
||||
/* no USE_INTEL_AES */
|
||||
|
||||
#pragma message("AES HW_SW stub was used")
|
||||
|
||||
#define AES_TYPE_keys UInt32
|
||||
#define AES_TYPE_data Byte
|
||||
|
||||
#define AES_FUNC_START(name) \
|
||||
void MY_FAST_CALL name(UInt32 *p, Byte *data, size_t numBlocks) \
|
||||
|
||||
#define AES_COMPAT_STUB(name) \
|
||||
AES_FUNC_START(name); \
|
||||
AES_FUNC_START(name ## _HW) \
|
||||
{ name(p, data, numBlocks); }
|
||||
|
||||
AES_COMPAT_STUB (AesCbc_Encode)
|
||||
AES_COMPAT_STUB (AesCbc_Decode)
|
||||
AES_COMPAT_STUB (AesCtr_Code)
|
||||
|
||||
#endif // USE_INTEL_AES
|
||||
|
||||
|
||||
#ifndef USE_INTEL_VAES
|
||||
|
||||
#pragma message("VAES HW_SW stub was used")
|
||||
|
||||
#define VAES_COMPAT_STUB(name) \
|
||||
void MY_FAST_CALL name ## _256(UInt32 *p, Byte *data, size_t numBlocks); \
|
||||
void MY_FAST_CALL name ## _256(UInt32 *p, Byte *data, size_t numBlocks) \
|
||||
{ name((AES_TYPE_keys *)(void *)p, (AES_TYPE_data *)(void *)data, numBlocks); }
|
||||
|
||||
VAES_COMPAT_STUB (AesCbc_Decode_HW)
|
||||
VAES_COMPAT_STUB (AesCtr_Code_HW)
|
||||
|
||||
#endif // ! USE_INTEL_VAES
|
||||
|
||||
|
||||
#elif defined(MY_CPU_ARM_OR_ARM64) && defined(MY_CPU_LE)
|
||||
|
||||
#if defined(__clang__)
|
||||
#if (__clang_major__ >= 8) // fix that check
|
||||
#define USE_HW_AES
|
||||
#endif
|
||||
#elif defined(__GNUC__)
|
||||
#if (__GNUC__ >= 6) // fix that check
|
||||
#define USE_HW_AES
|
||||
#endif
|
||||
#elif defined(_MSC_VER)
|
||||
#if _MSC_VER >= 1910
|
||||
#define USE_HW_AES
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_HW_AES
|
||||
|
||||
// #pragma message("=== AES HW === ")
|
||||
|
||||
#if defined(__clang__) || defined(__GNUC__)
|
||||
#ifdef MY_CPU_ARM64
|
||||
#define ATTRIB_AES __attribute__((__target__("+crypto")))
|
||||
#else
|
||||
#define ATTRIB_AES __attribute__((__target__("fpu=crypto-neon-fp-armv8")))
|
||||
#endif
|
||||
#else
|
||||
// _MSC_VER
|
||||
// for arm32
|
||||
#define _ARM_USE_NEW_NEON_INTRINSICS
|
||||
#endif
|
||||
|
||||
#ifndef ATTRIB_AES
|
||||
#define ATTRIB_AES
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && defined(MY_CPU_ARM64)
|
||||
#include <arm64_neon.h>
|
||||
#else
|
||||
#include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
typedef uint8x16_t v128;
|
||||
|
||||
#define AES_FUNC_START(name) \
|
||||
void MY_FAST_CALL name(v128 *p, v128 *data, size_t numBlocks)
|
||||
|
||||
#define AES_FUNC_START2(name) \
|
||||
AES_FUNC_START (name); \
|
||||
ATTRIB_AES \
|
||||
AES_FUNC_START (name)
|
||||
|
||||
#define MM_OP(op, dest, src) dest = op(dest, src);
|
||||
#define MM_OP_m(op, src) MM_OP(op, m, src);
|
||||
#define MM_OP1_m(op) m = op(m);
|
||||
|
||||
#define MM_XOR( dest, src) MM_OP(veorq_u8, dest, src);
|
||||
#define MM_XOR_m( src) MM_XOR(m, src);
|
||||
|
||||
#define AES_E_m(k) MM_OP_m (vaeseq_u8, k);
|
||||
#define AES_E_MC_m(k) AES_E_m (k); MM_OP1_m(vaesmcq_u8);
|
||||
|
||||
|
||||
AES_FUNC_START2 (AesCbc_Encode_HW)
|
||||
{
|
||||
v128 m = *p;
|
||||
const v128 k0 = p[2];
|
||||
const v128 k1 = p[3];
|
||||
const v128 k2 = p[4];
|
||||
const v128 k3 = p[5];
|
||||
const v128 k4 = p[6];
|
||||
const v128 k5 = p[7];
|
||||
const v128 k6 = p[8];
|
||||
const v128 k7 = p[9];
|
||||
const v128 k8 = p[10];
|
||||
const v128 k9 = p[11];
|
||||
const UInt32 numRounds2 = *(const UInt32 *)(p + 1);
|
||||
const v128 *w = p + ((size_t)numRounds2 * 2);
|
||||
const v128 k_z1 = w[1];
|
||||
const v128 k_z0 = w[2];
|
||||
for (; numBlocks != 0; numBlocks--, data++)
|
||||
{
|
||||
MM_XOR_m (*data);
|
||||
AES_E_MC_m (k0)
|
||||
AES_E_MC_m (k1)
|
||||
AES_E_MC_m (k2)
|
||||
AES_E_MC_m (k3)
|
||||
AES_E_MC_m (k4)
|
||||
AES_E_MC_m (k5)
|
||||
AES_E_MC_m (k6)
|
||||
AES_E_MC_m (k7)
|
||||
AES_E_MC_m (k8)
|
||||
if (numRounds2 >= 6)
|
||||
{
|
||||
AES_E_MC_m (k9)
|
||||
AES_E_MC_m (p[12])
|
||||
if (numRounds2 != 6)
|
||||
{
|
||||
AES_E_MC_m (p[13])
|
||||
AES_E_MC_m (p[14])
|
||||
}
|
||||
}
|
||||
AES_E_m (k_z1);
|
||||
MM_XOR_m (k_z0);
|
||||
*data = m;
|
||||
}
|
||||
*p = m;
|
||||
}
|
||||
|
||||
|
||||
#define WOP_1(op)
|
||||
#define WOP_2(op) WOP_1 (op) op (m1, 1);
|
||||
#define WOP_3(op) WOP_2 (op) op (m2, 2);
|
||||
#define WOP_4(op) WOP_3 (op) op (m3, 3);
|
||||
#define WOP_5(op) WOP_4 (op) op (m4, 4);
|
||||
#define WOP_6(op) WOP_5 (op) op (m5, 5);
|
||||
#define WOP_7(op) WOP_6 (op) op (m6, 6);
|
||||
#define WOP_8(op) WOP_7 (op) op (m7, 7);
|
||||
|
||||
#define NUM_WAYS 8
|
||||
#define WOP_M1 WOP_8
|
||||
|
||||
#define WOP(op) op (m0, 0); WOP_M1(op)
|
||||
|
||||
#define DECLARE_VAR(reg, ii) v128 reg
|
||||
#define LOAD_data( reg, ii) reg = data[ii];
|
||||
#define STORE_data( reg, ii) data[ii] = reg;
|
||||
#if (NUM_WAYS > 1)
|
||||
#define XOR_data_M1(reg, ii) MM_XOR (reg, data[ii- 1]);
|
||||
#endif
|
||||
|
||||
#define MM_OP_key(op, reg) MM_OP (op, reg, key);
|
||||
|
||||
#define AES_D_m(k) MM_OP_m (vaesdq_u8, k);
|
||||
#define AES_D_IMC_m(k) AES_D_m (k); MM_OP1_m (vaesimcq_u8);
|
||||
|
||||
#define AES_XOR( reg, ii) MM_OP_key (veorq_u8, reg)
|
||||
#define AES_D( reg, ii) MM_OP_key (vaesdq_u8, reg)
|
||||
#define AES_E( reg, ii) MM_OP_key (vaeseq_u8, reg)
|
||||
|
||||
#define AES_D_IMC( reg, ii) AES_D (reg, ii); reg = vaesimcq_u8(reg)
|
||||
#define AES_E_MC( reg, ii) AES_E (reg, ii); reg = vaesmcq_u8(reg)
|
||||
|
||||
#define CTR_START(reg, ii) MM_OP (vaddq_u64, ctr, one); reg = vreinterpretq_u8_u64(ctr);
|
||||
#define CTR_END( reg, ii) MM_XOR (data[ii], reg);
|
||||
|
||||
#define WOP_KEY(op, n) { \
|
||||
const v128 key = w[n]; \
|
||||
WOP(op); }
|
||||
|
||||
#define WIDE_LOOP_START \
|
||||
dataEnd = data + numBlocks; \
|
||||
if (numBlocks >= NUM_WAYS) \
|
||||
{ dataEnd -= NUM_WAYS; do { \
|
||||
|
||||
#define WIDE_LOOP_END \
|
||||
data += NUM_WAYS; \
|
||||
} while (data <= dataEnd); \
|
||||
dataEnd += NUM_WAYS; } \
|
||||
|
||||
#define SINGLE_LOOP \
|
||||
for (; data < dataEnd; data++)
|
||||
|
||||
|
||||
AES_FUNC_START2 (AesCbc_Decode_HW)
|
||||
{
|
||||
v128 iv = *p;
|
||||
const v128 *wStart = p + ((size_t)*(const UInt32 *)(p + 1)) * 2;
|
||||
const v128 *dataEnd;
|
||||
p += 2;
|
||||
|
||||
WIDE_LOOP_START
|
||||
{
|
||||
const v128 *w = wStart;
|
||||
WOP (DECLARE_VAR)
|
||||
WOP (LOAD_data);
|
||||
WOP_KEY (AES_D_IMC, 2)
|
||||
do
|
||||
{
|
||||
WOP_KEY (AES_D_IMC, 1)
|
||||
WOP_KEY (AES_D_IMC, 0)
|
||||
w -= 2;
|
||||
}
|
||||
while (w != p);
|
||||
WOP_KEY (AES_D, 1)
|
||||
WOP_KEY (AES_XOR, 0)
|
||||
MM_XOR (m0, iv);
|
||||
WOP_M1 (XOR_data_M1)
|
||||
iv = data[NUM_WAYS - 1];
|
||||
WOP (STORE_data);
|
||||
}
|
||||
WIDE_LOOP_END
|
||||
|
||||
SINGLE_LOOP
|
||||
{
|
||||
const v128 *w = wStart;
|
||||
v128 m = *data;
|
||||
AES_D_IMC_m (w[2])
|
||||
do
|
||||
{
|
||||
AES_D_IMC_m (w[1]);
|
||||
AES_D_IMC_m (w[0]);
|
||||
w -= 2;
|
||||
}
|
||||
while (w != p);
|
||||
AES_D_m (w[1]);
|
||||
MM_XOR_m (w[0]);
|
||||
MM_XOR_m (iv);
|
||||
iv = *data;
|
||||
*data = m;
|
||||
}
|
||||
|
||||
p[-2] = iv;
|
||||
}
|
||||
|
||||
|
||||
AES_FUNC_START2 (AesCtr_Code_HW)
|
||||
{
|
||||
uint64x2_t ctr = vreinterpretq_u64_u8(*p);
|
||||
const v128 *wEnd = p + ((size_t)*(const UInt32 *)(p + 1)) * 2;
|
||||
const v128 *dataEnd;
|
||||
uint64x2_t one = vdupq_n_u64(0);
|
||||
one = vsetq_lane_u64(1, one, 0);
|
||||
p += 2;
|
||||
|
||||
WIDE_LOOP_START
|
||||
{
|
||||
const v128 *w = p;
|
||||
WOP (DECLARE_VAR)
|
||||
WOP (CTR_START);
|
||||
do
|
||||
{
|
||||
WOP_KEY (AES_E_MC, 0)
|
||||
WOP_KEY (AES_E_MC, 1)
|
||||
w += 2;
|
||||
}
|
||||
while (w != wEnd);
|
||||
WOP_KEY (AES_E_MC, 0)
|
||||
WOP_KEY (AES_E, 1)
|
||||
WOP_KEY (AES_XOR, 2)
|
||||
WOP (CTR_END);
|
||||
}
|
||||
WIDE_LOOP_END
|
||||
|
||||
SINGLE_LOOP
|
||||
{
|
||||
const v128 *w = p;
|
||||
v128 m;
|
||||
CTR_START (m, 0);
|
||||
do
|
||||
{
|
||||
AES_E_MC_m (w[0]);
|
||||
AES_E_MC_m (w[1]);
|
||||
w += 2;
|
||||
}
|
||||
while (w != wEnd);
|
||||
AES_E_MC_m (w[0]);
|
||||
AES_E_m (w[1]);
|
||||
MM_XOR_m (w[2]);
|
||||
CTR_END (m, 0);
|
||||
}
|
||||
|
||||
p[-2] = vreinterpretq_u8_u64(ctr);
|
||||
}
|
||||
|
||||
#endif // USE_HW_AES
|
||||
|
||||
#endif // MY_CPU_ARM_OR_ARM64
|
||||
+24
-16
@@ -1,12 +1,12 @@
|
||||
/* Alloc.c -- Memory allocation functions
|
||||
2018-04-27 : Igor Pavlov : Public domain */
|
||||
2021-07-13 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -122,7 +122,6 @@ static void PrintAddr(void *p)
|
||||
#define Print(s)
|
||||
#define PrintLn()
|
||||
#define PrintHex(v, align)
|
||||
#define PrintDec(v, align)
|
||||
#define PrintAddr(p)
|
||||
|
||||
#endif
|
||||
@@ -133,10 +132,11 @@ void *MyAlloc(size_t size)
|
||||
{
|
||||
if (size == 0)
|
||||
return NULL;
|
||||
PRINT_ALLOC("Alloc ", g_allocCount, size, NULL);
|
||||
#ifdef _SZ_ALLOC_DEBUG
|
||||
{
|
||||
void *p = malloc(size);
|
||||
PRINT_ALLOC("Alloc ", g_allocCount, size, p);
|
||||
// PRINT_ALLOC("Alloc ", g_allocCount, size, p);
|
||||
return p;
|
||||
}
|
||||
#else
|
||||
@@ -172,14 +172,20 @@ void MidFree(void *address)
|
||||
VirtualFree(address, 0, MEM_RELEASE);
|
||||
}
|
||||
|
||||
#ifndef MEM_LARGE_PAGES
|
||||
#undef _7ZIP_LARGE_PAGES
|
||||
#ifdef _7ZIP_LARGE_PAGES
|
||||
|
||||
#ifdef MEM_LARGE_PAGES
|
||||
#define MY__MEM_LARGE_PAGES MEM_LARGE_PAGES
|
||||
#else
|
||||
#define MY__MEM_LARGE_PAGES 0x20000000
|
||||
#endif
|
||||
|
||||
#ifdef _7ZIP_LARGE_PAGES
|
||||
extern
|
||||
SIZE_T g_LargePageSize;
|
||||
SIZE_T g_LargePageSize = 0;
|
||||
typedef SIZE_T (WINAPI *GetLargePageMinimumP)();
|
||||
#endif
|
||||
typedef SIZE_T (WINAPI *GetLargePageMinimumP)(VOID);
|
||||
|
||||
#endif // _7ZIP_LARGE_PAGES
|
||||
|
||||
void SetLargePageSize()
|
||||
{
|
||||
@@ -214,7 +220,7 @@ void *BigAlloc(size_t size)
|
||||
size2 = (size + ps) & ~ps;
|
||||
if (size2 >= size)
|
||||
{
|
||||
void *res = VirtualAlloc(NULL, size2, MEM_COMMIT | MEM_LARGE_PAGES, PAGE_READWRITE);
|
||||
void *res = VirtualAlloc(NULL, size2, MEM_COMMIT | MY__MEM_LARGE_PAGES, PAGE_READWRITE);
|
||||
if (res)
|
||||
return res;
|
||||
}
|
||||
@@ -241,14 +247,14 @@ static void *SzAlloc(ISzAllocPtr p, size_t size) { UNUSED_VAR(p); return MyAlloc
|
||||
static void SzFree(ISzAllocPtr p, void *address) { UNUSED_VAR(p); MyFree(address); }
|
||||
const ISzAlloc g_Alloc = { SzAlloc, SzFree };
|
||||
|
||||
#ifdef _WIN32
|
||||
static void *SzMidAlloc(ISzAllocPtr p, size_t size) { UNUSED_VAR(p); return MidAlloc(size); }
|
||||
static void SzMidFree(ISzAllocPtr p, void *address) { UNUSED_VAR(p); MidFree(address); }
|
||||
const ISzAlloc g_MidAlloc = { SzMidAlloc, SzMidFree };
|
||||
|
||||
static void *SzBigAlloc(ISzAllocPtr p, size_t size) { UNUSED_VAR(p); return BigAlloc(size); }
|
||||
static void SzBigFree(ISzAllocPtr p, void *address) { UNUSED_VAR(p); BigFree(address); }
|
||||
const ISzAlloc g_MidAlloc = { SzMidAlloc, SzMidFree };
|
||||
const ISzAlloc g_BigAlloc = { SzBigAlloc, SzBigFree };
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
uintptr_t : <stdint.h> C99 (optional)
|
||||
@@ -280,13 +286,15 @@ const ISzAlloc g_BigAlloc = { SzBigAlloc, SzBigFree };
|
||||
*/
|
||||
#define MY_ALIGN_PTR_DOWN(p, align) ((void *)((((UIntPtr)(p)) & ~((UIntPtr)(align) - 1))))
|
||||
|
||||
#define MY_ALIGN_PTR_UP_PLUS(p, align) MY_ALIGN_PTR_DOWN(((char *)(p) + (align) + ADJUST_ALLOC_SIZE), align)
|
||||
|
||||
|
||||
#if (_POSIX_C_SOURCE >= 200112L) && !defined(_WIN32)
|
||||
#if !defined(_WIN32) && defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L)
|
||||
#define USE_posix_memalign
|
||||
#endif
|
||||
|
||||
#ifndef USE_posix_memalign
|
||||
#define MY_ALIGN_PTR_UP_PLUS(p, align) MY_ALIGN_PTR_DOWN(((char *)(p) + (align) + ADJUST_ALLOC_SIZE), align)
|
||||
#endif
|
||||
|
||||
/*
|
||||
This posix_memalign() is for test purposes only.
|
||||
We also need special Free() function instead of free(),
|
||||
+9
-2
@@ -1,5 +1,5 @@
|
||||
/* Alloc.h -- Memory allocation functions
|
||||
2018-02-19 : Igor Pavlov : Public domain */
|
||||
2021-07-13 : Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef __COMMON_ALLOC_H
|
||||
#define __COMMON_ALLOC_H
|
||||
@@ -13,7 +13,7 @@ void MyFree(void *address);
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
void SetLargePageSize();
|
||||
void SetLargePageSize(void);
|
||||
|
||||
void *MidAlloc(size_t size);
|
||||
void MidFree(void *address);
|
||||
@@ -30,8 +30,15 @@ void BigFree(void *address);
|
||||
#endif
|
||||
|
||||
extern const ISzAlloc g_Alloc;
|
||||
|
||||
#ifdef _WIN32
|
||||
extern const ISzAlloc g_BigAlloc;
|
||||
extern const ISzAlloc g_MidAlloc;
|
||||
#else
|
||||
#define g_BigAlloc g_AlignedAlloc
|
||||
#define g_MidAlloc g_AlignedAlloc
|
||||
#endif
|
||||
|
||||
extern const ISzAlloc g_AlignedAlloc;
|
||||
|
||||
|
||||
+5
-5
@@ -1,5 +1,5 @@
|
||||
/* Bcj2.c -- BCJ2 Decoder (Converter for x86 code)
|
||||
2018-04-28 : Igor Pavlov : Public domain */
|
||||
2021-02-09 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
@@ -123,7 +123,7 @@ SRes Bcj2Dec_Decode(CBcj2Dec *p)
|
||||
const Byte *src = p->bufs[BCJ2_STREAM_MAIN];
|
||||
const Byte *srcLim;
|
||||
Byte *dest;
|
||||
SizeT num = p->lims[BCJ2_STREAM_MAIN] - src;
|
||||
SizeT num = (SizeT)(p->lims[BCJ2_STREAM_MAIN] - src);
|
||||
|
||||
if (num == 0)
|
||||
{
|
||||
@@ -134,7 +134,7 @@ SRes Bcj2Dec_Decode(CBcj2Dec *p)
|
||||
dest = p->dest;
|
||||
if (num > (SizeT)(p->destLim - dest))
|
||||
{
|
||||
num = p->destLim - dest;
|
||||
num = (SizeT)(p->destLim - dest);
|
||||
if (num == 0)
|
||||
{
|
||||
p->state = BCJ2_DEC_STATE_ORIG;
|
||||
@@ -168,7 +168,7 @@ SRes Bcj2Dec_Decode(CBcj2Dec *p)
|
||||
break;
|
||||
}
|
||||
|
||||
num = src - p->bufs[BCJ2_STREAM_MAIN];
|
||||
num = (SizeT)(src - p->bufs[BCJ2_STREAM_MAIN]);
|
||||
|
||||
if (src == srcLim)
|
||||
{
|
||||
@@ -228,7 +228,7 @@ SRes Bcj2Dec_Decode(CBcj2Dec *p)
|
||||
p->ip += 4;
|
||||
val -= p->ip;
|
||||
dest = p->dest;
|
||||
rem = p->destLim - dest;
|
||||
rem = (SizeT)(p->destLim - dest);
|
||||
|
||||
if (rem < 4)
|
||||
{
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
/* Bcj2Enc.c -- BCJ2 Encoder (Converter for x86 code)
|
||||
2019-02-02 : Igor Pavlov : Public domain */
|
||||
2021-02-09 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
@@ -104,7 +104,7 @@ static void Bcj2Enc_Encode_2(CBcj2Enc *p)
|
||||
const Byte *src = p->src;
|
||||
const Byte *srcLim;
|
||||
Byte *dest;
|
||||
SizeT num = p->srcLim - src;
|
||||
SizeT num = (SizeT)(p->srcLim - src);
|
||||
|
||||
if (p->finishMode == BCJ2_ENC_FINISH_MODE_CONTINUE)
|
||||
{
|
||||
@@ -118,7 +118,7 @@ static void Bcj2Enc_Encode_2(CBcj2Enc *p)
|
||||
dest = p->bufs[BCJ2_STREAM_MAIN];
|
||||
if (num > (SizeT)(p->lims[BCJ2_STREAM_MAIN] - dest))
|
||||
{
|
||||
num = p->lims[BCJ2_STREAM_MAIN] - dest;
|
||||
num = (SizeT)(p->lims[BCJ2_STREAM_MAIN] - dest);
|
||||
if (num == 0)
|
||||
{
|
||||
p->state = BCJ2_STREAM_MAIN;
|
||||
@@ -152,7 +152,7 @@ static void Bcj2Enc_Encode_2(CBcj2Enc *p)
|
||||
break;
|
||||
}
|
||||
|
||||
num = src - p->src;
|
||||
num = (SizeT)(src - p->src);
|
||||
|
||||
if (src == srcLim)
|
||||
{
|
||||
+7
-7
@@ -1,5 +1,5 @@
|
||||
/* Bra.c -- Converters for RISC code
|
||||
2017-04-04 : Igor Pavlov : Public domain */
|
||||
2021-02-09 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
@@ -22,7 +22,7 @@ SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
|
||||
for (;;)
|
||||
{
|
||||
if (p >= lim)
|
||||
return p - data;
|
||||
return (SizeT)(p - data);
|
||||
p += 4;
|
||||
if (p[-1] == 0xEB)
|
||||
break;
|
||||
@@ -43,7 +43,7 @@ SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
|
||||
for (;;)
|
||||
{
|
||||
if (p >= lim)
|
||||
return p - data;
|
||||
return (SizeT)(p - data);
|
||||
p += 4;
|
||||
if (p[-1] == 0xEB)
|
||||
break;
|
||||
@@ -78,7 +78,7 @@ SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
|
||||
{
|
||||
UInt32 b3;
|
||||
if (p > lim)
|
||||
return p - data;
|
||||
return (SizeT)(p - data);
|
||||
b1 = p[1];
|
||||
b3 = p[3];
|
||||
p += 2;
|
||||
@@ -113,7 +113,7 @@ SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
|
||||
{
|
||||
UInt32 b3;
|
||||
if (p > lim)
|
||||
return p - data;
|
||||
return (SizeT)(p - data);
|
||||
b1 = p[1];
|
||||
b3 = p[3];
|
||||
p += 2;
|
||||
@@ -162,7 +162,7 @@ SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
|
||||
for (;;)
|
||||
{
|
||||
if (p >= lim)
|
||||
return p - data;
|
||||
return (SizeT)(p - data);
|
||||
p += 4;
|
||||
/* if ((v & 0xFC000003) == 0x48000001) */
|
||||
if ((p[-4] & 0xFC) == 0x48 && (p[-1] & 3) == 1)
|
||||
@@ -196,7 +196,7 @@ SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
|
||||
for (;;)
|
||||
{
|
||||
if (p >= lim)
|
||||
return p - data;
|
||||
return (SizeT)(p - data);
|
||||
/*
|
||||
v = GetBe32(p);
|
||||
p += 4;
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/* Bra86.c -- Converter for x86 code (BCJ)
|
||||
2017-04-03 : Igor Pavlov : Public domain */
|
||||
2021-02-09 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
@@ -25,7 +25,7 @@ SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding
|
||||
break;
|
||||
|
||||
{
|
||||
SizeT d = (SizeT)(p - data - pos);
|
||||
SizeT d = (SizeT)(p - data) - pos;
|
||||
pos = (SizeT)(p - data);
|
||||
if (p >= limit)
|
||||
{
|
||||
+11
-1
@@ -1,9 +1,13 @@
|
||||
/* Compiler.h
|
||||
2017-04-03 : Igor Pavlov : Public domain */
|
||||
2021-01-05 : Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef __7Z_COMPILER_H
|
||||
#define __7Z_COMPILER_H
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic ignored "-Wunused-private-field"
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#ifdef UNDER_CE
|
||||
@@ -25,6 +29,12 @@
|
||||
#pragma warning(disable : 4786) // identifier was truncated to '255' characters in the debug information
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
#pragma clang diagnostic ignored "-Wmicrosoft-exception-spec"
|
||||
// #pragma clang diagnostic ignored "-Wreserved-id-macro"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#define UNUSED_VAR(x) (void)x;
|
||||
Vendored
+478
@@ -0,0 +1,478 @@
|
||||
/* CpuArch.c -- CPU specific code
|
||||
2021-07-13 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
#include "CpuArch.h"
|
||||
|
||||
#ifdef MY_CPU_X86_OR_AMD64
|
||||
|
||||
#if (defined(_MSC_VER) && !defined(MY_CPU_AMD64)) || defined(__GNUC__)
|
||||
#define USE_ASM
|
||||
#endif
|
||||
|
||||
#if !defined(USE_ASM) && _MSC_VER >= 1500
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
|
||||
#if defined(USE_ASM) && !defined(MY_CPU_AMD64)
|
||||
static UInt32 CheckFlag(UInt32 flag)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
__asm pushfd;
|
||||
__asm pop EAX;
|
||||
__asm mov EDX, EAX;
|
||||
__asm xor EAX, flag;
|
||||
__asm push EAX;
|
||||
__asm popfd;
|
||||
__asm pushfd;
|
||||
__asm pop EAX;
|
||||
__asm xor EAX, EDX;
|
||||
__asm push EDX;
|
||||
__asm popfd;
|
||||
__asm and flag, EAX;
|
||||
#else
|
||||
__asm__ __volatile__ (
|
||||
"pushf\n\t"
|
||||
"pop %%EAX\n\t"
|
||||
"movl %%EAX,%%EDX\n\t"
|
||||
"xorl %0,%%EAX\n\t"
|
||||
"push %%EAX\n\t"
|
||||
"popf\n\t"
|
||||
"pushf\n\t"
|
||||
"pop %%EAX\n\t"
|
||||
"xorl %%EDX,%%EAX\n\t"
|
||||
"push %%EDX\n\t"
|
||||
"popf\n\t"
|
||||
"andl %%EAX, %0\n\t":
|
||||
"=c" (flag) : "c" (flag) :
|
||||
"%eax", "%edx");
|
||||
#endif
|
||||
return flag;
|
||||
}
|
||||
#define CHECK_CPUID_IS_SUPPORTED if (CheckFlag(1 << 18) == 0 || CheckFlag(1 << 21) == 0) return False;
|
||||
#else
|
||||
#define CHECK_CPUID_IS_SUPPORTED
|
||||
#endif
|
||||
|
||||
#ifndef USE_ASM
|
||||
#ifdef _MSC_VER
|
||||
#if _MSC_VER >= 1600
|
||||
#define MY__cpuidex __cpuidex
|
||||
#else
|
||||
|
||||
/*
|
||||
__cpuid (function == 4) requires subfunction number in ECX.
|
||||
MSDN: The __cpuid intrinsic clears the ECX register before calling the cpuid instruction.
|
||||
__cpuid() in new MSVC clears ECX.
|
||||
__cpuid() in old MSVC (14.00) doesn't clear ECX
|
||||
We still can use __cpuid for low (function) values that don't require ECX,
|
||||
but __cpuid() in old MSVC will be incorrect for some function values: (function == 4).
|
||||
So here we use the hack for old MSVC to send (subFunction) in ECX register to cpuid instruction,
|
||||
where ECX value is first parameter for FAST_CALL / NO_INLINE function,
|
||||
So the caller of MY__cpuidex_HACK() sets ECX as subFunction, and
|
||||
old MSVC for __cpuid() doesn't change ECX and cpuid instruction gets (subFunction) value.
|
||||
|
||||
DON'T remove MY_NO_INLINE and MY_FAST_CALL for MY__cpuidex_HACK() !!!
|
||||
*/
|
||||
|
||||
static
|
||||
MY_NO_INLINE
|
||||
void MY_FAST_CALL MY__cpuidex_HACK(UInt32 subFunction, int *CPUInfo, UInt32 function)
|
||||
{
|
||||
UNUSED_VAR(subFunction);
|
||||
__cpuid(CPUInfo, function);
|
||||
}
|
||||
|
||||
#define MY__cpuidex(info, func, func2) MY__cpuidex_HACK(func2, info, func)
|
||||
#pragma message("======== MY__cpuidex_HACK WAS USED ========")
|
||||
#endif
|
||||
#else
|
||||
#define MY__cpuidex(info, func, func2) __cpuid(info, func)
|
||||
#pragma message("======== (INCORRECT ?) cpuid WAS USED ========")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
void MyCPUID(UInt32 function, UInt32 *a, UInt32 *b, UInt32 *c, UInt32 *d)
|
||||
{
|
||||
#ifdef USE_ASM
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
UInt32 a2, b2, c2, d2;
|
||||
__asm xor EBX, EBX;
|
||||
__asm xor ECX, ECX;
|
||||
__asm xor EDX, EDX;
|
||||
__asm mov EAX, function;
|
||||
__asm cpuid;
|
||||
__asm mov a2, EAX;
|
||||
__asm mov b2, EBX;
|
||||
__asm mov c2, ECX;
|
||||
__asm mov d2, EDX;
|
||||
|
||||
*a = a2;
|
||||
*b = b2;
|
||||
*c = c2;
|
||||
*d = d2;
|
||||
|
||||
#else
|
||||
|
||||
__asm__ __volatile__ (
|
||||
#if defined(MY_CPU_AMD64) && defined(__PIC__)
|
||||
"mov %%rbx, %%rdi;"
|
||||
"cpuid;"
|
||||
"xchg %%rbx, %%rdi;"
|
||||
: "=a" (*a) ,
|
||||
"=D" (*b) ,
|
||||
#elif defined(MY_CPU_X86) && defined(__PIC__)
|
||||
"mov %%ebx, %%edi;"
|
||||
"cpuid;"
|
||||
"xchgl %%ebx, %%edi;"
|
||||
: "=a" (*a) ,
|
||||
"=D" (*b) ,
|
||||
#else
|
||||
"cpuid"
|
||||
: "=a" (*a) ,
|
||||
"=b" (*b) ,
|
||||
#endif
|
||||
"=c" (*c) ,
|
||||
"=d" (*d)
|
||||
: "0" (function), "c"(0) ) ;
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
int CPUInfo[4];
|
||||
|
||||
MY__cpuidex(CPUInfo, (int)function, 0);
|
||||
|
||||
*a = (UInt32)CPUInfo[0];
|
||||
*b = (UInt32)CPUInfo[1];
|
||||
*c = (UInt32)CPUInfo[2];
|
||||
*d = (UInt32)CPUInfo[3];
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
BoolInt x86cpuid_CheckAndRead(Cx86cpuid *p)
|
||||
{
|
||||
CHECK_CPUID_IS_SUPPORTED
|
||||
MyCPUID(0, &p->maxFunc, &p->vendor[0], &p->vendor[2], &p->vendor[1]);
|
||||
MyCPUID(1, &p->ver, &p->b, &p->c, &p->d);
|
||||
return True;
|
||||
}
|
||||
|
||||
static const UInt32 kVendors[][3] =
|
||||
{
|
||||
{ 0x756E6547, 0x49656E69, 0x6C65746E},
|
||||
{ 0x68747541, 0x69746E65, 0x444D4163},
|
||||
{ 0x746E6543, 0x48727561, 0x736C7561}
|
||||
};
|
||||
|
||||
int x86cpuid_GetFirm(const Cx86cpuid *p)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < sizeof(kVendors) / sizeof(kVendors[i]); i++)
|
||||
{
|
||||
const UInt32 *v = kVendors[i];
|
||||
if (v[0] == p->vendor[0] &&
|
||||
v[1] == p->vendor[1] &&
|
||||
v[2] == p->vendor[2])
|
||||
return (int)i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
BoolInt CPU_Is_InOrder()
|
||||
{
|
||||
Cx86cpuid p;
|
||||
int firm;
|
||||
UInt32 family, model;
|
||||
if (!x86cpuid_CheckAndRead(&p))
|
||||
return True;
|
||||
|
||||
family = x86cpuid_GetFamily(p.ver);
|
||||
model = x86cpuid_GetModel(p.ver);
|
||||
|
||||
firm = x86cpuid_GetFirm(&p);
|
||||
|
||||
switch (firm)
|
||||
{
|
||||
case CPU_FIRM_INTEL: return (family < 6 || (family == 6 && (
|
||||
/* In-Order Atom CPU */
|
||||
model == 0x1C /* 45 nm, N4xx, D4xx, N5xx, D5xx, 230, 330 */
|
||||
|| model == 0x26 /* 45 nm, Z6xx */
|
||||
|| model == 0x27 /* 32 nm, Z2460 */
|
||||
|| model == 0x35 /* 32 nm, Z2760 */
|
||||
|| model == 0x36 /* 32 nm, N2xxx, D2xxx */
|
||||
)));
|
||||
case CPU_FIRM_AMD: return (family < 5 || (family == 5 && (model < 6 || model == 0xA)));
|
||||
case CPU_FIRM_VIA: return (family < 6 || (family == 6 && model < 0xF));
|
||||
}
|
||||
return True;
|
||||
}
|
||||
|
||||
#if !defined(MY_CPU_AMD64) && defined(_WIN32)
|
||||
#include <Windows.h>
|
||||
static BoolInt CPU_Sys_Is_SSE_Supported()
|
||||
{
|
||||
OSVERSIONINFO vi;
|
||||
vi.dwOSVersionInfoSize = sizeof(vi);
|
||||
if (!GetVersionEx(&vi))
|
||||
return False;
|
||||
return (vi.dwMajorVersion >= 5);
|
||||
}
|
||||
#define CHECK_SYS_SSE_SUPPORT if (!CPU_Sys_Is_SSE_Supported()) return False;
|
||||
#else
|
||||
#define CHECK_SYS_SSE_SUPPORT
|
||||
#endif
|
||||
|
||||
|
||||
static UInt32 X86_CPUID_ECX_Get_Flags()
|
||||
{
|
||||
Cx86cpuid p;
|
||||
CHECK_SYS_SSE_SUPPORT
|
||||
if (!x86cpuid_CheckAndRead(&p))
|
||||
return 0;
|
||||
return p.c;
|
||||
}
|
||||
|
||||
BoolInt CPU_IsSupported_AES()
|
||||
{
|
||||
return (X86_CPUID_ECX_Get_Flags() >> 25) & 1;
|
||||
}
|
||||
|
||||
BoolInt CPU_IsSupported_SSSE3()
|
||||
{
|
||||
return (X86_CPUID_ECX_Get_Flags() >> 9) & 1;
|
||||
}
|
||||
|
||||
BoolInt CPU_IsSupported_SSE41()
|
||||
{
|
||||
return (X86_CPUID_ECX_Get_Flags() >> 19) & 1;
|
||||
}
|
||||
|
||||
BoolInt CPU_IsSupported_SHA()
|
||||
{
|
||||
Cx86cpuid p;
|
||||
CHECK_SYS_SSE_SUPPORT
|
||||
if (!x86cpuid_CheckAndRead(&p))
|
||||
return False;
|
||||
|
||||
if (p.maxFunc < 7)
|
||||
return False;
|
||||
{
|
||||
UInt32 d[4] = { 0 };
|
||||
MyCPUID(7, &d[0], &d[1], &d[2], &d[3]);
|
||||
return (d[1] >> 29) & 1;
|
||||
}
|
||||
}
|
||||
|
||||
// #include <stdio.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
BoolInt CPU_IsSupported_AVX2()
|
||||
{
|
||||
Cx86cpuid p;
|
||||
CHECK_SYS_SSE_SUPPORT
|
||||
|
||||
#ifdef _WIN32
|
||||
#define MY__PF_XSAVE_ENABLED 17
|
||||
if (!IsProcessorFeaturePresent(MY__PF_XSAVE_ENABLED))
|
||||
return False;
|
||||
#endif
|
||||
|
||||
if (!x86cpuid_CheckAndRead(&p))
|
||||
return False;
|
||||
if (p.maxFunc < 7)
|
||||
return False;
|
||||
{
|
||||
UInt32 d[4] = { 0 };
|
||||
MyCPUID(7, &d[0], &d[1], &d[2], &d[3]);
|
||||
// printf("\ncpuid(7): ebx=%8x ecx=%8x\n", d[1], d[2]);
|
||||
return 1
|
||||
& (d[1] >> 5); // avx2
|
||||
}
|
||||
}
|
||||
|
||||
BoolInt CPU_IsSupported_VAES_AVX2()
|
||||
{
|
||||
Cx86cpuid p;
|
||||
CHECK_SYS_SSE_SUPPORT
|
||||
|
||||
#ifdef _WIN32
|
||||
#define MY__PF_XSAVE_ENABLED 17
|
||||
if (!IsProcessorFeaturePresent(MY__PF_XSAVE_ENABLED))
|
||||
return False;
|
||||
#endif
|
||||
|
||||
if (!x86cpuid_CheckAndRead(&p))
|
||||
return False;
|
||||
if (p.maxFunc < 7)
|
||||
return False;
|
||||
{
|
||||
UInt32 d[4] = { 0 };
|
||||
MyCPUID(7, &d[0], &d[1], &d[2], &d[3]);
|
||||
// printf("\ncpuid(7): ebx=%8x ecx=%8x\n", d[1], d[2]);
|
||||
return 1
|
||||
& (d[1] >> 5) // avx2
|
||||
// & (d[1] >> 31) // avx512vl
|
||||
& (d[2] >> 9); // vaes // VEX-256/EVEX
|
||||
}
|
||||
}
|
||||
|
||||
BoolInt CPU_IsSupported_PageGB()
|
||||
{
|
||||
Cx86cpuid cpuid;
|
||||
if (!x86cpuid_CheckAndRead(&cpuid))
|
||||
return False;
|
||||
{
|
||||
UInt32 d[4] = { 0 };
|
||||
MyCPUID(0x80000000, &d[0], &d[1], &d[2], &d[3]);
|
||||
if (d[0] < 0x80000001)
|
||||
return False;
|
||||
}
|
||||
{
|
||||
UInt32 d[4] = { 0 };
|
||||
MyCPUID(0x80000001, &d[0], &d[1], &d[2], &d[3]);
|
||||
return (d[3] >> 26) & 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#elif defined(MY_CPU_ARM_OR_ARM64)
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
BoolInt CPU_IsSupported_CRC32() { return IsProcessorFeaturePresent(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE) ? 1 : 0; }
|
||||
BoolInt CPU_IsSupported_CRYPTO() { return IsProcessorFeaturePresent(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE) ? 1 : 0; }
|
||||
BoolInt CPU_IsSupported_NEON() { return IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) ? 1 : 0; }
|
||||
|
||||
#else
|
||||
|
||||
#if defined(__APPLE__)
|
||||
|
||||
/*
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
static void Print_sysctlbyname(const char *name)
|
||||
{
|
||||
size_t bufSize = 256;
|
||||
char buf[256];
|
||||
int res = sysctlbyname(name, &buf, &bufSize, NULL, 0);
|
||||
{
|
||||
int i;
|
||||
printf("\nres = %d : %s : '%s' : bufSize = %d, numeric", res, name, buf, (unsigned)bufSize);
|
||||
for (i = 0; i < 20; i++)
|
||||
printf(" %2x", (unsigned)(Byte)buf[i]);
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
static BoolInt My_sysctlbyname_Get_BoolInt(const char *name)
|
||||
{
|
||||
UInt32 val = 0;
|
||||
if (My_sysctlbyname_Get_UInt32(name, &val) == 0 && val == 1)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Print_sysctlbyname("hw.pagesize");
|
||||
Print_sysctlbyname("machdep.cpu.brand_string");
|
||||
*/
|
||||
|
||||
BoolInt CPU_IsSupported_CRC32(void)
|
||||
{
|
||||
return My_sysctlbyname_Get_BoolInt("hw.optional.armv8_crc32");
|
||||
}
|
||||
|
||||
BoolInt CPU_IsSupported_NEON(void)
|
||||
{
|
||||
return My_sysctlbyname_Get_BoolInt("hw.optional.neon");
|
||||
}
|
||||
|
||||
#ifdef MY_CPU_ARM64
|
||||
#define APPLE_CRYPTO_SUPPORT_VAL 1
|
||||
#else
|
||||
#define APPLE_CRYPTO_SUPPORT_VAL 0
|
||||
#endif
|
||||
|
||||
BoolInt CPU_IsSupported_SHA1(void) { return APPLE_CRYPTO_SUPPORT_VAL; }
|
||||
BoolInt CPU_IsSupported_SHA2(void) { return APPLE_CRYPTO_SUPPORT_VAL; }
|
||||
BoolInt CPU_IsSupported_AES (void) { return APPLE_CRYPTO_SUPPORT_VAL; }
|
||||
|
||||
|
||||
#else // __APPLE__
|
||||
|
||||
#include <sys/auxv.h>
|
||||
|
||||
#define USE_HWCAP
|
||||
|
||||
#ifdef USE_HWCAP
|
||||
|
||||
#include <asm/hwcap.h>
|
||||
|
||||
#define MY_HWCAP_CHECK_FUNC_2(name1, name2) \
|
||||
BoolInt CPU_IsSupported_ ## name1() { return (getauxval(AT_HWCAP) & (HWCAP_ ## name2)) ? 1 : 0; }
|
||||
|
||||
#ifdef MY_CPU_ARM64
|
||||
#define MY_HWCAP_CHECK_FUNC(name) \
|
||||
MY_HWCAP_CHECK_FUNC_2(name, name)
|
||||
MY_HWCAP_CHECK_FUNC_2(NEON, ASIMD)
|
||||
// MY_HWCAP_CHECK_FUNC (ASIMD)
|
||||
#elif defined(MY_CPU_ARM)
|
||||
#define MY_HWCAP_CHECK_FUNC(name) \
|
||||
BoolInt CPU_IsSupported_ ## name() { return (getauxval(AT_HWCAP2) & (HWCAP2_ ## name)) ? 1 : 0; }
|
||||
MY_HWCAP_CHECK_FUNC_2(NEON, NEON)
|
||||
#endif
|
||||
|
||||
#else // USE_HWCAP
|
||||
|
||||
#define MY_HWCAP_CHECK_FUNC(name) \
|
||||
BoolInt CPU_IsSupported_ ## name() { return 0; }
|
||||
MY_HWCAP_CHECK_FUNC(NEON)
|
||||
|
||||
#endif // USE_HWCAP
|
||||
|
||||
MY_HWCAP_CHECK_FUNC (CRC32)
|
||||
MY_HWCAP_CHECK_FUNC (SHA1)
|
||||
MY_HWCAP_CHECK_FUNC (SHA2)
|
||||
MY_HWCAP_CHECK_FUNC (AES)
|
||||
|
||||
#endif // __APPLE__
|
||||
#endif // _WIN32
|
||||
|
||||
#endif // MY_CPU_ARM_OR_ARM64
|
||||
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
int My_sysctlbyname_Get(const char *name, void *buf, size_t *bufSize)
|
||||
{
|
||||
return sysctlbyname(name, buf, bufSize, NULL, 0);
|
||||
}
|
||||
|
||||
int My_sysctlbyname_Get_UInt32(const char *name, UInt32 *val)
|
||||
{
|
||||
size_t bufSize = sizeof(*val);
|
||||
int res = My_sysctlbyname_Get(name, val, &bufSize);
|
||||
if (res == 0 && bufSize != sizeof(*val))
|
||||
return EFAULT;
|
||||
return res;
|
||||
}
|
||||
|
||||
#endif
|
||||
+139
-30
@@ -1,5 +1,5 @@
|
||||
/* CpuArch.h -- CPU specific code
|
||||
2018-02-18 : Igor Pavlov : Public domain */
|
||||
2022-07-15 : Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef __CPU_ARCH_H
|
||||
#define __CPU_ARCH_H
|
||||
@@ -14,6 +14,10 @@ MY_CPU_BE means that CPU is BIG ENDIAN.
|
||||
If MY_CPU_LE and MY_CPU_BE are not defined, we don't know about ENDIANNESS of platform.
|
||||
|
||||
MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned memory accesses.
|
||||
|
||||
MY_CPU_64BIT means that processor can work with 64-bit registers.
|
||||
MY_CPU_64BIT can be used to select fast code branch
|
||||
MY_CPU_64BIT doesn't mean that (sizeof(void *) == 8)
|
||||
*/
|
||||
|
||||
#if defined(_M_X64) \
|
||||
@@ -24,8 +28,10 @@ MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned mem
|
||||
#define MY_CPU_AMD64
|
||||
#ifdef __ILP32__
|
||||
#define MY_CPU_NAME "x32"
|
||||
#define MY_CPU_SIZEOF_POINTER 4
|
||||
#else
|
||||
#define MY_CPU_NAME "x64"
|
||||
#define MY_CPU_SIZEOF_POINTER 8
|
||||
#endif
|
||||
#define MY_CPU_64BIT
|
||||
#endif
|
||||
@@ -35,7 +41,8 @@ MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned mem
|
||||
|| defined(__i386__)
|
||||
#define MY_CPU_X86
|
||||
#define MY_CPU_NAME "x86"
|
||||
#define MY_CPU_32BIT
|
||||
/* #define MY_CPU_32BIT */
|
||||
#define MY_CPU_SIZEOF_POINTER 4
|
||||
#endif
|
||||
|
||||
|
||||
@@ -59,8 +66,14 @@ MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned mem
|
||||
|| defined(__THUMBEL__) \
|
||||
|| defined(__THUMBEB__)
|
||||
#define MY_CPU_ARM
|
||||
#define MY_CPU_NAME "arm"
|
||||
#define MY_CPU_32BIT
|
||||
|
||||
#if defined(__thumb__) || defined(__THUMBEL__) || defined(_M_ARMT)
|
||||
#define MY_CPU_NAME "armt"
|
||||
#else
|
||||
#define MY_CPU_NAME "arm"
|
||||
#endif
|
||||
/* #define MY_CPU_32BIT */
|
||||
#define MY_CPU_SIZEOF_POINTER 4
|
||||
#endif
|
||||
|
||||
|
||||
@@ -84,26 +97,41 @@ MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned mem
|
||||
|
||||
|
||||
#if defined(__ppc64__) \
|
||||
|| defined(__powerpc64__)
|
||||
|| defined(__powerpc64__) \
|
||||
|| defined(__ppc__) \
|
||||
|| defined(__powerpc__) \
|
||||
|| defined(__PPC__) \
|
||||
|| defined(_POWER)
|
||||
|
||||
#if defined(__ppc64__) \
|
||||
|| defined(__powerpc64__) \
|
||||
|| defined(_LP64) \
|
||||
|| defined(__64BIT__)
|
||||
#ifdef __ILP32__
|
||||
#define MY_CPU_NAME "ppc64-32"
|
||||
#define MY_CPU_SIZEOF_POINTER 4
|
||||
#else
|
||||
#define MY_CPU_NAME "ppc64"
|
||||
#define MY_CPU_SIZEOF_POINTER 8
|
||||
#endif
|
||||
#define MY_CPU_64BIT
|
||||
#elif defined(__ppc__) \
|
||||
|| defined(__powerpc__)
|
||||
#else
|
||||
#define MY_CPU_NAME "ppc"
|
||||
#define MY_CPU_32BIT
|
||||
#define MY_CPU_SIZEOF_POINTER 4
|
||||
/* #define MY_CPU_32BIT */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__sparc64__)
|
||||
#define MY_CPU_NAME "sparc64"
|
||||
#define MY_CPU_64BIT
|
||||
#elif defined(__sparc__)
|
||||
#define MY_CPU_NAME "sparc"
|
||||
/* #define MY_CPU_32BIT */
|
||||
#if defined(__riscv) \
|
||||
|| defined(__riscv__)
|
||||
#if __riscv_xlen == 32
|
||||
#define MY_CPU_NAME "riscv32"
|
||||
#elif __riscv_xlen == 64
|
||||
#define MY_CPU_NAME "riscv64"
|
||||
#else
|
||||
#define MY_CPU_NAME "riscv"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -111,6 +139,10 @@ MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned mem
|
||||
#define MY_CPU_X86_OR_AMD64
|
||||
#endif
|
||||
|
||||
#if defined(MY_CPU_ARM) || defined(MY_CPU_ARM64)
|
||||
#define MY_CPU_ARM_OR_ARM64
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -170,6 +202,40 @@ MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned mem
|
||||
#error Stop_Compiling_Bad_32_64_BIT
|
||||
#endif
|
||||
|
||||
#ifdef __SIZEOF_POINTER__
|
||||
#ifdef MY_CPU_SIZEOF_POINTER
|
||||
#if MY_CPU_SIZEOF_POINTER != __SIZEOF_POINTER__
|
||||
#error Stop_Compiling_Bad_MY_CPU_PTR_SIZE
|
||||
#endif
|
||||
#else
|
||||
#define MY_CPU_SIZEOF_POINTER __SIZEOF_POINTER__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MY_CPU_SIZEOF_POINTER) && (MY_CPU_SIZEOF_POINTER == 4)
|
||||
#if defined (_LP64)
|
||||
#error Stop_Compiling_Bad_MY_CPU_PTR_SIZE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if _MSC_VER >= 1300
|
||||
#define MY_CPU_pragma_pack_push_1 __pragma(pack(push, 1))
|
||||
#define MY_CPU_pragma_pop __pragma(pack(pop))
|
||||
#else
|
||||
#define MY_CPU_pragma_pack_push_1
|
||||
#define MY_CPU_pragma_pop
|
||||
#endif
|
||||
#else
|
||||
#ifdef __xlC__
|
||||
#define MY_CPU_pragma_pack_push_1 _Pragma("pack(1)")
|
||||
#define MY_CPU_pragma_pop _Pragma("pack()")
|
||||
#else
|
||||
#define MY_CPU_pragma_pack_push_1 _Pragma("pack(push, 1)")
|
||||
#define MY_CPU_pragma_pop _Pragma("pack(pop)")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef MY_CPU_NAME
|
||||
#ifdef MY_CPU_LE
|
||||
@@ -189,8 +255,12 @@ MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned mem
|
||||
|
||||
#ifdef MY_CPU_LE
|
||||
#if defined(MY_CPU_X86_OR_AMD64) \
|
||||
|| defined(MY_CPU_ARM64) \
|
||||
|| defined(__ARM_FEATURE_UNALIGNED)
|
||||
|| defined(MY_CPU_ARM64)
|
||||
#define MY_CPU_LE_UNALIGN
|
||||
#define MY_CPU_LE_UNALIGN_64
|
||||
#elif defined(__ARM_FEATURE_UNALIGNED)
|
||||
/* gcc9 for 32-bit arm can use LDRD instruction that requires 32-bit alignment.
|
||||
So we can't use unaligned 64-bit operations. */
|
||||
#define MY_CPU_LE_UNALIGN
|
||||
#endif
|
||||
#endif
|
||||
@@ -200,11 +270,15 @@ MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned mem
|
||||
|
||||
#define GetUi16(p) (*(const UInt16 *)(const void *)(p))
|
||||
#define GetUi32(p) (*(const UInt32 *)(const void *)(p))
|
||||
#ifdef MY_CPU_LE_UNALIGN_64
|
||||
#define GetUi64(p) (*(const UInt64 *)(const void *)(p))
|
||||
#endif
|
||||
|
||||
#define SetUi16(p, v) { *(UInt16 *)(p) = (v); }
|
||||
#define SetUi32(p, v) { *(UInt32 *)(p) = (v); }
|
||||
#define SetUi64(p, v) { *(UInt64 *)(p) = (v); }
|
||||
#define SetUi16(p, v) { *(UInt16 *)(void *)(p) = (v); }
|
||||
#define SetUi32(p, v) { *(UInt32 *)(void *)(p) = (v); }
|
||||
#ifdef MY_CPU_LE_UNALIGN_64
|
||||
#define SetUi64(p, v) { *(UInt64 *)(void *)(p) = (v); }
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
@@ -218,8 +292,6 @@ MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned mem
|
||||
((UInt32)((const Byte *)(p))[2] << 16) | \
|
||||
((UInt32)((const Byte *)(p))[3] << 24))
|
||||
|
||||
#define GetUi64(p) (GetUi32(p) | ((UInt64)GetUi32(((const Byte *)(p)) + 4) << 32))
|
||||
|
||||
#define SetUi16(p, v) { Byte *_ppp_ = (Byte *)(p); UInt32 _vvv_ = (v); \
|
||||
_ppp_[0] = (Byte)_vvv_; \
|
||||
_ppp_[1] = (Byte)(_vvv_ >> 8); }
|
||||
@@ -230,19 +302,29 @@ MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned mem
|
||||
_ppp_[2] = (Byte)(_vvv_ >> 16); \
|
||||
_ppp_[3] = (Byte)(_vvv_ >> 24); }
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef MY_CPU_LE_UNALIGN_64
|
||||
|
||||
#define GetUi64(p) (GetUi32(p) | ((UInt64)GetUi32(((const Byte *)(p)) + 4) << 32))
|
||||
|
||||
#define SetUi64(p, v) { Byte *_ppp2_ = (Byte *)(p); UInt64 _vvv2_ = (v); \
|
||||
SetUi32(_ppp2_ , (UInt32)_vvv2_); \
|
||||
SetUi32(_ppp2_ + 4, (UInt32)(_vvv2_ >> 32)); }
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __has_builtin
|
||||
#define MY__has_builtin(x) __has_builtin(x)
|
||||
#else
|
||||
#define MY__has_builtin(x) 0
|
||||
#endif
|
||||
|
||||
#if defined(MY_CPU_LE_UNALIGN) && /* defined(_WIN64) && */ (_MSC_VER >= 1300)
|
||||
#if defined(MY_CPU_LE_UNALIGN) && /* defined(_WIN64) && */ defined(_MSC_VER) && (_MSC_VER >= 1300)
|
||||
|
||||
/* Note: we use bswap instruction, that is unsupported in 386 cpu */
|
||||
|
||||
@@ -253,8 +335,8 @@ MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned mem
|
||||
#pragma intrinsic(_byteswap_uint64)
|
||||
|
||||
/* #define GetBe16(p) _byteswap_ushort(*(const UInt16 *)(const Byte *)(p)) */
|
||||
#define GetBe32(p) _byteswap_ulong(*(const UInt32 *)(const Byte *)(p))
|
||||
#define GetBe64(p) _byteswap_uint64(*(const UInt64 *)(const Byte *)(p))
|
||||
#define GetBe32(p) _byteswap_ulong (*(const UInt32 *)(const void *)(p))
|
||||
#define GetBe64(p) _byteswap_uint64(*(const UInt64 *)(const void *)(p))
|
||||
|
||||
#define SetBe32(p, v) (*(UInt32 *)(void *)(p)) = _byteswap_ulong(v)
|
||||
|
||||
@@ -262,9 +344,9 @@ MY_CPU_LE_UNALIGN means that CPU is LITTLE ENDIAN and CPU supports unaligned mem
|
||||
(defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) \
|
||||
|| (defined(__clang__) && MY__has_builtin(__builtin_bswap16)) )
|
||||
|
||||
/* #define GetBe16(p) __builtin_bswap16(*(const UInt16 *)(const Byte *)(p)) */
|
||||
#define GetBe32(p) __builtin_bswap32(*(const UInt32 *)(const Byte *)(p))
|
||||
#define GetBe64(p) __builtin_bswap64(*(const UInt64 *)(const Byte *)(p))
|
||||
/* #define GetBe16(p) __builtin_bswap16(*(const UInt16 *)(const void *)(p)) */
|
||||
#define GetBe32(p) __builtin_bswap32(*(const UInt32 *)(const void *)(p))
|
||||
#define GetBe64(p) __builtin_bswap64(*(const UInt64 *)(const void *)(p))
|
||||
|
||||
#define SetBe32(p, v) (*(UInt32 *)(void *)(p)) = __builtin_bswap32(v)
|
||||
|
||||
@@ -325,10 +407,37 @@ int x86cpuid_GetFirm(const Cx86cpuid *p);
|
||||
#define x86cpuid_GetModel(ver) (((ver >> 12) & 0xF0) | ((ver >> 4) & 0xF))
|
||||
#define x86cpuid_GetStepping(ver) (ver & 0xF)
|
||||
|
||||
BoolInt CPU_Is_InOrder();
|
||||
BoolInt CPU_Is_Aes_Supported();
|
||||
BoolInt CPU_IsSupported_PageGB();
|
||||
BoolInt CPU_Is_InOrder(void);
|
||||
|
||||
BoolInt CPU_IsSupported_AES(void);
|
||||
BoolInt CPU_IsSupported_AVX2(void);
|
||||
BoolInt CPU_IsSupported_VAES_AVX2(void);
|
||||
BoolInt CPU_IsSupported_SSSE3(void);
|
||||
BoolInt CPU_IsSupported_SSE41(void);
|
||||
BoolInt CPU_IsSupported_SHA(void);
|
||||
BoolInt CPU_IsSupported_PageGB(void);
|
||||
|
||||
#elif defined(MY_CPU_ARM_OR_ARM64)
|
||||
|
||||
BoolInt CPU_IsSupported_CRC32(void);
|
||||
BoolInt CPU_IsSupported_NEON(void);
|
||||
|
||||
#if defined(_WIN32)
|
||||
BoolInt CPU_IsSupported_CRYPTO(void);
|
||||
#define CPU_IsSupported_SHA1 CPU_IsSupported_CRYPTO
|
||||
#define CPU_IsSupported_SHA2 CPU_IsSupported_CRYPTO
|
||||
#define CPU_IsSupported_AES CPU_IsSupported_CRYPTO
|
||||
#else
|
||||
BoolInt CPU_IsSupported_SHA1(void);
|
||||
BoolInt CPU_IsSupported_SHA2(void);
|
||||
BoolInt CPU_IsSupported_AES(void);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
int My_sysctlbyname_Get(const char *name, void *buf, size_t *bufSize);
|
||||
int My_sysctlbyname_Get_UInt32(const char *name, UInt32 *val);
|
||||
#endif
|
||||
|
||||
EXTERN_C_END
|
||||
Vendored
+169
@@ -0,0 +1,169 @@
|
||||
/* Delta.c -- Delta converter
|
||||
2021-02-09 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
#include "Delta.h"
|
||||
|
||||
void Delta_Init(Byte *state)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < DELTA_STATE_SIZE; i++)
|
||||
state[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
void Delta_Encode(Byte *state, unsigned delta, Byte *data, SizeT size)
|
||||
{
|
||||
Byte temp[DELTA_STATE_SIZE];
|
||||
|
||||
if (size == 0)
|
||||
return;
|
||||
|
||||
{
|
||||
unsigned i = 0;
|
||||
do
|
||||
temp[i] = state[i];
|
||||
while (++i != delta);
|
||||
}
|
||||
|
||||
if (size <= delta)
|
||||
{
|
||||
unsigned i = 0, k;
|
||||
do
|
||||
{
|
||||
Byte b = *data;
|
||||
*data++ = (Byte)(b - temp[i]);
|
||||
temp[i] = b;
|
||||
}
|
||||
while (++i != size);
|
||||
|
||||
k = 0;
|
||||
|
||||
do
|
||||
{
|
||||
if (i == delta)
|
||||
i = 0;
|
||||
state[k] = temp[i++];
|
||||
}
|
||||
while (++k != delta);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
Byte *p = data + size - delta;
|
||||
{
|
||||
unsigned i = 0;
|
||||
do
|
||||
state[i] = *p++;
|
||||
while (++i != delta);
|
||||
}
|
||||
{
|
||||
const Byte *lim = data + delta;
|
||||
ptrdiff_t dif = -(ptrdiff_t)delta;
|
||||
|
||||
if (((ptrdiff_t)size + dif) & 1)
|
||||
{
|
||||
--p; *p = (Byte)(*p - p[dif]);
|
||||
}
|
||||
|
||||
while (p != lim)
|
||||
{
|
||||
--p; *p = (Byte)(*p - p[dif]);
|
||||
--p; *p = (Byte)(*p - p[dif]);
|
||||
}
|
||||
|
||||
dif = -dif;
|
||||
|
||||
do
|
||||
{
|
||||
--p; *p = (Byte)(*p - temp[--dif]);
|
||||
}
|
||||
while (dif != 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Delta_Decode(Byte *state, unsigned delta, Byte *data, SizeT size)
|
||||
{
|
||||
unsigned i;
|
||||
const Byte *lim;
|
||||
|
||||
if (size == 0)
|
||||
return;
|
||||
|
||||
i = 0;
|
||||
lim = data + size;
|
||||
|
||||
if (size <= delta)
|
||||
{
|
||||
do
|
||||
*data = (Byte)(*data + state[i++]);
|
||||
while (++data != lim);
|
||||
|
||||
for (; delta != i; state++, delta--)
|
||||
*state = state[i];
|
||||
data -= i;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
#define B(n) b ## n
|
||||
#define I(n) Byte B(n) = state[n];
|
||||
#define U(n) { B(n) = (Byte)((B(n)) + *data++); data[-1] = (B(n)); }
|
||||
#define F(n) if (data != lim) { U(n) }
|
||||
|
||||
if (delta == 1)
|
||||
{
|
||||
I(0)
|
||||
if ((lim - data) & 1) { U(0) }
|
||||
while (data != lim) { U(0) U(0) }
|
||||
data -= 1;
|
||||
}
|
||||
else if (delta == 2)
|
||||
{
|
||||
I(0) I(1)
|
||||
lim -= 1; while (data < lim) { U(0) U(1) }
|
||||
lim += 1; F(0)
|
||||
data -= 2;
|
||||
}
|
||||
else if (delta == 3)
|
||||
{
|
||||
I(0) I(1) I(2)
|
||||
lim -= 2; while (data < lim) { U(0) U(1) U(2) }
|
||||
lim += 2; F(0) F(1)
|
||||
data -= 3;
|
||||
}
|
||||
else if (delta == 4)
|
||||
{
|
||||
I(0) I(1) I(2) I(3)
|
||||
lim -= 3; while (data < lim) { U(0) U(1) U(2) U(3) }
|
||||
lim += 3; F(0) F(1) F(2)
|
||||
data -= 4;
|
||||
}
|
||||
else
|
||||
*/
|
||||
{
|
||||
do
|
||||
{
|
||||
*data = (Byte)(*data + state[i++]);
|
||||
data++;
|
||||
}
|
||||
while (i != delta);
|
||||
|
||||
{
|
||||
ptrdiff_t dif = -(ptrdiff_t)delta;
|
||||
do
|
||||
*data = (Byte)(*data + data[dif]);
|
||||
while (++data != lim);
|
||||
data += dif;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
do
|
||||
*state++ = *data;
|
||||
while (++data != lim);
|
||||
}
|
||||
+11
-5
@@ -1,16 +1,20 @@
|
||||
/* DllSecur.c -- DLL loading security
|
||||
2018-02-21 : Igor Pavlov : Public domain */
|
||||
2022-07-15 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <windows.h>
|
||||
#include <Windows.h>
|
||||
|
||||
#include "DllSecur.h"
|
||||
|
||||
#ifndef UNDER_CE
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 8)
|
||||
#pragma GCC diagnostic ignored "-Wcast-function-type"
|
||||
#endif
|
||||
|
||||
typedef BOOL (WINAPI *Func_SetDefaultDllDirectories)(DWORD DirectoryFlags);
|
||||
|
||||
#define MY_LOAD_LIBRARY_SEARCH_USER_DIRS 0x400
|
||||
@@ -33,17 +37,19 @@ static const char * const g_Dlls =
|
||||
|
||||
#endif
|
||||
|
||||
// #define MY_CAST_FUNC (void(*)())
|
||||
#define MY_CAST_FUNC
|
||||
|
||||
void My_SetDefaultDllDirectories()
|
||||
{
|
||||
#ifndef UNDER_CE
|
||||
|
||||
OSVERSIONINFO vi;
|
||||
vi.dwOSVersionInfoSize = sizeof(vi);
|
||||
GetVersionEx(&vi);
|
||||
if (!GetVersionEx(&vi) || vi.dwMajorVersion != 6 || vi.dwMinorVersion != 0)
|
||||
{
|
||||
Func_SetDefaultDllDirectories setDllDirs = (Func_SetDefaultDllDirectories)
|
||||
GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "SetDefaultDllDirectories");
|
||||
MY_CAST_FUNC GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "SetDefaultDllDirectories");
|
||||
if (setDllDirs)
|
||||
if (setDllDirs(MY_LOAD_LIBRARY_SEARCH_SYSTEM32 | MY_LOAD_LIBRARY_SEARCH_USER_DIRS))
|
||||
return;
|
||||
@@ -66,7 +72,7 @@ void LoadSecurityDlls()
|
||||
if (!GetVersionEx(&vi) || vi.dwMajorVersion != 6 || vi.dwMinorVersion != 0)
|
||||
{
|
||||
Func_SetDefaultDllDirectories setDllDirs = (Func_SetDefaultDllDirectories)
|
||||
GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "SetDefaultDllDirectories");
|
||||
MY_CAST_FUNC GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "SetDefaultDllDirectories");
|
||||
if (setDllDirs)
|
||||
if (setDllDirs(MY_LOAD_LIBRARY_SEARCH_SYSTEM32 | MY_LOAD_LIBRARY_SEARCH_USER_DIRS))
|
||||
return;
|
||||
+2
-2
@@ -10,8 +10,8 @@ EXTERN_C_BEGIN
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
void My_SetDefaultDllDirectories();
|
||||
void LoadSecurityDlls();
|
||||
void My_SetDefaultDllDirectories(void);
|
||||
void LoadSecurityDlls(void);
|
||||
|
||||
#endif
|
||||
|
||||
Vendored
+1628
File diff suppressed because it is too large
Load Diff
+28
-13
@@ -1,5 +1,5 @@
|
||||
/* LzFind.h -- Match finder for LZ algorithms
|
||||
2017-06-10 : Igor Pavlov : Public domain */
|
||||
2021-07-13 : Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef __LZ_FIND_H
|
||||
#define __LZ_FIND_H
|
||||
@@ -15,7 +15,7 @@ typedef struct _CMatchFinder
|
||||
Byte *buffer;
|
||||
UInt32 pos;
|
||||
UInt32 posLimit;
|
||||
UInt32 streamPos;
|
||||
UInt32 streamPos; /* wrap over Zero is allowed (streamPos < pos). Use (UInt32)(streamPos - pos) */
|
||||
UInt32 lenLimit;
|
||||
|
||||
UInt32 cyclicBufferPos;
|
||||
@@ -51,17 +51,19 @@ typedef struct _CMatchFinder
|
||||
UInt64 expectedDataSize;
|
||||
} CMatchFinder;
|
||||
|
||||
#define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer)
|
||||
#define Inline_MatchFinder_GetPointerToCurrentPos(p) ((const Byte *)(p)->buffer)
|
||||
|
||||
#define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos)
|
||||
#define Inline_MatchFinder_GetNumAvailableBytes(p) ((UInt32)((p)->streamPos - (p)->pos))
|
||||
|
||||
/*
|
||||
#define Inline_MatchFinder_IsFinishedOK(p) \
|
||||
((p)->streamEndWasReached \
|
||||
&& (p)->streamPos == (p)->pos \
|
||||
&& (!(p)->directInput || (p)->directInputRem == 0))
|
||||
*/
|
||||
|
||||
int MatchFinder_NeedMove(CMatchFinder *p);
|
||||
Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p);
|
||||
/* Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p); */
|
||||
void MatchFinder_MoveBlock(CMatchFinder *p);
|
||||
void MatchFinder_ReadIfRequired(CMatchFinder *p);
|
||||
|
||||
@@ -76,10 +78,21 @@ int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
|
||||
ISzAllocPtr alloc);
|
||||
void MatchFinder_Free(CMatchFinder *p, ISzAllocPtr alloc);
|
||||
void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, size_t numItems);
|
||||
void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
|
||||
// void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
|
||||
|
||||
/*
|
||||
#define Inline_MatchFinder_InitPos(p, val) \
|
||||
(p)->pos = (val); \
|
||||
(p)->streamPos = (val);
|
||||
*/
|
||||
|
||||
#define Inline_MatchFinder_ReduceOffsets(p, subValue) \
|
||||
(p)->pos -= (subValue); \
|
||||
(p)->streamPos -= (subValue);
|
||||
|
||||
|
||||
UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son,
|
||||
UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
|
||||
size_t _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
|
||||
UInt32 *distances, UInt32 maxLen);
|
||||
|
||||
/*
|
||||
@@ -91,7 +104,7 @@ Conditions:
|
||||
typedef void (*Mf_Init_Func)(void *object);
|
||||
typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object);
|
||||
typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object);
|
||||
typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances);
|
||||
typedef UInt32 * (*Mf_GetMatches_Func)(void *object, UInt32 *distances);
|
||||
typedef void (*Mf_Skip_Func)(void *object, UInt32);
|
||||
|
||||
typedef struct _IMatchFinder
|
||||
@@ -101,21 +114,23 @@ typedef struct _IMatchFinder
|
||||
Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos;
|
||||
Mf_GetMatches_Func GetMatches;
|
||||
Mf_Skip_Func Skip;
|
||||
} IMatchFinder;
|
||||
} IMatchFinder2;
|
||||
|
||||
void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable);
|
||||
void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder2 *vTable);
|
||||
|
||||
void MatchFinder_Init_LowHash(CMatchFinder *p);
|
||||
void MatchFinder_Init_HighHash(CMatchFinder *p);
|
||||
void MatchFinder_Init_3(CMatchFinder *p, int readData);
|
||||
void MatchFinder_Init_4(CMatchFinder *p);
|
||||
void MatchFinder_Init(CMatchFinder *p);
|
||||
|
||||
UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
|
||||
UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
|
||||
UInt32* Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
|
||||
UInt32* Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
|
||||
|
||||
void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
|
||||
void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
|
||||
|
||||
void LzFindPrepare(void);
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif
|
||||
Vendored
+1400
File diff suppressed because it is too large
Load Diff
+27
-19
@@ -1,5 +1,5 @@
|
||||
/* LzFindMt.h -- multithreaded Match finder for LZ algorithms
|
||||
2018-07-04 : Igor Pavlov : Public domain */
|
||||
2021-07-12 : Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef __LZ_FIND_MT_H
|
||||
#define __LZ_FIND_MT_H
|
||||
@@ -9,31 +9,26 @@
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
#define kMtHashBlockSize (1 << 13)
|
||||
#define kMtHashNumBlocks (1 << 3)
|
||||
#define kMtHashNumBlocksMask (kMtHashNumBlocks - 1)
|
||||
|
||||
#define kMtBtBlockSize (1 << 14)
|
||||
#define kMtBtNumBlocks (1 << 6)
|
||||
#define kMtBtNumBlocksMask (kMtBtNumBlocks - 1)
|
||||
|
||||
typedef struct _CMtSync
|
||||
{
|
||||
UInt32 numProcessedBlocks;
|
||||
CThread thread;
|
||||
UInt64 affinity;
|
||||
|
||||
BoolInt wasCreated;
|
||||
BoolInt needStart;
|
||||
BoolInt csWasInitialized;
|
||||
BoolInt csWasEntered;
|
||||
|
||||
BoolInt exit;
|
||||
BoolInt stopWriting;
|
||||
|
||||
CThread thread;
|
||||
CAutoResetEvent canStart;
|
||||
CAutoResetEvent wasStarted;
|
||||
CAutoResetEvent wasStopped;
|
||||
CSemaphore freeSemaphore;
|
||||
CSemaphore filledSemaphore;
|
||||
BoolInt csWasInitialized;
|
||||
BoolInt csWasEntered;
|
||||
CCriticalSection cs;
|
||||
UInt32 numProcessedBlocks;
|
||||
// UInt32 numBlocks_Sent;
|
||||
} CMtSync;
|
||||
|
||||
typedef UInt32 * (*Mf_Mix_Matches)(void *p, UInt32 matchMinPos, UInt32 *distances);
|
||||
@@ -49,18 +44,23 @@ typedef struct _CMatchFinderMt
|
||||
/* LZ */
|
||||
const Byte *pointerToCurPos;
|
||||
UInt32 *btBuf;
|
||||
UInt32 btBufPos;
|
||||
UInt32 btBufPosLimit;
|
||||
const UInt32 *btBufPos;
|
||||
const UInt32 *btBufPosLimit;
|
||||
UInt32 lzPos;
|
||||
UInt32 btNumAvailBytes;
|
||||
|
||||
UInt32 *hash;
|
||||
UInt32 fixedHashSize;
|
||||
// UInt32 hash4Mask;
|
||||
UInt32 historySize;
|
||||
const UInt32 *crc;
|
||||
|
||||
Mf_Mix_Matches MixMatchesFunc;
|
||||
|
||||
UInt32 failure_LZ_BT; // failure in BT transfered to LZ
|
||||
// UInt32 failure_LZ_LZ; // failure in LZ tables
|
||||
UInt32 failureBuf[1];
|
||||
// UInt32 crc[256];
|
||||
|
||||
/* LZ + BT */
|
||||
CMtSync btSync;
|
||||
Byte btDummy[kMtCacheLineDummy];
|
||||
@@ -70,6 +70,8 @@ typedef struct _CMatchFinderMt
|
||||
UInt32 hashBufPos;
|
||||
UInt32 hashBufPosLimit;
|
||||
UInt32 hashNumAvail;
|
||||
UInt32 failure_BT;
|
||||
|
||||
|
||||
CLzRef *son;
|
||||
UInt32 matchMaxLen;
|
||||
@@ -77,7 +79,7 @@ typedef struct _CMatchFinderMt
|
||||
UInt32 pos;
|
||||
const Byte *buffer;
|
||||
UInt32 cyclicBufferPos;
|
||||
UInt32 cyclicBufferSize; /* it must be historySize + 1 */
|
||||
UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */
|
||||
UInt32 cutValue;
|
||||
|
||||
/* BT + Hash */
|
||||
@@ -87,13 +89,19 @@ typedef struct _CMatchFinderMt
|
||||
/* Hash */
|
||||
Mf_GetHeads GetHeadsFunc;
|
||||
CMatchFinder *MatchFinder;
|
||||
// CMatchFinder MatchFinder;
|
||||
} CMatchFinderMt;
|
||||
|
||||
// only for Mt part
|
||||
void MatchFinderMt_Construct(CMatchFinderMt *p);
|
||||
void MatchFinderMt_Destruct(CMatchFinderMt *p, ISzAllocPtr alloc);
|
||||
|
||||
SRes MatchFinderMt_Create(CMatchFinderMt *p, UInt32 historySize, UInt32 keepAddBufferBefore,
|
||||
UInt32 matchMaxLen, UInt32 keepAddBufferAfter, ISzAllocPtr alloc);
|
||||
void MatchFinderMt_CreateVTable(CMatchFinderMt *p, IMatchFinder *vTable);
|
||||
void MatchFinderMt_CreateVTable(CMatchFinderMt *p, IMatchFinder2 *vTable);
|
||||
|
||||
/* call MatchFinderMt_InitMt() before IMatchFinder::Init() */
|
||||
SRes MatchFinderMt_InitMt(CMatchFinderMt *p);
|
||||
void MatchFinderMt_ReleaseStream(CMatchFinderMt *p);
|
||||
|
||||
EXTERN_C_END
|
||||
Vendored
+578
@@ -0,0 +1,578 @@
|
||||
/* LzFindOpt.c -- multithreaded Match finder for LZ algorithms
|
||||
2021-07-13 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
#include "CpuArch.h"
|
||||
#include "LzFind.h"
|
||||
|
||||
// #include "LzFindMt.h"
|
||||
|
||||
// #define LOG_ITERS
|
||||
|
||||
// #define LOG_THREAD
|
||||
|
||||
#ifdef LOG_THREAD
|
||||
#include <stdio.h>
|
||||
#define PRF(x) x
|
||||
#else
|
||||
// #define PRF(x)
|
||||
#endif
|
||||
|
||||
#ifdef LOG_ITERS
|
||||
#include <stdio.h>
|
||||
UInt64 g_NumIters_Tree;
|
||||
UInt64 g_NumIters_Loop;
|
||||
UInt64 g_NumIters_Bytes;
|
||||
#define LOG_ITER(x) x
|
||||
#else
|
||||
#define LOG_ITER(x)
|
||||
#endif
|
||||
|
||||
// ---------- BT THREAD ----------
|
||||
|
||||
#define USE_SON_PREFETCH
|
||||
#define USE_LONG_MATCH_OPT
|
||||
|
||||
#define kEmptyHashValue 0
|
||||
|
||||
// #define CYC_TO_POS_OFFSET 0
|
||||
|
||||
// #define CYC_TO_POS_OFFSET 1 // for debug
|
||||
|
||||
/*
|
||||
MY_NO_INLINE
|
||||
UInt32 * MY_FAST_CALL GetMatchesSpecN_1(const Byte *lenLimit, size_t pos, const Byte *cur, CLzRef *son,
|
||||
UInt32 _cutValue, UInt32 *d, size_t _maxLen, const UInt32 *hash, const UInt32 *limit, const UInt32 *size, UInt32 *posRes)
|
||||
{
|
||||
do
|
||||
{
|
||||
UInt32 delta;
|
||||
if (hash == size)
|
||||
break;
|
||||
delta = *hash++;
|
||||
|
||||
if (delta == 0 || delta > (UInt32)pos)
|
||||
return NULL;
|
||||
|
||||
lenLimit++;
|
||||
|
||||
if (delta == (UInt32)pos)
|
||||
{
|
||||
CLzRef *ptr1 = son + ((size_t)pos << 1) - CYC_TO_POS_OFFSET * 2;
|
||||
*d++ = 0;
|
||||
ptr1[0] = kEmptyHashValue;
|
||||
ptr1[1] = kEmptyHashValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
UInt32 *_distances = ++d;
|
||||
|
||||
CLzRef *ptr0 = son + ((size_t)(pos) << 1) - CYC_TO_POS_OFFSET * 2 + 1;
|
||||
CLzRef *ptr1 = son + ((size_t)(pos) << 1) - CYC_TO_POS_OFFSET * 2;
|
||||
|
||||
const Byte *len0 = cur, *len1 = cur;
|
||||
UInt32 cutValue = _cutValue;
|
||||
const Byte *maxLen = cur + _maxLen;
|
||||
|
||||
for (LOG_ITER(g_NumIters_Tree++);;)
|
||||
{
|
||||
LOG_ITER(g_NumIters_Loop++);
|
||||
{
|
||||
const ptrdiff_t diff = (ptrdiff_t)0 - (ptrdiff_t)delta;
|
||||
CLzRef *pair = son + ((size_t)(((ptrdiff_t)pos - CYC_TO_POS_OFFSET) + diff) << 1);
|
||||
const Byte *len = (len0 < len1 ? len0 : len1);
|
||||
|
||||
#ifdef USE_SON_PREFETCH
|
||||
const UInt32 pair0 = *pair;
|
||||
#endif
|
||||
|
||||
if (len[diff] == len[0])
|
||||
{
|
||||
if (++len != lenLimit && len[diff] == len[0])
|
||||
while (++len != lenLimit)
|
||||
{
|
||||
LOG_ITER(g_NumIters_Bytes++);
|
||||
if (len[diff] != len[0])
|
||||
break;
|
||||
}
|
||||
if (maxLen < len)
|
||||
{
|
||||
maxLen = len;
|
||||
*d++ = (UInt32)(len - cur);
|
||||
*d++ = delta - 1;
|
||||
|
||||
if (len == lenLimit)
|
||||
{
|
||||
const UInt32 pair1 = pair[1];
|
||||
*ptr1 =
|
||||
#ifdef USE_SON_PREFETCH
|
||||
pair0;
|
||||
#else
|
||||
pair[0];
|
||||
#endif
|
||||
*ptr0 = pair1;
|
||||
|
||||
_distances[-1] = (UInt32)(d - _distances);
|
||||
|
||||
#ifdef USE_LONG_MATCH_OPT
|
||||
|
||||
if (hash == size || *hash != delta || lenLimit[diff] != lenLimit[0] || d >= limit)
|
||||
break;
|
||||
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
hash++;
|
||||
pos++;
|
||||
cur++;
|
||||
lenLimit++;
|
||||
{
|
||||
CLzRef *ptr = son + ((size_t)(pos) << 1) - CYC_TO_POS_OFFSET * 2;
|
||||
#if 0
|
||||
*(UInt64 *)(void *)ptr = ((const UInt64 *)(const void *)ptr)[diff];
|
||||
#else
|
||||
const UInt32 p0 = ptr[0 + (diff * 2)];
|
||||
const UInt32 p1 = ptr[1 + (diff * 2)];
|
||||
ptr[0] = p0;
|
||||
ptr[1] = p1;
|
||||
// ptr[0] = ptr[0 + (diff * 2)];
|
||||
// ptr[1] = ptr[1 + (diff * 2)];
|
||||
#endif
|
||||
}
|
||||
// PrintSon(son + 2, pos - 1);
|
||||
// printf("\npos = %x delta = %x\n", pos, delta);
|
||||
len++;
|
||||
*d++ = 2;
|
||||
*d++ = (UInt32)(len - cur);
|
||||
*d++ = delta - 1;
|
||||
if (hash == size || *hash != delta || lenLimit[diff] != lenLimit[0] || d >= limit)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const UInt32 curMatch = (UInt32)pos - delta; // (UInt32)(pos + diff);
|
||||
if (len[diff] < len[0])
|
||||
{
|
||||
delta = pair[1];
|
||||
if (delta >= curMatch)
|
||||
return NULL;
|
||||
*ptr1 = curMatch;
|
||||
ptr1 = pair + 1;
|
||||
len1 = len;
|
||||
}
|
||||
else
|
||||
{
|
||||
delta = *pair;
|
||||
if (delta >= curMatch)
|
||||
return NULL;
|
||||
*ptr0 = curMatch;
|
||||
ptr0 = pair;
|
||||
len0 = len;
|
||||
}
|
||||
|
||||
delta = (UInt32)pos - delta;
|
||||
|
||||
if (--cutValue == 0 || delta >= pos)
|
||||
{
|
||||
*ptr0 = *ptr1 = kEmptyHashValue;
|
||||
_distances[-1] = (UInt32)(d - _distances);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // for (tree iterations)
|
||||
}
|
||||
pos++;
|
||||
cur++;
|
||||
}
|
||||
while (d < limit);
|
||||
*posRes = (UInt32)pos;
|
||||
return d;
|
||||
}
|
||||
*/
|
||||
|
||||
/* define cbs if you use 2 functions.
|
||||
GetMatchesSpecN_1() : (pos < _cyclicBufferSize)
|
||||
GetMatchesSpecN_2() : (pos >= _cyclicBufferSize)
|
||||
|
||||
do not define cbs if you use 1 function:
|
||||
GetMatchesSpecN_2()
|
||||
*/
|
||||
|
||||
// #define cbs _cyclicBufferSize
|
||||
|
||||
/*
|
||||
we use size_t for (pos) and (_cyclicBufferPos_ instead of UInt32
|
||||
to eliminate "movsx" BUG in old MSVC x64 compiler.
|
||||
*/
|
||||
|
||||
UInt32 * MY_FAST_CALL GetMatchesSpecN_2(const Byte *lenLimit, size_t pos, const Byte *cur, CLzRef *son,
|
||||
UInt32 _cutValue, UInt32 *d, size_t _maxLen, const UInt32 *hash, const UInt32 *limit, const UInt32 *size,
|
||||
size_t _cyclicBufferPos, UInt32 _cyclicBufferSize,
|
||||
UInt32 *posRes);
|
||||
|
||||
MY_NO_INLINE
|
||||
UInt32 * MY_FAST_CALL GetMatchesSpecN_2(const Byte *lenLimit, size_t pos, const Byte *cur, CLzRef *son,
|
||||
UInt32 _cutValue, UInt32 *d, size_t _maxLen, const UInt32 *hash, const UInt32 *limit, const UInt32 *size,
|
||||
size_t _cyclicBufferPos, UInt32 _cyclicBufferSize,
|
||||
UInt32 *posRes)
|
||||
{
|
||||
do // while (hash != size)
|
||||
{
|
||||
UInt32 delta;
|
||||
|
||||
#ifndef cbs
|
||||
UInt32 cbs;
|
||||
#endif
|
||||
|
||||
if (hash == size)
|
||||
break;
|
||||
|
||||
delta = *hash++;
|
||||
|
||||
if (delta == 0)
|
||||
return NULL;
|
||||
|
||||
lenLimit++;
|
||||
|
||||
#ifndef cbs
|
||||
cbs = _cyclicBufferSize;
|
||||
if ((UInt32)pos < cbs)
|
||||
{
|
||||
if (delta > (UInt32)pos)
|
||||
return NULL;
|
||||
cbs = (UInt32)pos;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (delta >= cbs)
|
||||
{
|
||||
CLzRef *ptr1 = son + ((size_t)_cyclicBufferPos << 1);
|
||||
*d++ = 0;
|
||||
ptr1[0] = kEmptyHashValue;
|
||||
ptr1[1] = kEmptyHashValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
UInt32 *_distances = ++d;
|
||||
|
||||
CLzRef *ptr0 = son + ((size_t)_cyclicBufferPos << 1) + 1;
|
||||
CLzRef *ptr1 = son + ((size_t)_cyclicBufferPos << 1);
|
||||
|
||||
UInt32 cutValue = _cutValue;
|
||||
const Byte *len0 = cur, *len1 = cur;
|
||||
const Byte *maxLen = cur + _maxLen;
|
||||
|
||||
// if (cutValue == 0) { *ptr0 = *ptr1 = kEmptyHashValue; } else
|
||||
for (LOG_ITER(g_NumIters_Tree++);;)
|
||||
{
|
||||
LOG_ITER(g_NumIters_Loop++);
|
||||
{
|
||||
// SPEC code
|
||||
CLzRef *pair = son + ((size_t)((ptrdiff_t)_cyclicBufferPos - (ptrdiff_t)delta
|
||||
+ (ptrdiff_t)(UInt32)(_cyclicBufferPos < delta ? cbs : 0)
|
||||
) << 1);
|
||||
|
||||
const ptrdiff_t diff = (ptrdiff_t)0 - (ptrdiff_t)delta;
|
||||
const Byte *len = (len0 < len1 ? len0 : len1);
|
||||
|
||||
#ifdef USE_SON_PREFETCH
|
||||
const UInt32 pair0 = *pair;
|
||||
#endif
|
||||
|
||||
if (len[diff] == len[0])
|
||||
{
|
||||
if (++len != lenLimit && len[diff] == len[0])
|
||||
while (++len != lenLimit)
|
||||
{
|
||||
LOG_ITER(g_NumIters_Bytes++);
|
||||
if (len[diff] != len[0])
|
||||
break;
|
||||
}
|
||||
if (maxLen < len)
|
||||
{
|
||||
maxLen = len;
|
||||
*d++ = (UInt32)(len - cur);
|
||||
*d++ = delta - 1;
|
||||
|
||||
if (len == lenLimit)
|
||||
{
|
||||
const UInt32 pair1 = pair[1];
|
||||
*ptr1 =
|
||||
#ifdef USE_SON_PREFETCH
|
||||
pair0;
|
||||
#else
|
||||
pair[0];
|
||||
#endif
|
||||
*ptr0 = pair1;
|
||||
|
||||
_distances[-1] = (UInt32)(d - _distances);
|
||||
|
||||
#ifdef USE_LONG_MATCH_OPT
|
||||
|
||||
if (hash == size || *hash != delta || lenLimit[diff] != lenLimit[0] || d >= limit)
|
||||
break;
|
||||
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
*d++ = 2;
|
||||
*d++ = (UInt32)(lenLimit - cur);
|
||||
*d++ = delta - 1;
|
||||
cur++;
|
||||
lenLimit++;
|
||||
// SPEC
|
||||
_cyclicBufferPos++;
|
||||
{
|
||||
// SPEC code
|
||||
CLzRef *dest = son + ((size_t)(_cyclicBufferPos) << 1);
|
||||
const CLzRef *src = dest + ((diff
|
||||
+ (ptrdiff_t)(UInt32)((_cyclicBufferPos < delta) ? cbs : 0)) << 1);
|
||||
// CLzRef *ptr = son + ((size_t)(pos) << 1) - CYC_TO_POS_OFFSET * 2;
|
||||
#if 0
|
||||
*(UInt64 *)(void *)dest = *((const UInt64 *)(const void *)src);
|
||||
#else
|
||||
const UInt32 p0 = src[0];
|
||||
const UInt32 p1 = src[1];
|
||||
dest[0] = p0;
|
||||
dest[1] = p1;
|
||||
#endif
|
||||
}
|
||||
pos++;
|
||||
hash++;
|
||||
if (hash == size || *hash != delta || lenLimit[diff] != lenLimit[0] || d >= limit)
|
||||
break;
|
||||
} // for() end for long matches
|
||||
}
|
||||
#endif
|
||||
|
||||
break; // break from TREE iterations
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
const UInt32 curMatch = (UInt32)pos - delta; // (UInt32)(pos + diff);
|
||||
if (len[diff] < len[0])
|
||||
{
|
||||
delta = pair[1];
|
||||
*ptr1 = curMatch;
|
||||
ptr1 = pair + 1;
|
||||
len1 = len;
|
||||
if (delta >= curMatch)
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
delta = *pair;
|
||||
*ptr0 = curMatch;
|
||||
ptr0 = pair;
|
||||
len0 = len;
|
||||
if (delta >= curMatch)
|
||||
return NULL;
|
||||
}
|
||||
delta = (UInt32)pos - delta;
|
||||
|
||||
if (--cutValue == 0 || delta >= cbs)
|
||||
{
|
||||
*ptr0 = *ptr1 = kEmptyHashValue;
|
||||
_distances[-1] = (UInt32)(d - _distances);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // for (tree iterations)
|
||||
}
|
||||
pos++;
|
||||
_cyclicBufferPos++;
|
||||
cur++;
|
||||
}
|
||||
while (d < limit);
|
||||
*posRes = (UInt32)pos;
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
typedef UInt32 uint32plus; // size_t
|
||||
|
||||
UInt32 * MY_FAST_CALL GetMatchesSpecN_3(uint32plus lenLimit, size_t pos, const Byte *cur, CLzRef *son,
|
||||
UInt32 _cutValue, UInt32 *d, uint32plus _maxLen, const UInt32 *hash, const UInt32 *limit, const UInt32 *size,
|
||||
size_t _cyclicBufferPos, UInt32 _cyclicBufferSize,
|
||||
UInt32 *posRes)
|
||||
{
|
||||
do // while (hash != size)
|
||||
{
|
||||
UInt32 delta;
|
||||
|
||||
#ifndef cbs
|
||||
UInt32 cbs;
|
||||
#endif
|
||||
|
||||
if (hash == size)
|
||||
break;
|
||||
|
||||
delta = *hash++;
|
||||
|
||||
if (delta == 0)
|
||||
return NULL;
|
||||
|
||||
#ifndef cbs
|
||||
cbs = _cyclicBufferSize;
|
||||
if ((UInt32)pos < cbs)
|
||||
{
|
||||
if (delta > (UInt32)pos)
|
||||
return NULL;
|
||||
cbs = (UInt32)pos;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (delta >= cbs)
|
||||
{
|
||||
CLzRef *ptr1 = son + ((size_t)_cyclicBufferPos << 1);
|
||||
*d++ = 0;
|
||||
ptr1[0] = kEmptyHashValue;
|
||||
ptr1[1] = kEmptyHashValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
CLzRef *ptr0 = son + ((size_t)_cyclicBufferPos << 1) + 1;
|
||||
CLzRef *ptr1 = son + ((size_t)_cyclicBufferPos << 1);
|
||||
UInt32 *_distances = ++d;
|
||||
uint32plus len0 = 0, len1 = 0;
|
||||
UInt32 cutValue = _cutValue;
|
||||
uint32plus maxLen = _maxLen;
|
||||
// lenLimit++; // const Byte *lenLimit = cur + _lenLimit;
|
||||
|
||||
for (LOG_ITER(g_NumIters_Tree++);;)
|
||||
{
|
||||
LOG_ITER(g_NumIters_Loop++);
|
||||
{
|
||||
// const ptrdiff_t diff = (ptrdiff_t)0 - (ptrdiff_t)delta;
|
||||
CLzRef *pair = son + ((size_t)((ptrdiff_t)_cyclicBufferPos - delta
|
||||
+ (ptrdiff_t)(UInt32)(_cyclicBufferPos < delta ? cbs : 0)
|
||||
) << 1);
|
||||
const Byte *pb = cur - delta;
|
||||
uint32plus len = (len0 < len1 ? len0 : len1);
|
||||
|
||||
#ifdef USE_SON_PREFETCH
|
||||
const UInt32 pair0 = *pair;
|
||||
#endif
|
||||
|
||||
if (pb[len] == cur[len])
|
||||
{
|
||||
if (++len != lenLimit && pb[len] == cur[len])
|
||||
while (++len != lenLimit)
|
||||
if (pb[len] != cur[len])
|
||||
break;
|
||||
if (maxLen < len)
|
||||
{
|
||||
maxLen = len;
|
||||
*d++ = (UInt32)len;
|
||||
*d++ = delta - 1;
|
||||
if (len == lenLimit)
|
||||
{
|
||||
{
|
||||
const UInt32 pair1 = pair[1];
|
||||
*ptr0 = pair1;
|
||||
*ptr1 =
|
||||
#ifdef USE_SON_PREFETCH
|
||||
pair0;
|
||||
#else
|
||||
pair[0];
|
||||
#endif
|
||||
}
|
||||
|
||||
_distances[-1] = (UInt32)(d - _distances);
|
||||
|
||||
#ifdef USE_LONG_MATCH_OPT
|
||||
|
||||
if (hash == size || *hash != delta || pb[lenLimit] != cur[lenLimit] || d >= limit)
|
||||
break;
|
||||
|
||||
{
|
||||
const ptrdiff_t diff = (ptrdiff_t)0 - (ptrdiff_t)delta;
|
||||
for (;;)
|
||||
{
|
||||
*d++ = 2;
|
||||
*d++ = (UInt32)lenLimit;
|
||||
*d++ = delta - 1;
|
||||
_cyclicBufferPos++;
|
||||
{
|
||||
CLzRef *dest = son + ((size_t)_cyclicBufferPos << 1);
|
||||
const CLzRef *src = dest + ((diff +
|
||||
(ptrdiff_t)(UInt32)(_cyclicBufferPos < delta ? cbs : 0)) << 1);
|
||||
#if 0
|
||||
*(UInt64 *)(void *)dest = *((const UInt64 *)(const void *)src);
|
||||
#else
|
||||
const UInt32 p0 = src[0];
|
||||
const UInt32 p1 = src[1];
|
||||
dest[0] = p0;
|
||||
dest[1] = p1;
|
||||
#endif
|
||||
}
|
||||
hash++;
|
||||
pos++;
|
||||
cur++;
|
||||
pb++;
|
||||
if (hash == size || *hash != delta || pb[lenLimit] != cur[lenLimit] || d >= limit)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
const UInt32 curMatch = (UInt32)pos - delta;
|
||||
if (pb[len] < cur[len])
|
||||
{
|
||||
delta = pair[1];
|
||||
*ptr1 = curMatch;
|
||||
ptr1 = pair + 1;
|
||||
len1 = len;
|
||||
}
|
||||
else
|
||||
{
|
||||
delta = *pair;
|
||||
*ptr0 = curMatch;
|
||||
ptr0 = pair;
|
||||
len0 = len;
|
||||
}
|
||||
|
||||
{
|
||||
if (delta >= curMatch)
|
||||
return NULL;
|
||||
delta = (UInt32)pos - delta;
|
||||
if (delta >= cbs
|
||||
// delta >= _cyclicBufferSize || delta >= pos
|
||||
|| --cutValue == 0)
|
||||
{
|
||||
*ptr0 = *ptr1 = kEmptyHashValue;
|
||||
_distances[-1] = (UInt32)(d - _distances);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // for (tree iterations)
|
||||
}
|
||||
pos++;
|
||||
_cyclicBufferPos++;
|
||||
cur++;
|
||||
}
|
||||
while (d < limit);
|
||||
*posRes = (UInt32)pos;
|
||||
return d;
|
||||
}
|
||||
*/
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
/* LzHash.h -- HASH functions for LZ algorithms
|
||||
2019-10-30 : Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef __LZ_HASH_H
|
||||
#define __LZ_HASH_H
|
||||
|
||||
/*
|
||||
(kHash2Size >= (1 << 8)) : Required
|
||||
(kHash3Size >= (1 << 16)) : Required
|
||||
*/
|
||||
|
||||
#define kHash2Size (1 << 10)
|
||||
#define kHash3Size (1 << 16)
|
||||
// #define kHash4Size (1 << 20)
|
||||
|
||||
#define kFix3HashSize (kHash2Size)
|
||||
#define kFix4HashSize (kHash2Size + kHash3Size)
|
||||
// #define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size)
|
||||
|
||||
/*
|
||||
We use up to 3 crc values for hash:
|
||||
crc0
|
||||
crc1 << Shift_1
|
||||
crc2 << Shift_2
|
||||
(Shift_1 = 5) and (Shift_2 = 10) is good tradeoff.
|
||||
Small values for Shift are not good for collision rate.
|
||||
Big value for Shift_2 increases the minimum size
|
||||
of hash table, that will be slow for small files.
|
||||
*/
|
||||
|
||||
#define kLzHash_CrcShift_1 5
|
||||
#define kLzHash_CrcShift_2 10
|
||||
|
||||
#endif
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/* Lzma2Dec.c -- LZMA2 Decoder
|
||||
2019-02-02 : Igor Pavlov : Public domain */
|
||||
2021-02-09 : Igor Pavlov : Public domain */
|
||||
|
||||
/* #define SHOW_DEBUG_INFO */
|
||||
|
||||
@@ -93,7 +93,8 @@ void Lzma2Dec_Init(CLzma2Dec *p)
|
||||
LzmaDec_Init(&p->decoder);
|
||||
}
|
||||
|
||||
static ELzma2State Lzma2Dec_UpdateState(CLzma2Dec *p, Byte b)
|
||||
// ELzma2State
|
||||
static unsigned Lzma2Dec_UpdateState(CLzma2Dec *p, Byte b)
|
||||
{
|
||||
switch (p->state)
|
||||
{
|
||||
+22
-14
@@ -1,25 +1,25 @@
|
||||
/* Lzma2DecMt.c -- LZMA2 Decoder Multi-thread
|
||||
2019-02-02 : Igor Pavlov : Public domain */
|
||||
2021-04-01 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
// #define SHOW_DEBUG_INFO
|
||||
|
||||
// #define _7ZIP_ST
|
||||
|
||||
#ifdef SHOW_DEBUG_INFO
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifndef _7ZIP_ST
|
||||
#ifdef SHOW_DEBUG_INFO
|
||||
#define PRF(x) x
|
||||
#else
|
||||
#define PRF(x)
|
||||
#endif
|
||||
|
||||
#define PRF_STR(s) PRF(printf("\n" s "\n"))
|
||||
#define PRF_STR_INT(s, d) PRF(printf("\n" s " %d\n", (unsigned)d))
|
||||
#define PRF_STR_INT_2(s, d1, d2) PRF(printf("\n" s " %d %d\n", (unsigned)d1, (unsigned)d2))
|
||||
|
||||
// #define _7ZIP_ST
|
||||
#endif
|
||||
|
||||
#include "Alloc.h"
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
|
||||
#ifndef _7ZIP_ST
|
||||
#include "MtDec.h"
|
||||
#endif
|
||||
|
||||
|
||||
#define LZMA2DECMT_OUT_BLOCK_MAX_DEFAULT (1 << 28)
|
||||
#endif
|
||||
|
||||
|
||||
void Lzma2DecMtProps_Init(CLzma2DecMtProps *p)
|
||||
{
|
||||
@@ -255,7 +255,7 @@ static void Lzma2DecMt_MtCallback_Parse(void *obj, unsigned coderIndex, CMtDecCa
|
||||
const unsigned kNumAlignBits = 12;
|
||||
const unsigned kNumCacheLineBits = 7; /* <= kNumAlignBits */
|
||||
t->alloc.numAlignBits = kNumAlignBits;
|
||||
t->alloc.offset = ((UInt32)coderIndex * ((1 << 11) + (1 << 8) + (1 << 6))) & ((1 << kNumAlignBits) - (1 << kNumCacheLineBits));
|
||||
t->alloc.offset = ((UInt32)coderIndex * (((unsigned)1 << 11) + (1 << 8) + (1 << 6))) & (((unsigned)1 << kNumAlignBits) - ((unsigned)1 << kNumCacheLineBits));
|
||||
t->alloc.baseAlloc = me->alignOffsetAlloc.baseAlloc;
|
||||
}
|
||||
}
|
||||
@@ -527,7 +527,7 @@ static SRes Lzma2DecMt_MtCallback_Code(void *pp, unsigned coderIndex,
|
||||
|
||||
static SRes Lzma2DecMt_MtCallback_Write(void *pp, unsigned coderIndex,
|
||||
BoolInt needWriteToStream,
|
||||
const Byte *src, size_t srcSize,
|
||||
const Byte *src, size_t srcSize, BoolInt isCross,
|
||||
BoolInt *needContinue, BoolInt *canRecode)
|
||||
{
|
||||
CLzma2DecMt *me = (CLzma2DecMt *)pp;
|
||||
@@ -536,12 +536,14 @@ static SRes Lzma2DecMt_MtCallback_Write(void *pp, unsigned coderIndex,
|
||||
const Byte *data = t->outBuf;
|
||||
BoolInt needContinue2 = True;
|
||||
|
||||
UNUSED_VAR(src)
|
||||
UNUSED_VAR(srcSize)
|
||||
UNUSED_VAR(isCross)
|
||||
|
||||
PRF_STR_INT_2("Write", coderIndex, srcSize);
|
||||
|
||||
*needContinue = False;
|
||||
*canRecode = True;
|
||||
UNUSED_VAR(src)
|
||||
UNUSED_VAR(srcSize)
|
||||
|
||||
if (
|
||||
// t->parseStatus == LZMA_STATUS_FINISHED_WITH_MARK
|
||||
@@ -696,7 +698,7 @@ static SRes Lzma2Dec_Decode_ST(CLzma2DecMt *p
|
||||
inPos = 0;
|
||||
inLim = p->inBufSize;
|
||||
inData = p->inBuf;
|
||||
p->readRes = ISeqInStream_Read(p->inStream, (void *)inData, &inLim);
|
||||
p->readRes = ISeqInStream_Read(p->inStream, (void *)(p->inBuf), &inLim);
|
||||
// p->readProcessed += inLim;
|
||||
// inLim -= 5; p->readWasFinished = True; // for test
|
||||
if (inLim == 0 || p->readRes != SZ_OK)
|
||||
@@ -838,6 +840,7 @@ SRes Lzma2DecMt_Decode(CLzma2DecMtHandle pp,
|
||||
p->inProcessed = 0;
|
||||
|
||||
p->readWasFinished = False;
|
||||
p->readRes = SZ_OK;
|
||||
|
||||
*isMT = False;
|
||||
|
||||
@@ -856,7 +859,7 @@ SRes Lzma2DecMt_Decode(CLzma2DecMtHandle pp,
|
||||
|
||||
if (p->props.numThreads > 1)
|
||||
{
|
||||
IMtDecCallback vt;
|
||||
IMtDecCallback2 vt;
|
||||
|
||||
Lzma2DecMt_FreeSt(p);
|
||||
|
||||
@@ -955,7 +958,12 @@ SRes Lzma2DecMt_Decode(CLzma2DecMtHandle pp,
|
||||
*inProcessed = p->inProcessed;
|
||||
|
||||
// res = SZ_OK; // for test
|
||||
if (res == SZ_OK && p->readRes != SZ_OK)
|
||||
if (res == SZ_ERROR_INPUT_EOF)
|
||||
{
|
||||
if (p->readRes != SZ_OK)
|
||||
res = p->readRes;
|
||||
}
|
||||
else if (res == SZ_OK && p->readRes != SZ_OK)
|
||||
res = p->readRes;
|
||||
|
||||
/*
|
||||
+7
-7
@@ -1,5 +1,5 @@
|
||||
/* Lzma2Enc.c -- LZMA2 Encoder
|
||||
2018-07-04 : Igor Pavlov : Public domain */
|
||||
2021-02-09 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
@@ -330,7 +330,7 @@ void Lzma2EncProps_Normalize(CLzma2EncProps *p)
|
||||
numBlocks++;
|
||||
if (numBlocks < (unsigned)t2)
|
||||
{
|
||||
t2r = (unsigned)numBlocks;
|
||||
t2r = (int)numBlocks;
|
||||
if (t2r == 0)
|
||||
t2r = 1;
|
||||
t3 = t1 * t2r;
|
||||
@@ -632,15 +632,15 @@ static SRes Lzma2Enc_EncodeMt1(
|
||||
{
|
||||
if (outBuf)
|
||||
{
|
||||
size_t destPos = *outBufSize;
|
||||
const size_t destPos = *outBufSize;
|
||||
if (destPos >= outLim)
|
||||
return SZ_ERROR_OUTPUT_EOF;
|
||||
outBuf[destPos] = 0;
|
||||
outBuf[destPos] = LZMA2_CONTROL_EOF; // 0
|
||||
*outBufSize = destPos + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Byte b = 0;
|
||||
const Byte b = LZMA2_CONTROL_EOF; // 0;
|
||||
if (ISeqOutStream_Write(outStream, &b, 1) != 1)
|
||||
return SZ_ERROR_WRITE;
|
||||
}
|
||||
@@ -780,13 +780,13 @@ SRes Lzma2Enc_Encode2(CLzma2EncHandle pp,
|
||||
p->outBufSize = destBlockSize;
|
||||
}
|
||||
|
||||
p->mtCoder.numThreadsMax = p->props.numBlockThreads_Max;
|
||||
p->mtCoder.numThreadsMax = (unsigned)p->props.numBlockThreads_Max;
|
||||
p->mtCoder.expectedDataSize = p->expectedDataSize;
|
||||
|
||||
{
|
||||
SRes res = MtCoder_Code(&p->mtCoder);
|
||||
if (!outStream)
|
||||
*outBufSize = p->outBuf - outBuf;
|
||||
*outBufSize = (size_t)(p->outBuf - outBuf);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,6 @@
|
||||
#include "Bra.h"
|
||||
#include "LzmaEnc.h"
|
||||
|
||||
#define SZE_OUT_OVERFLOW SZE_DATA_ERROR
|
||||
|
||||
int Lzma86_Encode(Byte *dest, size_t *destLen, const Byte *src, size_t srcLen,
|
||||
int level, UInt32 dictSize, int filterMode)
|
||||
{
|
||||
+300
-122
@@ -1,5 +1,5 @@
|
||||
/* LzmaDec.c -- LZMA Decoder
|
||||
2018-07-04 : Igor Pavlov : Public domain */
|
||||
2021-04-01 : Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
@@ -13,10 +13,12 @@
|
||||
|
||||
#define kNumBitModelTotalBits 11
|
||||
#define kBitModelTotal (1 << kNumBitModelTotalBits)
|
||||
#define kNumMoveBits 5
|
||||
|
||||
#define RC_INIT_SIZE 5
|
||||
|
||||
#ifndef _LZMA_DEC_OPT
|
||||
|
||||
#define kNumMoveBits 5
|
||||
#define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); }
|
||||
|
||||
#define IF_BIT_0(p) ttt = *(p); NORMALIZE; bound = (range >> kNumBitModelTotalBits) * (UInt32)ttt; if (code < bound)
|
||||
@@ -62,9 +64,10 @@
|
||||
probLit = prob + (offs + bit + symbol); \
|
||||
GET_BIT2(probLit, symbol, offs ^= bit; , ;)
|
||||
|
||||
#endif // _LZMA_DEC_OPT
|
||||
|
||||
|
||||
#define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_ERROR; range <<= 8; code = (code << 8) | (*buf++); }
|
||||
#define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_INPUT_EOF; range <<= 8; code = (code << 8) | (*buf++); }
|
||||
|
||||
#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * (UInt32)ttt; if (code < bound)
|
||||
#define UPDATE_0_CHECK range = bound;
|
||||
@@ -114,6 +117,9 @@
|
||||
#define kMatchMinLen 2
|
||||
#define kMatchSpecLenStart (kMatchMinLen + kLenNumLowSymbols * 2 + kLenNumHighSymbols)
|
||||
|
||||
#define kMatchSpecLen_Error_Data (1 << 9)
|
||||
#define kMatchSpecLen_Error_Fail (kMatchSpecLen_Error_Data - 1)
|
||||
|
||||
/* External ASM code needs same CLzmaProb array layout. So don't change it. */
|
||||
|
||||
/* (probs_1664) is faster and better for code size at some platforms */
|
||||
@@ -166,10 +172,12 @@
|
||||
|
||||
/*
|
||||
p->remainLen : shows status of LZMA decoder:
|
||||
< kMatchSpecLenStart : normal remain
|
||||
= kMatchSpecLenStart : finished
|
||||
= kMatchSpecLenStart + 1 : need init range coder
|
||||
= kMatchSpecLenStart + 2 : need init range coder and state
|
||||
< kMatchSpecLenStart : the number of bytes to be copied with (p->rep0) offset
|
||||
= kMatchSpecLenStart : the LZMA stream was finished with end mark
|
||||
= kMatchSpecLenStart + 1 : need init range coder
|
||||
= kMatchSpecLenStart + 2 : need init range coder and state
|
||||
= kMatchSpecLen_Error_Fail : Internal Code Failure
|
||||
= kMatchSpecLen_Error_Data + [0 ... 273] : LZMA Data Error
|
||||
*/
|
||||
|
||||
/* ---------- LZMA_DECODE_REAL ---------- */
|
||||
@@ -188,23 +196,31 @@ In:
|
||||
{
|
||||
LzmaDec_TryDummy() was called before to exclude LITERAL and MATCH-REP cases.
|
||||
So first symbol can be only MATCH-NON-REP. And if that MATCH-NON-REP symbol
|
||||
is not END_OF_PAYALOAD_MARKER, then function returns error code.
|
||||
is not END_OF_PAYALOAD_MARKER, then the function doesn't write any byte to dictionary,
|
||||
the function returns SZ_OK, and the caller can use (p->remainLen) and (p->reps[0]) later.
|
||||
}
|
||||
|
||||
Processing:
|
||||
first LZMA symbol will be decoded in any case
|
||||
All checks for limits are at the end of main loop,
|
||||
It will decode new LZMA-symbols while (p->buf < bufLimit && dicPos < limit),
|
||||
The first LZMA symbol will be decoded in any case.
|
||||
All main checks for limits are at the end of main loop,
|
||||
It decodes additional LZMA-symbols while (p->buf < bufLimit && dicPos < limit),
|
||||
RangeCoder is still without last normalization when (p->buf < bufLimit) is being checked.
|
||||
But if (p->buf < bufLimit), the caller provided at least (LZMA_REQUIRED_INPUT_MAX + 1) bytes for
|
||||
next iteration before limit (bufLimit + LZMA_REQUIRED_INPUT_MAX),
|
||||
that is enough for worst case LZMA symbol with one additional RangeCoder normalization for one bit.
|
||||
So that function never reads bufLimit [LZMA_REQUIRED_INPUT_MAX] byte.
|
||||
|
||||
Out:
|
||||
RangeCoder is normalized
|
||||
Result:
|
||||
SZ_OK - OK
|
||||
SZ_ERROR_DATA - Error
|
||||
p->remainLen:
|
||||
< kMatchSpecLenStart : normal remain
|
||||
= kMatchSpecLenStart : finished
|
||||
p->remainLen:
|
||||
< kMatchSpecLenStart : the number of bytes to be copied with (p->reps[0]) offset
|
||||
= kMatchSpecLenStart : the LZMA stream was finished with end mark
|
||||
|
||||
SZ_ERROR_DATA - error, when the MATCH-Symbol refers out of dictionary
|
||||
p->remainLen : undefined
|
||||
p->reps[*] : undefined
|
||||
*/
|
||||
|
||||
|
||||
@@ -316,11 +332,6 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit
|
||||
else
|
||||
{
|
||||
UPDATE_1(prob);
|
||||
/*
|
||||
// that case was checked before with kBadRepCode
|
||||
if (checkDicSize == 0 && processedPos == 0)
|
||||
return SZ_ERROR_DATA;
|
||||
*/
|
||||
prob = probs + IsRepG0 + state;
|
||||
IF_BIT_0(prob)
|
||||
{
|
||||
@@ -329,6 +340,13 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit
|
||||
IF_BIT_0(prob)
|
||||
{
|
||||
UPDATE_0(prob);
|
||||
|
||||
// that case was checked before with kBadRepCode
|
||||
// if (checkDicSize == 0 && processedPos == 0) { len = kMatchSpecLen_Error_Data + 1; break; }
|
||||
// The caller doesn't allow (dicPos == limit) case here
|
||||
// so we don't need the following check:
|
||||
// if (dicPos == limit) { state = state < kNumLitStates ? 9 : 11; len = 1; break; }
|
||||
|
||||
dic[dicPos] = dic[dicPos - rep0 + (dicPos < rep0 ? dicBufSize : 0)];
|
||||
dicPos++;
|
||||
processedPos++;
|
||||
@@ -518,8 +536,10 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit
|
||||
state = (state < kNumStates + kNumLitStates) ? kNumLitStates : kNumLitStates + 3;
|
||||
if (distance >= (checkDicSize == 0 ? processedPos: checkDicSize))
|
||||
{
|
||||
p->dicPos = dicPos;
|
||||
return SZ_ERROR_DATA;
|
||||
len += kMatchSpecLen_Error_Data + kMatchMinLen;
|
||||
// len = kMatchSpecLen_Error_Data;
|
||||
// len += kMatchMinLen;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -532,8 +552,13 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit
|
||||
|
||||
if ((rem = limit - dicPos) == 0)
|
||||
{
|
||||
p->dicPos = dicPos;
|
||||
return SZ_ERROR_DATA;
|
||||
/*
|
||||
We stop decoding and return SZ_OK, and we can resume decoding later.
|
||||
Any error conditions can be tested later in caller code.
|
||||
For more strict mode we can stop decoding with error
|
||||
// len += kMatchSpecLen_Error_Data;
|
||||
*/
|
||||
break;
|
||||
}
|
||||
|
||||
curLen = ((rem < len) ? (unsigned)rem : len);
|
||||
@@ -572,7 +597,7 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit
|
||||
p->buf = buf;
|
||||
p->range = range;
|
||||
p->code = code;
|
||||
p->remainLen = (UInt32)len;
|
||||
p->remainLen = (UInt32)len; // & (kMatchSpecLen_Error_Data - 1); // we can write real length for error matches too.
|
||||
p->dicPos = dicPos;
|
||||
p->processedPos = processedPos;
|
||||
p->reps[0] = rep0;
|
||||
@@ -580,40 +605,61 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit
|
||||
p->reps[2] = rep2;
|
||||
p->reps[3] = rep3;
|
||||
p->state = (UInt32)state;
|
||||
|
||||
if (len >= kMatchSpecLen_Error_Data)
|
||||
return SZ_ERROR_DATA;
|
||||
return SZ_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit)
|
||||
{
|
||||
if (p->remainLen != 0 && p->remainLen < kMatchSpecLenStart)
|
||||
unsigned len = (unsigned)p->remainLen;
|
||||
if (len == 0 /* || len >= kMatchSpecLenStart */)
|
||||
return;
|
||||
{
|
||||
Byte *dic = p->dic;
|
||||
SizeT dicPos = p->dicPos;
|
||||
SizeT dicBufSize = p->dicBufSize;
|
||||
unsigned len = (unsigned)p->remainLen;
|
||||
SizeT rep0 = p->reps[0]; /* we use SizeT to avoid the BUG of VC14 for AMD64 */
|
||||
SizeT rem = limit - dicPos;
|
||||
if (rem < len)
|
||||
len = (unsigned)(rem);
|
||||
Byte *dic;
|
||||
SizeT dicBufSize;
|
||||
SizeT rep0; /* we use SizeT to avoid the BUG of VC14 for AMD64 */
|
||||
{
|
||||
SizeT rem = limit - dicPos;
|
||||
if (rem < len)
|
||||
{
|
||||
len = (unsigned)(rem);
|
||||
if (len == 0)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (p->checkDicSize == 0 && p->prop.dicSize - p->processedPos <= len)
|
||||
p->checkDicSize = p->prop.dicSize;
|
||||
|
||||
p->processedPos += (UInt32)len;
|
||||
p->remainLen -= (UInt32)len;
|
||||
while (len != 0)
|
||||
dic = p->dic;
|
||||
rep0 = p->reps[0];
|
||||
dicBufSize = p->dicBufSize;
|
||||
do
|
||||
{
|
||||
len--;
|
||||
dic[dicPos] = dic[dicPos - rep0 + (dicPos < rep0 ? dicBufSize : 0)];
|
||||
dicPos++;
|
||||
}
|
||||
while (--len);
|
||||
p->dicPos = dicPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
At staring of new stream we have one of the following symbols:
|
||||
- Literal - is allowed
|
||||
- Non-Rep-Match - is allowed only if it's end marker symbol
|
||||
- Rep-Match - is not allowed
|
||||
We use early check of (RangeCoder:Code) over kBadRepCode to simplify main decoding code
|
||||
*/
|
||||
|
||||
#define kRange0 0xFFFFFFFF
|
||||
#define kBound0 ((kRange0 >> kNumBitModelTotalBits) << (kNumBitModelTotalBits - 1))
|
||||
#define kBadRepCode (kBound0 + (((kRange0 - kBound0) >> kNumBitModelTotalBits) << (kNumBitModelTotalBits - 1)))
|
||||
@@ -621,69 +667,77 @@ static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit)
|
||||
#error Stop_Compiling_Bad_LZMA_Check
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
LzmaDec_DecodeReal2():
|
||||
It calls LZMA_DECODE_REAL() and it adjusts limit according (p->checkDicSize).
|
||||
|
||||
We correct (p->checkDicSize) after LZMA_DECODE_REAL() and in LzmaDec_WriteRem(),
|
||||
and we support the following state of (p->checkDicSize):
|
||||
if (total_processed < p->prop.dicSize) then
|
||||
{
|
||||
(total_processed == p->processedPos)
|
||||
(p->checkDicSize == 0)
|
||||
}
|
||||
else
|
||||
(p->checkDicSize == p->prop.dicSize)
|
||||
*/
|
||||
|
||||
static int MY_FAST_CALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
|
||||
{
|
||||
do
|
||||
if (p->checkDicSize == 0)
|
||||
{
|
||||
SizeT limit2 = limit;
|
||||
if (p->checkDicSize == 0)
|
||||
{
|
||||
UInt32 rem = p->prop.dicSize - p->processedPos;
|
||||
if (limit - p->dicPos > rem)
|
||||
limit2 = p->dicPos + rem;
|
||||
|
||||
if (p->processedPos == 0)
|
||||
if (p->code >= kBadRepCode)
|
||||
return SZ_ERROR_DATA;
|
||||
}
|
||||
|
||||
RINOK(LZMA_DECODE_REAL(p, limit2, bufLimit));
|
||||
|
||||
UInt32 rem = p->prop.dicSize - p->processedPos;
|
||||
if (limit - p->dicPos > rem)
|
||||
limit = p->dicPos + rem;
|
||||
}
|
||||
{
|
||||
int res = LZMA_DECODE_REAL(p, limit, bufLimit);
|
||||
if (p->checkDicSize == 0 && p->processedPos >= p->prop.dicSize)
|
||||
p->checkDicSize = p->prop.dicSize;
|
||||
|
||||
LzmaDec_WriteRem(p, limit);
|
||||
return res;
|
||||
}
|
||||
while (p->dicPos < limit && p->buf < bufLimit && p->remainLen < kMatchSpecLenStart);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DUMMY_ERROR, /* unexpected end of input stream */
|
||||
DUMMY_INPUT_EOF, /* need more input data */
|
||||
DUMMY_LIT,
|
||||
DUMMY_MATCH,
|
||||
DUMMY_REP
|
||||
} ELzmaDummy;
|
||||
|
||||
static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inSize)
|
||||
|
||||
#define IS_DUMMY_END_MARKER_POSSIBLE(dummyRes) ((dummyRes) == DUMMY_MATCH)
|
||||
|
||||
static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, const Byte **bufOut)
|
||||
{
|
||||
UInt32 range = p->range;
|
||||
UInt32 code = p->code;
|
||||
const Byte *bufLimit = buf + inSize;
|
||||
const Byte *bufLimit = *bufOut;
|
||||
const CLzmaProb *probs = GET_PROBS;
|
||||
unsigned state = (unsigned)p->state;
|
||||
ELzmaDummy res;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
const CLzmaProb *prob;
|
||||
UInt32 bound;
|
||||
unsigned ttt;
|
||||
unsigned posState = CALC_POS_STATE(p->processedPos, (1 << p->prop.pb) - 1);
|
||||
unsigned posState = CALC_POS_STATE(p->processedPos, ((unsigned)1 << p->prop.pb) - 1);
|
||||
|
||||
prob = probs + IsMatch + COMBINED_PS_STATE;
|
||||
IF_BIT_0_CHECK(prob)
|
||||
{
|
||||
UPDATE_0_CHECK
|
||||
|
||||
/* if (bufLimit - buf >= 7) return DUMMY_LIT; */
|
||||
|
||||
prob = probs + Literal;
|
||||
if (p->checkDicSize != 0 || p->processedPos != 0)
|
||||
prob += ((UInt32)LZMA_LIT_SIZE *
|
||||
((((p->processedPos) & ((1 << (p->prop.lp)) - 1)) << p->prop.lc) +
|
||||
(p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc))));
|
||||
((((p->processedPos) & (((unsigned)1 << (p->prop.lp)) - 1)) << p->prop.lc) +
|
||||
((unsigned)p->dic[(p->dicPos == 0 ? p->dicBufSize : p->dicPos) - 1] >> (8 - p->prop.lc))));
|
||||
|
||||
if (state < kNumLitStates)
|
||||
{
|
||||
@@ -735,8 +789,7 @@ static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inS
|
||||
IF_BIT_0_CHECK(prob)
|
||||
{
|
||||
UPDATE_0_CHECK;
|
||||
NORMALIZE_CHECK;
|
||||
return DUMMY_REP;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -812,8 +865,6 @@ static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inS
|
||||
{
|
||||
unsigned numDirectBits = ((posSlot >> 1) - 1);
|
||||
|
||||
/* if (bufLimit - buf >= 8) return DUMMY_MATCH; */
|
||||
|
||||
if (posSlot < kEndPosModelIndex)
|
||||
{
|
||||
prob = probs + SpecPos + ((2 | (posSlot & 1)) << numDirectBits);
|
||||
@@ -844,12 +895,15 @@ static ELzmaDummy LzmaDec_TryDummy(const CLzmaDec *p, const Byte *buf, SizeT inS
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
NORMALIZE_CHECK;
|
||||
|
||||
*bufOut = buf;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
void LzmaDec_InitDicAndState(CLzmaDec *p, BoolInt initDic, BoolInt initState);
|
||||
void LzmaDec_InitDicAndState(CLzmaDec *p, BoolInt initDic, BoolInt initState)
|
||||
{
|
||||
p->remainLen = kMatchSpecLenStart + 1;
|
||||
@@ -872,16 +926,41 @@ void LzmaDec_Init(CLzmaDec *p)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
LZMA supports optional end_marker.
|
||||
So the decoder can lookahead for one additional LZMA-Symbol to check end_marker.
|
||||
That additional LZMA-Symbol can require up to LZMA_REQUIRED_INPUT_MAX bytes in input stream.
|
||||
When the decoder reaches dicLimit, it looks (finishMode) parameter:
|
||||
if (finishMode == LZMA_FINISH_ANY), the decoder doesn't lookahead
|
||||
if (finishMode != LZMA_FINISH_ANY), the decoder lookahead, if end_marker is possible for current position
|
||||
|
||||
When the decoder lookahead, and the lookahead symbol is not end_marker, we have two ways:
|
||||
1) Strict mode (default) : the decoder returns SZ_ERROR_DATA.
|
||||
2) The relaxed mode (alternative mode) : we could return SZ_OK, and the caller
|
||||
must check (status) value. The caller can show the error,
|
||||
if the end of stream is expected, and the (status) is noit
|
||||
LZMA_STATUS_FINISHED_WITH_MARK or LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK.
|
||||
*/
|
||||
|
||||
|
||||
#define RETURN__NOT_FINISHED__FOR_FINISH \
|
||||
*status = LZMA_STATUS_NOT_FINISHED; \
|
||||
return SZ_ERROR_DATA; // for strict mode
|
||||
// return SZ_OK; // for relaxed mode
|
||||
|
||||
|
||||
SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *srcLen,
|
||||
ELzmaFinishMode finishMode, ELzmaStatus *status)
|
||||
{
|
||||
SizeT inSize = *srcLen;
|
||||
(*srcLen) = 0;
|
||||
|
||||
*status = LZMA_STATUS_NOT_SPECIFIED;
|
||||
|
||||
if (p->remainLen > kMatchSpecLenStart)
|
||||
{
|
||||
if (p->remainLen > kMatchSpecLenStart + 2)
|
||||
return p->remainLen == kMatchSpecLen_Error_Fail ? SZ_ERROR_FAIL : SZ_ERROR_DATA;
|
||||
|
||||
for (; inSize > 0 && p->tempBufSize < RC_INIT_SIZE; (*srcLen)++, inSize--)
|
||||
p->tempBuf[p->tempBufSize++] = *src++;
|
||||
if (p->tempBufSize != 0 && p->tempBuf[0] != 0)
|
||||
@@ -896,6 +975,12 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *sr
|
||||
| ((UInt32)p->tempBuf[2] << 16)
|
||||
| ((UInt32)p->tempBuf[3] << 8)
|
||||
| ((UInt32)p->tempBuf[4]);
|
||||
|
||||
if (p->checkDicSize == 0
|
||||
&& p->processedPos == 0
|
||||
&& p->code >= kBadRepCode)
|
||||
return SZ_ERROR_DATA;
|
||||
|
||||
p->range = 0xFFFFFFFF;
|
||||
p->tempBufSize = 0;
|
||||
|
||||
@@ -913,10 +998,21 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *sr
|
||||
p->remainLen = 0;
|
||||
}
|
||||
|
||||
LzmaDec_WriteRem(p, dicLimit);
|
||||
|
||||
while (p->remainLen != kMatchSpecLenStart)
|
||||
for (;;)
|
||||
{
|
||||
if (p->remainLen == kMatchSpecLenStart)
|
||||
{
|
||||
if (p->code != 0)
|
||||
return SZ_ERROR_DATA;
|
||||
*status = LZMA_STATUS_FINISHED_WITH_MARK;
|
||||
return SZ_OK;
|
||||
}
|
||||
|
||||
LzmaDec_WriteRem(p, dicLimit);
|
||||
|
||||
{
|
||||
// (p->remainLen == 0 || p->dicPos == dicLimit)
|
||||
|
||||
int checkEndMarkNow = 0;
|
||||
|
||||
if (p->dicPos >= dicLimit)
|
||||
@@ -933,92 +1029,174 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit, const Byte *src, SizeT *sr
|
||||
}
|
||||
if (p->remainLen != 0)
|
||||
{
|
||||
*status = LZMA_STATUS_NOT_FINISHED;
|
||||
return SZ_ERROR_DATA;
|
||||
RETURN__NOT_FINISHED__FOR_FINISH;
|
||||
}
|
||||
checkEndMarkNow = 1;
|
||||
}
|
||||
|
||||
// (p->remainLen == 0)
|
||||
|
||||
if (p->tempBufSize == 0)
|
||||
{
|
||||
SizeT processed;
|
||||
const Byte *bufLimit;
|
||||
int dummyProcessed = -1;
|
||||
|
||||
if (inSize < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)
|
||||
{
|
||||
int dummyRes = LzmaDec_TryDummy(p, src, inSize);
|
||||
if (dummyRes == DUMMY_ERROR)
|
||||
const Byte *bufOut = src + inSize;
|
||||
|
||||
ELzmaDummy dummyRes = LzmaDec_TryDummy(p, src, &bufOut);
|
||||
|
||||
if (dummyRes == DUMMY_INPUT_EOF)
|
||||
{
|
||||
memcpy(p->tempBuf, src, inSize);
|
||||
p->tempBufSize = (unsigned)inSize;
|
||||
size_t i;
|
||||
if (inSize >= LZMA_REQUIRED_INPUT_MAX)
|
||||
break;
|
||||
(*srcLen) += inSize;
|
||||
p->tempBufSize = (unsigned)inSize;
|
||||
for (i = 0; i < inSize; i++)
|
||||
p->tempBuf[i] = src[i];
|
||||
*status = LZMA_STATUS_NEEDS_MORE_INPUT;
|
||||
return SZ_OK;
|
||||
}
|
||||
if (checkEndMarkNow && dummyRes != DUMMY_MATCH)
|
||||
|
||||
dummyProcessed = (int)(bufOut - src);
|
||||
if ((unsigned)dummyProcessed > LZMA_REQUIRED_INPUT_MAX)
|
||||
break;
|
||||
|
||||
if (checkEndMarkNow && !IS_DUMMY_END_MARKER_POSSIBLE(dummyRes))
|
||||
{
|
||||
*status = LZMA_STATUS_NOT_FINISHED;
|
||||
return SZ_ERROR_DATA;
|
||||
unsigned i;
|
||||
(*srcLen) += (unsigned)dummyProcessed;
|
||||
p->tempBufSize = (unsigned)dummyProcessed;
|
||||
for (i = 0; i < (unsigned)dummyProcessed; i++)
|
||||
p->tempBuf[i] = src[i];
|
||||
// p->remainLen = kMatchSpecLen_Error_Data;
|
||||
RETURN__NOT_FINISHED__FOR_FINISH;
|
||||
}
|
||||
|
||||
bufLimit = src;
|
||||
// we will decode only one iteration
|
||||
}
|
||||
else
|
||||
bufLimit = src + inSize - LZMA_REQUIRED_INPUT_MAX;
|
||||
|
||||
p->buf = src;
|
||||
if (LzmaDec_DecodeReal2(p, dicLimit, bufLimit) != 0)
|
||||
return SZ_ERROR_DATA;
|
||||
processed = (SizeT)(p->buf - src);
|
||||
(*srcLen) += processed;
|
||||
src += processed;
|
||||
inSize -= processed;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned rem = p->tempBufSize, lookAhead = 0;
|
||||
while (rem < LZMA_REQUIRED_INPUT_MAX && lookAhead < inSize)
|
||||
p->tempBuf[rem++] = src[lookAhead++];
|
||||
p->tempBufSize = rem;
|
||||
if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)
|
||||
|
||||
{
|
||||
int dummyRes = LzmaDec_TryDummy(p, p->tempBuf, (SizeT)rem);
|
||||
if (dummyRes == DUMMY_ERROR)
|
||||
int res = LzmaDec_DecodeReal2(p, dicLimit, bufLimit);
|
||||
|
||||
SizeT processed = (SizeT)(p->buf - src);
|
||||
|
||||
if (dummyProcessed < 0)
|
||||
{
|
||||
(*srcLen) += (SizeT)lookAhead;
|
||||
*status = LZMA_STATUS_NEEDS_MORE_INPUT;
|
||||
return SZ_OK;
|
||||
if (processed > inSize)
|
||||
break;
|
||||
}
|
||||
if (checkEndMarkNow && dummyRes != DUMMY_MATCH)
|
||||
else if ((unsigned)dummyProcessed != processed)
|
||||
break;
|
||||
|
||||
src += processed;
|
||||
inSize -= processed;
|
||||
(*srcLen) += processed;
|
||||
|
||||
if (res != SZ_OK)
|
||||
{
|
||||
*status = LZMA_STATUS_NOT_FINISHED;
|
||||
p->remainLen = kMatchSpecLen_Error_Data;
|
||||
return SZ_ERROR_DATA;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
{
|
||||
// we have some data in (p->tempBuf)
|
||||
// in strict mode: tempBufSize is not enough for one Symbol decoding.
|
||||
// in relaxed mode: tempBufSize not larger than required for one Symbol decoding.
|
||||
|
||||
unsigned rem = p->tempBufSize;
|
||||
unsigned ahead = 0;
|
||||
int dummyProcessed = -1;
|
||||
|
||||
while (rem < LZMA_REQUIRED_INPUT_MAX && ahead < inSize)
|
||||
p->tempBuf[rem++] = src[ahead++];
|
||||
|
||||
// ahead - the size of new data copied from (src) to (p->tempBuf)
|
||||
// rem - the size of temp buffer including new data from (src)
|
||||
|
||||
if (rem < LZMA_REQUIRED_INPUT_MAX || checkEndMarkNow)
|
||||
{
|
||||
const Byte *bufOut = p->tempBuf + rem;
|
||||
|
||||
ELzmaDummy dummyRes = LzmaDec_TryDummy(p, p->tempBuf, &bufOut);
|
||||
|
||||
if (dummyRes == DUMMY_INPUT_EOF)
|
||||
{
|
||||
if (rem >= LZMA_REQUIRED_INPUT_MAX)
|
||||
break;
|
||||
p->tempBufSize = rem;
|
||||
(*srcLen) += (SizeT)ahead;
|
||||
*status = LZMA_STATUS_NEEDS_MORE_INPUT;
|
||||
return SZ_OK;
|
||||
}
|
||||
|
||||
dummyProcessed = (int)(bufOut - p->tempBuf);
|
||||
|
||||
if ((unsigned)dummyProcessed < p->tempBufSize)
|
||||
break;
|
||||
|
||||
if (checkEndMarkNow && !IS_DUMMY_END_MARKER_POSSIBLE(dummyRes))
|
||||
{
|
||||
(*srcLen) += (unsigned)dummyProcessed - p->tempBufSize;
|
||||
p->tempBufSize = (unsigned)dummyProcessed;
|
||||
// p->remainLen = kMatchSpecLen_Error_Data;
|
||||
RETURN__NOT_FINISHED__FOR_FINISH;
|
||||
}
|
||||
}
|
||||
|
||||
p->buf = p->tempBuf;
|
||||
if (LzmaDec_DecodeReal2(p, dicLimit, p->buf) != 0)
|
||||
return SZ_ERROR_DATA;
|
||||
|
||||
{
|
||||
unsigned kkk = (unsigned)(p->buf - p->tempBuf);
|
||||
if (rem < kkk)
|
||||
return SZ_ERROR_FAIL; /* some internal error */
|
||||
rem -= kkk;
|
||||
if (lookAhead < rem)
|
||||
return SZ_ERROR_FAIL; /* some internal error */
|
||||
lookAhead -= rem;
|
||||
// we decode one symbol from (p->tempBuf) here, so the (bufLimit) is equal to (p->buf)
|
||||
int res = LzmaDec_DecodeReal2(p, dicLimit, p->buf);
|
||||
|
||||
SizeT processed = (SizeT)(p->buf - p->tempBuf);
|
||||
rem = p->tempBufSize;
|
||||
|
||||
if (dummyProcessed < 0)
|
||||
{
|
||||
if (processed > LZMA_REQUIRED_INPUT_MAX)
|
||||
break;
|
||||
if (processed < rem)
|
||||
break;
|
||||
}
|
||||
else if ((unsigned)dummyProcessed != processed)
|
||||
break;
|
||||
|
||||
processed -= rem;
|
||||
|
||||
src += processed;
|
||||
inSize -= processed;
|
||||
(*srcLen) += processed;
|
||||
p->tempBufSize = 0;
|
||||
|
||||
if (res != SZ_OK)
|
||||
{
|
||||
p->remainLen = kMatchSpecLen_Error_Data;
|
||||
return SZ_ERROR_DATA;
|
||||
}
|
||||
}
|
||||
(*srcLen) += (SizeT)lookAhead;
|
||||
src += lookAhead;
|
||||
inSize -= (SizeT)lookAhead;
|
||||
p->tempBufSize = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (p->code != 0)
|
||||
return SZ_ERROR_DATA;
|
||||
*status = LZMA_STATUS_FINISHED_WITH_MARK;
|
||||
return SZ_OK;
|
||||
|
||||
/* Some unexpected error: internal error of code, memory corruption or hardware failure */
|
||||
p->remainLen = kMatchSpecLen_Error_Fail;
|
||||
return SZ_ERROR_FAIL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status)
|
||||
{
|
||||
SizeT outSize = *destLen;
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/* LzmaDec.h -- LZMA Decoder
|
||||
2018-04-21 : Igor Pavlov : Public domain */
|
||||
2020-03-19 : Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef __LZMA_DEC_H
|
||||
#define __LZMA_DEC_H
|
||||
@@ -181,6 +181,7 @@ Returns:
|
||||
LZMA_STATUS_NEEDS_MORE_INPUT
|
||||
LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
|
||||
SZ_ERROR_DATA - Data error
|
||||
SZ_ERROR_FAIL - Some unexpected error: internal error of code, memory corruption or hardware failure
|
||||
*/
|
||||
|
||||
SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit,
|
||||
@@ -223,6 +224,7 @@ Returns:
|
||||
SZ_ERROR_MEM - Memory allocation error
|
||||
SZ_ERROR_UNSUPPORTED - Unsupported properties
|
||||
SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src).
|
||||
SZ_ERROR_FAIL - Some unexpected error: internal error of code, memory corruption or hardware failure
|
||||
*/
|
||||
|
||||
SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
|
||||
+317
-131
@@ -1,5 +1,5 @@
|
||||
/* LzmaEnc.c -- LZMA Encoder
|
||||
2019-01-10: Igor Pavlov : Public domain */
|
||||
2022-07-15: Igor Pavlov : Public domain */
|
||||
|
||||
#include "Precomp.h"
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "CpuArch.h"
|
||||
#include "LzmaEnc.h"
|
||||
|
||||
#include "LzFind.h"
|
||||
@@ -19,12 +20,25 @@
|
||||
#include "LzFindMt.h"
|
||||
#endif
|
||||
|
||||
/* the following LzmaEnc_* declarations is internal LZMA interface for LZMA2 encoder */
|
||||
|
||||
SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, ISeqInStream *inStream, UInt32 keepWindowSize,
|
||||
ISzAllocPtr alloc, ISzAllocPtr allocBig);
|
||||
SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen,
|
||||
UInt32 keepWindowSize, ISzAllocPtr alloc, ISzAllocPtr allocBig);
|
||||
SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit,
|
||||
Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize);
|
||||
const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp);
|
||||
void LzmaEnc_Finish(CLzmaEncHandle pp);
|
||||
void LzmaEnc_SaveState(CLzmaEncHandle pp);
|
||||
void LzmaEnc_RestoreState(CLzmaEncHandle pp);
|
||||
|
||||
#ifdef SHOW_STAT
|
||||
static unsigned g_STAT_OFFSET = 0;
|
||||
#endif
|
||||
|
||||
#define kLzmaMaxHistorySize ((UInt32)3 << 29)
|
||||
/* #define kLzmaMaxHistorySize ((UInt32)7 << 29) */
|
||||
/* for good normalization speed we still reserve 256 MB before 4 GB range */
|
||||
#define kLzmaMaxHistorySize ((UInt32)15 << 28)
|
||||
|
||||
#define kNumTopBits 24
|
||||
#define kTopValue ((UInt32)1 << kNumTopBits)
|
||||
@@ -36,7 +50,7 @@ static unsigned g_STAT_OFFSET = 0;
|
||||
|
||||
#define kNumMoveReducingBits 4
|
||||
#define kNumBitPriceShiftBits 4
|
||||
#define kBitPrice (1 << kNumBitPriceShiftBits)
|
||||
// #define kBitPrice (1 << kNumBitPriceShiftBits)
|
||||
|
||||
#define REP_LEN_COUNT 64
|
||||
|
||||
@@ -47,6 +61,7 @@ void LzmaEncProps_Init(CLzmaEncProps *p)
|
||||
p->reduceSize = (UInt64)(Int64)-1;
|
||||
p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1;
|
||||
p->writeEndMark = 0;
|
||||
p->affinity = 0;
|
||||
}
|
||||
|
||||
void LzmaEncProps_Normalize(CLzmaEncProps *p)
|
||||
@@ -55,16 +70,21 @@ void LzmaEncProps_Normalize(CLzmaEncProps *p)
|
||||
if (level < 0) level = 5;
|
||||
p->level = level;
|
||||
|
||||
if (p->dictSize == 0) p->dictSize = (level <= 5 ? (1 << (level * 2 + 14)) : (level <= 7 ? (1 << 25) : (1 << 26)));
|
||||
if (p->dictSize == 0)
|
||||
p->dictSize =
|
||||
( level <= 3 ? ((UInt32)1 << (level * 2 + 16)) :
|
||||
( level <= 6 ? ((UInt32)1 << (level + 19)) :
|
||||
( level <= 7 ? ((UInt32)1 << 25) : ((UInt32)1 << 26)
|
||||
)));
|
||||
|
||||
if (p->dictSize > p->reduceSize)
|
||||
{
|
||||
unsigned i;
|
||||
UInt32 reduceSize = (UInt32)p->reduceSize;
|
||||
for (i = 11; i <= 30; i++)
|
||||
{
|
||||
if (reduceSize <= ((UInt32)2 << i)) { p->dictSize = ((UInt32)2 << i); break; }
|
||||
if (reduceSize <= ((UInt32)3 << i)) { p->dictSize = ((UInt32)3 << i); break; }
|
||||
}
|
||||
UInt32 v = (UInt32)p->reduceSize;
|
||||
const UInt32 kReduceMin = ((UInt32)1 << 12);
|
||||
if (v < kReduceMin)
|
||||
v = kReduceMin;
|
||||
if (p->dictSize > v)
|
||||
p->dictSize = v;
|
||||
}
|
||||
|
||||
if (p->lc < 0) p->lc = 3;
|
||||
@@ -74,8 +94,8 @@ void LzmaEncProps_Normalize(CLzmaEncProps *p)
|
||||
if (p->algo < 0) p->algo = (level < 5 ? 0 : 1);
|
||||
if (p->fb < 0) p->fb = (level < 7 ? 32 : 64);
|
||||
if (p->btMode < 0) p->btMode = (p->algo == 0 ? 0 : 1);
|
||||
if (p->numHashBytes < 0) p->numHashBytes = 4;
|
||||
if (p->mc == 0) p->mc = (16 + (p->fb >> 1)) >> (p->btMode ? 0 : 1);
|
||||
if (p->numHashBytes < 0) p->numHashBytes = (p->btMode ? 4 : 5);
|
||||
if (p->mc == 0) p->mc = (16 + ((unsigned)p->fb >> 1)) >> (p->btMode ? 0 : 1);
|
||||
|
||||
if (p->numThreads < 0)
|
||||
p->numThreads =
|
||||
@@ -93,18 +113,85 @@ UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2)
|
||||
return props.dictSize;
|
||||
}
|
||||
|
||||
#if (_MSC_VER >= 1400)
|
||||
/* BSR code is fast for some new CPUs */
|
||||
/* #define LZMA_LOG_BSR */
|
||||
|
||||
/*
|
||||
x86/x64:
|
||||
|
||||
BSR:
|
||||
IF (SRC == 0) ZF = 1, DEST is undefined;
|
||||
AMD : DEST is unchanged;
|
||||
IF (SRC != 0) ZF = 0; DEST is index of top non-zero bit
|
||||
BSR is slow in some processors
|
||||
|
||||
LZCNT:
|
||||
IF (SRC == 0) CF = 1, DEST is size_in_bits_of_register(src) (32 or 64)
|
||||
IF (SRC != 0) CF = 0, DEST = num_lead_zero_bits
|
||||
IF (DEST == 0) ZF = 1;
|
||||
|
||||
LZCNT works only in new processors starting from Haswell.
|
||||
if LZCNT is not supported by processor, then it's executed as BSR.
|
||||
LZCNT can be faster than BSR, if supported.
|
||||
*/
|
||||
|
||||
// #define LZMA_LOG_BSR
|
||||
|
||||
#if defined(MY_CPU_ARM_OR_ARM64) /* || defined(MY_CPU_X86_OR_AMD64) */
|
||||
|
||||
#if (defined(__clang__) && (__clang_major__ >= 6)) \
|
||||
|| (defined(__GNUC__) && (__GNUC__ >= 6))
|
||||
#define LZMA_LOG_BSR
|
||||
#elif defined(_MSC_VER) && (_MSC_VER >= 1300)
|
||||
// #if defined(MY_CPU_ARM_OR_ARM64)
|
||||
#define LZMA_LOG_BSR
|
||||
// #endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// #include <intrin.h>
|
||||
|
||||
#ifdef LZMA_LOG_BSR
|
||||
|
||||
#define kDicLogSizeMaxCompress 32
|
||||
#if defined(__clang__) \
|
||||
|| defined(__GNUC__)
|
||||
|
||||
#define BSR2_RET(pos, res) { unsigned long zz; _BitScanReverse(&zz, (pos)); res = (zz + zz) + ((pos >> (zz - 1)) & 1); }
|
||||
/*
|
||||
C code: : (30 - __builtin_clz(x))
|
||||
gcc9/gcc10 for x64 /x86 : 30 - (bsr(x) xor 31)
|
||||
clang10 for x64 : 31 + (bsr(x) xor -32)
|
||||
*/
|
||||
|
||||
static unsigned GetPosSlot1(UInt32 pos)
|
||||
#define MY_clz(x) ((unsigned)__builtin_clz(x))
|
||||
// __lzcnt32
|
||||
// __builtin_ia32_lzcnt_u32
|
||||
|
||||
#else // #if defined(_MSC_VER)
|
||||
|
||||
#ifdef MY_CPU_ARM_OR_ARM64
|
||||
|
||||
#define MY_clz _CountLeadingZeros
|
||||
|
||||
#else // if defined(MY_CPU_X86_OR_AMD64)
|
||||
|
||||
// #define MY_clz __lzcnt // we can use lzcnt (unsupported by old CPU)
|
||||
// _BitScanReverse code is not optimal for some MSVC compilers
|
||||
#define BSR2_RET(pos, res) { unsigned long zz; _BitScanReverse(&zz, (pos)); zz--; \
|
||||
res = (zz + zz) + (pos >> zz); }
|
||||
|
||||
#endif // MY_CPU_X86_OR_AMD64
|
||||
|
||||
#endif // _MSC_VER
|
||||
|
||||
|
||||
#ifndef BSR2_RET
|
||||
|
||||
#define BSR2_RET(pos, res) { unsigned zz = 30 - MY_clz(pos); \
|
||||
res = (zz + zz) + (pos >> zz); }
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
unsigned GetPosSlot1(UInt32 pos);
|
||||
unsigned GetPosSlot1(UInt32 pos)
|
||||
{
|
||||
unsigned res;
|
||||
BSR2_RET(pos, res);
|
||||
@@ -113,10 +200,10 @@ static unsigned GetPosSlot1(UInt32 pos)
|
||||
#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); }
|
||||
#define GetPosSlot(pos, res) { if (pos < 2) res = pos; else BSR2_RET(pos, res); }
|
||||
|
||||
#else
|
||||
|
||||
#define kNumLogBits (9 + sizeof(size_t) / 2)
|
||||
/* #define kNumLogBits (11 + sizeof(size_t) / 8 * 3) */
|
||||
#else // ! LZMA_LOG_BSR
|
||||
|
||||
#define kNumLogBits (11 + sizeof(size_t) / 8 * 3)
|
||||
|
||||
#define kDicLogSizeMaxCompress ((kNumLogBits - 1) * 2 + 7)
|
||||
|
||||
@@ -163,7 +250,7 @@ static void LzmaEnc_FastPosInit(Byte *g_FastPos)
|
||||
#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); }
|
||||
#define GetPosSlot(pos, res) { if (pos < kNumFullDistances) res = p->g_FastPos[pos & (kNumFullDistances - 1)]; else BSR2_RET(pos, res); }
|
||||
|
||||
#endif
|
||||
#endif // LZMA_LOG_BSR
|
||||
|
||||
|
||||
#define LZMA_NUM_REPS 4
|
||||
@@ -193,7 +280,7 @@ typedef struct
|
||||
|
||||
#define kNumLenToPosStates 4
|
||||
#define kNumPosSlotBits 6
|
||||
#define kDicLogSizeMin 0
|
||||
// #define kDicLogSizeMin 0
|
||||
#define kDicLogSizeMax 32
|
||||
#define kDistTableSizeMax (kDicLogSizeMax * 2)
|
||||
|
||||
@@ -299,7 +386,7 @@ typedef UInt32 CProbPrice;
|
||||
typedef struct
|
||||
{
|
||||
void *matchFinderObj;
|
||||
IMatchFinder matchFinder;
|
||||
IMatchFinder2 matchFinder;
|
||||
|
||||
unsigned optCur;
|
||||
unsigned optEnd;
|
||||
@@ -344,10 +431,14 @@ typedef struct
|
||||
// begin of CMatchFinderMt is used in LZ thread
|
||||
CMatchFinderMt matchFinderMt;
|
||||
// end of CMatchFinderMt is used in BT and HASH threads
|
||||
// #else
|
||||
// CMatchFinder matchFinderBase;
|
||||
#endif
|
||||
|
||||
CMatchFinder matchFinderBase;
|
||||
|
||||
|
||||
// we suppose that we have 8-bytes alignment after CMatchFinder
|
||||
|
||||
#ifndef _7ZIP_ST
|
||||
Byte pad[128];
|
||||
#endif
|
||||
@@ -355,8 +446,10 @@ typedef struct
|
||||
// LZ thread
|
||||
CProbPrice ProbPrices[kBitModelTotal >> kNumMoveReducingBits];
|
||||
|
||||
UInt32 matches[LZMA_MATCH_LEN_MAX * 2 + 2 + 1];
|
||||
// we want {len , dist} pairs to be 8-bytes aligned in matches array
|
||||
UInt32 matches[LZMA_MATCH_LEN_MAX * 2 + 2];
|
||||
|
||||
// we want 8-bytes alignment here
|
||||
UInt32 alignPrices[kAlignTableSize];
|
||||
UInt32 posSlotPrices[kNumLenToPosStates][kDistTableSizeMax];
|
||||
UInt32 distancesPrices[kNumLenToPosStates][kNumFullDistances];
|
||||
@@ -385,12 +478,19 @@ typedef struct
|
||||
|
||||
CSaveState saveState;
|
||||
|
||||
// BoolInt mf_Failure;
|
||||
#ifndef _7ZIP_ST
|
||||
Byte pad2[128];
|
||||
#endif
|
||||
} CLzmaEnc;
|
||||
|
||||
|
||||
#define MFB (p->matchFinderBase)
|
||||
/*
|
||||
#ifndef _7ZIP_ST
|
||||
#define MFB (p->matchFinderMt.MatchFinder)
|
||||
#endif
|
||||
*/
|
||||
|
||||
#define COPY_ARR(dest, src, arr) memcpy(dest->arr, src->arr, sizeof(src->arr));
|
||||
|
||||
@@ -455,41 +555,51 @@ SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2)
|
||||
|
||||
if (props.lc > LZMA_LC_MAX
|
||||
|| props.lp > LZMA_LP_MAX
|
||||
|| props.pb > LZMA_PB_MAX
|
||||
|| props.dictSize > ((UInt64)1 << kDicLogSizeMaxCompress)
|
||||
|| props.dictSize > kLzmaMaxHistorySize)
|
||||
|| props.pb > LZMA_PB_MAX)
|
||||
return SZ_ERROR_PARAM;
|
||||
|
||||
|
||||
if (props.dictSize > kLzmaMaxHistorySize)
|
||||
props.dictSize = kLzmaMaxHistorySize;
|
||||
|
||||
#ifndef LZMA_LOG_BSR
|
||||
{
|
||||
const UInt64 dict64 = props.dictSize;
|
||||
if (dict64 > ((UInt64)1 << kDicLogSizeMaxCompress))
|
||||
return SZ_ERROR_PARAM;
|
||||
}
|
||||
#endif
|
||||
|
||||
p->dictSize = props.dictSize;
|
||||
{
|
||||
unsigned fb = props.fb;
|
||||
unsigned fb = (unsigned)props.fb;
|
||||
if (fb < 5)
|
||||
fb = 5;
|
||||
if (fb > LZMA_MATCH_LEN_MAX)
|
||||
fb = LZMA_MATCH_LEN_MAX;
|
||||
p->numFastBytes = fb;
|
||||
}
|
||||
p->lc = props.lc;
|
||||
p->lp = props.lp;
|
||||
p->pb = props.pb;
|
||||
p->lc = (unsigned)props.lc;
|
||||
p->lp = (unsigned)props.lp;
|
||||
p->pb = (unsigned)props.pb;
|
||||
p->fastMode = (props.algo == 0);
|
||||
// p->_maxMode = True;
|
||||
p->matchFinderBase.btMode = (Byte)(props.btMode ? 1 : 0);
|
||||
MFB.btMode = (Byte)(props.btMode ? 1 : 0);
|
||||
{
|
||||
unsigned numHashBytes = 4;
|
||||
if (props.btMode)
|
||||
{
|
||||
if (props.numHashBytes < 2)
|
||||
numHashBytes = 2;
|
||||
else if (props.numHashBytes < 4)
|
||||
numHashBytes = props.numHashBytes;
|
||||
if (props.numHashBytes < 2) numHashBytes = 2;
|
||||
else if (props.numHashBytes < 4) numHashBytes = (unsigned)props.numHashBytes;
|
||||
}
|
||||
p->matchFinderBase.numHashBytes = numHashBytes;
|
||||
if (props.numHashBytes >= 5) numHashBytes = 5;
|
||||
|
||||
MFB.numHashBytes = numHashBytes;
|
||||
}
|
||||
|
||||
p->matchFinderBase.cutValue = props.mc;
|
||||
MFB.cutValue = props.mc;
|
||||
|
||||
p->writeEndMark = props.writeEndMark;
|
||||
p->writeEndMark = (BoolInt)props.writeEndMark;
|
||||
|
||||
#ifndef _7ZIP_ST
|
||||
/*
|
||||
@@ -500,6 +610,8 @@ SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2)
|
||||
}
|
||||
*/
|
||||
p->multiThread = (props.numThreads > 1);
|
||||
p->matchFinderMt.btSync.affinity =
|
||||
p->matchFinderMt.hashSync.affinity = props.affinity;
|
||||
#endif
|
||||
|
||||
return SZ_OK;
|
||||
@@ -509,7 +621,7 @@ SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2)
|
||||
void LzmaEnc_SetDataSize(CLzmaEncHandle pp, UInt64 expectedDataSiize)
|
||||
{
|
||||
CLzmaEnc *p = (CLzmaEnc *)pp;
|
||||
p->matchFinderBase.expectedDataSize = expectedDataSiize;
|
||||
MFB.expectedDataSize = expectedDataSiize;
|
||||
}
|
||||
|
||||
|
||||
@@ -536,8 +648,8 @@ static void RangeEnc_Construct(CRangeEnc *p)
|
||||
p->bufBase = NULL;
|
||||
}
|
||||
|
||||
#define RangeEnc_GetProcessed(p) ((p)->processed + ((p)->buf - (p)->bufBase) + (p)->cacheSize)
|
||||
#define RangeEnc_GetProcessed_sizet(p) ((size_t)(p)->processed + ((p)->buf - (p)->bufBase) + (size_t)(p)->cacheSize)
|
||||
#define RangeEnc_GetProcessed(p) ( (p)->processed + (size_t)((p)->buf - (p)->bufBase) + (p)->cacheSize)
|
||||
#define RangeEnc_GetProcessed_sizet(p) ((size_t)(p)->processed + (size_t)((p)->buf - (p)->bufBase) + (size_t)(p)->cacheSize)
|
||||
|
||||
#define RC_BUF_SIZE (1 << 16)
|
||||
|
||||
@@ -556,12 +668,11 @@ static int RangeEnc_Alloc(CRangeEnc *p, ISzAllocPtr alloc)
|
||||
static void RangeEnc_Free(CRangeEnc *p, ISzAllocPtr alloc)
|
||||
{
|
||||
ISzAlloc_Free(alloc, p->bufBase);
|
||||
p->bufBase = 0;
|
||||
p->bufBase = NULL;
|
||||
}
|
||||
|
||||
static void RangeEnc_Init(CRangeEnc *p)
|
||||
{
|
||||
/* Stream.Init(); */
|
||||
p->range = 0xFFFFFFFF;
|
||||
p->cache = 0;
|
||||
p->low = 0;
|
||||
@@ -575,12 +686,12 @@ static void RangeEnc_Init(CRangeEnc *p)
|
||||
|
||||
MY_NO_INLINE static void RangeEnc_FlushStream(CRangeEnc *p)
|
||||
{
|
||||
size_t num;
|
||||
if (p->res != SZ_OK)
|
||||
return;
|
||||
num = p->buf - p->bufBase;
|
||||
if (num != ISeqOutStream_Write(p->outStream, p->bufBase, num))
|
||||
p->res = SZ_ERROR_WRITE;
|
||||
const size_t num = (size_t)(p->buf - p->bufBase);
|
||||
if (p->res == SZ_OK)
|
||||
{
|
||||
if (num != ISeqOutStream_Write(p->outStream, p->bufBase, num))
|
||||
p->res = SZ_ERROR_WRITE;
|
||||
}
|
||||
p->processed += num;
|
||||
p->buf = p->bufBase;
|
||||
}
|
||||
@@ -656,7 +767,7 @@ static void RangeEnc_FlushData(CRangeEnc *p)
|
||||
range += newBound & mask; \
|
||||
mask &= (kBitModelTotal - ((1 << kNumMoveBits) - 1)); \
|
||||
mask += ((1 << kNumMoveBits) - 1); \
|
||||
ttt += (Int32)(mask - ttt) >> kNumMoveBits; \
|
||||
ttt += (UInt32)((Int32)(mask - ttt) >> kNumMoveBits); \
|
||||
*(prob) = (CLzmaProb)ttt; \
|
||||
RC_NORM(p) \
|
||||
}
|
||||
@@ -749,7 +860,7 @@ static void LzmaEnc_InitPriceTables(CProbPrice *ProbPrices)
|
||||
bitCount++;
|
||||
}
|
||||
}
|
||||
ProbPrices[i] = (CProbPrice)((kNumBitModelTotalBits << kCyclesBits) - 15 - bitCount);
|
||||
ProbPrices[i] = (CProbPrice)(((unsigned)kNumBitModelTotalBits << kCyclesBits) - 15 - bitCount);
|
||||
// printf("\n%3d: %5d", i, ProbPrices[i]);
|
||||
}
|
||||
}
|
||||
@@ -985,7 +1096,11 @@ static unsigned ReadMatchDistances(CLzmaEnc *p, unsigned *numPairsRes)
|
||||
|
||||
p->additionalOffset++;
|
||||
p->numAvail = p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
|
||||
numPairs = p->matchFinder.GetMatches(p->matchFinderObj, p->matches);
|
||||
{
|
||||
const UInt32 *d = p->matchFinder.GetMatches(p->matchFinderObj, p->matches);
|
||||
// if (!d) { p->mf_Failure = True; *numPairsRes = 0; return 0; }
|
||||
numPairs = (unsigned)(d - p->matches);
|
||||
}
|
||||
*numPairsRes = numPairs;
|
||||
|
||||
#ifdef SHOW_STAT
|
||||
@@ -1001,7 +1116,7 @@ static unsigned ReadMatchDistances(CLzmaEnc *p, unsigned *numPairsRes)
|
||||
if (numPairs == 0)
|
||||
return 0;
|
||||
{
|
||||
unsigned len = p->matches[(size_t)numPairs - 2];
|
||||
const unsigned len = p->matches[(size_t)numPairs - 2];
|
||||
if (len != p->numFastBytes)
|
||||
return len;
|
||||
{
|
||||
@@ -1011,7 +1126,7 @@ static unsigned ReadMatchDistances(CLzmaEnc *p, unsigned *numPairsRes)
|
||||
{
|
||||
const Byte *p1 = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - 1;
|
||||
const Byte *p2 = p1 + len;
|
||||
ptrdiff_t dif = (ptrdiff_t)-1 - p->matches[(size_t)numPairs - 1];
|
||||
const ptrdiff_t dif = (ptrdiff_t)-1 - (ptrdiff_t)p->matches[(size_t)numPairs - 1];
|
||||
const Byte *lim = p1 + numAvail;
|
||||
for (; p2 != lim && *p2 == p2[dif]; p2++)
|
||||
{}
|
||||
@@ -1167,6 +1282,8 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position)
|
||||
repLens[i] = len;
|
||||
if (len > repLens[repMaxIndex])
|
||||
repMaxIndex = i;
|
||||
if (len == LZMA_MATCH_LEN_MAX) // 21.03 : optimization
|
||||
break;
|
||||
}
|
||||
|
||||
if (repLens[repMaxIndex] >= p->numFastBytes)
|
||||
@@ -1179,10 +1296,12 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position)
|
||||
}
|
||||
|
||||
matches = p->matches;
|
||||
#define MATCHES matches
|
||||
// #define MATCHES p->matches
|
||||
|
||||
if (mainLen >= p->numFastBytes)
|
||||
{
|
||||
p->backRes = matches[(size_t)numPairs - 1] + LZMA_NUM_REPS;
|
||||
p->backRes = MATCHES[(size_t)numPairs - 1] + LZMA_NUM_REPS;
|
||||
MOVE_POS(p, mainLen - 1)
|
||||
return mainLen;
|
||||
}
|
||||
@@ -1276,13 +1395,13 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position)
|
||||
if (len < 2)
|
||||
len = 2;
|
||||
else
|
||||
while (len > matches[offs])
|
||||
while (len > MATCHES[offs])
|
||||
offs += 2;
|
||||
|
||||
for (; ; len++)
|
||||
{
|
||||
COptimal *opt;
|
||||
UInt32 dist = matches[(size_t)offs + 1];
|
||||
UInt32 dist = MATCHES[(size_t)offs + 1];
|
||||
UInt32 price = normalMatchPrice + GET_PRICE_LEN(&p->lenEnc, posState, len);
|
||||
unsigned lenToPosState = GetLenToPosState(len);
|
||||
|
||||
@@ -1306,7 +1425,7 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position)
|
||||
opt->extra = 0;
|
||||
}
|
||||
|
||||
if (len == matches[offs])
|
||||
if (len == MATCHES[offs])
|
||||
{
|
||||
offs += 2;
|
||||
if (offs == numPairs)
|
||||
@@ -1727,8 +1846,8 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position)
|
||||
if (newLen > numAvail)
|
||||
{
|
||||
newLen = numAvail;
|
||||
for (numPairs = 0; newLen > matches[numPairs]; numPairs += 2);
|
||||
matches[numPairs] = (UInt32)newLen;
|
||||
for (numPairs = 0; newLen > MATCHES[numPairs]; numPairs += 2);
|
||||
MATCHES[numPairs] = (UInt32)newLen;
|
||||
numPairs += 2;
|
||||
}
|
||||
|
||||
@@ -1747,9 +1866,9 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position)
|
||||
}
|
||||
|
||||
offs = 0;
|
||||
while (startLen > matches[offs])
|
||||
while (startLen > MATCHES[offs])
|
||||
offs += 2;
|
||||
dist = matches[(size_t)offs + 1];
|
||||
dist = MATCHES[(size_t)offs + 1];
|
||||
|
||||
// if (dist >= kNumFullDistances)
|
||||
GetPosSlot2(dist, posSlot);
|
||||
@@ -1776,7 +1895,7 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position)
|
||||
}
|
||||
}
|
||||
|
||||
if (len == matches[offs])
|
||||
if (len == MATCHES[offs])
|
||||
{
|
||||
// if (p->_maxMode) {
|
||||
// MATCH : LIT : REP_0
|
||||
@@ -1841,7 +1960,7 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position)
|
||||
offs += 2;
|
||||
if (offs == numPairs)
|
||||
break;
|
||||
dist = matches[(size_t)offs + 1];
|
||||
dist = MATCHES[(size_t)offs + 1];
|
||||
// if (dist >= kNumFullDistances)
|
||||
GetPosSlot2(dist, posSlot);
|
||||
}
|
||||
@@ -2059,8 +2178,23 @@ static SRes CheckErrors(CLzmaEnc *p)
|
||||
return p->result;
|
||||
if (p->rc.res != SZ_OK)
|
||||
p->result = SZ_ERROR_WRITE;
|
||||
if (p->matchFinderBase.result != SZ_OK)
|
||||
|
||||
#ifndef _7ZIP_ST
|
||||
if (
|
||||
// p->mf_Failure ||
|
||||
(p->mtMode &&
|
||||
( // p->matchFinderMt.failure_LZ_LZ ||
|
||||
p->matchFinderMt.failure_LZ_BT))
|
||||
)
|
||||
{
|
||||
p->result = MY_HRES_ERROR__INTERNAL_ERROR;
|
||||
// printf("\nCheckErrors p->matchFinderMt.failureLZ\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (MFB.result != SZ_OK)
|
||||
p->result = SZ_ERROR_READ;
|
||||
|
||||
if (p->result != SZ_OK)
|
||||
p->finished = True;
|
||||
return p->result;
|
||||
@@ -2198,14 +2332,14 @@ MY_NO_INLINE static void FillDistancesPrices(CLzmaEnc *p)
|
||||
|
||||
|
||||
|
||||
void LzmaEnc_Construct(CLzmaEnc *p)
|
||||
static void LzmaEnc_Construct(CLzmaEnc *p)
|
||||
{
|
||||
RangeEnc_Construct(&p->rc);
|
||||
MatchFinder_Construct(&p->matchFinderBase);
|
||||
MatchFinder_Construct(&MFB);
|
||||
|
||||
#ifndef _7ZIP_ST
|
||||
p->matchFinderMt.MatchFinder = &MFB;
|
||||
MatchFinderMt_Construct(&p->matchFinderMt);
|
||||
p->matchFinderMt.MatchFinder = &p->matchFinderBase;
|
||||
#endif
|
||||
|
||||
{
|
||||
@@ -2221,7 +2355,6 @@ void LzmaEnc_Construct(CLzmaEnc *p)
|
||||
LzmaEnc_InitPriceTables(p->ProbPrices);
|
||||
p->litProbs = NULL;
|
||||
p->saveState.litProbs = NULL;
|
||||
|
||||
}
|
||||
|
||||
CLzmaEncHandle LzmaEnc_Create(ISzAllocPtr alloc)
|
||||
@@ -2233,7 +2366,7 @@ CLzmaEncHandle LzmaEnc_Create(ISzAllocPtr alloc)
|
||||
return p;
|
||||
}
|
||||
|
||||
void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAllocPtr alloc)
|
||||
static void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAllocPtr alloc)
|
||||
{
|
||||
ISzAlloc_Free(alloc, p->litProbs);
|
||||
ISzAlloc_Free(alloc, p->saveState.litProbs);
|
||||
@@ -2241,13 +2374,13 @@ void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAllocPtr alloc)
|
||||
p->saveState.litProbs = NULL;
|
||||
}
|
||||
|
||||
void LzmaEnc_Destruct(CLzmaEnc *p, ISzAllocPtr alloc, ISzAllocPtr allocBig)
|
||||
static void LzmaEnc_Destruct(CLzmaEnc *p, ISzAllocPtr alloc, ISzAllocPtr allocBig)
|
||||
{
|
||||
#ifndef _7ZIP_ST
|
||||
MatchFinderMt_Destruct(&p->matchFinderMt, allocBig);
|
||||
#endif
|
||||
|
||||
MatchFinder_Free(&p->matchFinderBase, allocBig);
|
||||
MatchFinder_Free(&MFB, allocBig);
|
||||
LzmaEnc_FreeLits(p, alloc);
|
||||
RangeEnc_Free(&p->rc, alloc);
|
||||
}
|
||||
@@ -2259,11 +2392,18 @@ void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAllocPtr alloc, ISzAllocPtr allocBig)
|
||||
}
|
||||
|
||||
|
||||
MY_NO_INLINE
|
||||
static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, UInt32 maxPackSize, UInt32 maxUnpackSize)
|
||||
{
|
||||
UInt32 nowPos32, startPos32;
|
||||
if (p->needInit)
|
||||
{
|
||||
#ifndef _7ZIP_ST
|
||||
if (p->mtMode)
|
||||
{
|
||||
RINOK(MatchFinderMt_InitMt(&p->matchFinderMt));
|
||||
}
|
||||
#endif
|
||||
p->matchFinder.Init(p->matchFinderObj);
|
||||
p->needInit = 0;
|
||||
}
|
||||
@@ -2521,12 +2661,12 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, UInt32 maxPackSize, UInt32 maxUnpa
|
||||
// { int y; for (y = 0; y < 100; y++) {
|
||||
FillDistancesPrices(p);
|
||||
// }}
|
||||
LenPriceEnc_UpdateTables(&p->lenEnc, 1 << p->pb, &p->lenProbs, p->ProbPrices);
|
||||
LenPriceEnc_UpdateTables(&p->lenEnc, (unsigned)1 << p->pb, &p->lenProbs, p->ProbPrices);
|
||||
}
|
||||
if (p->repLenEncCounter <= 0)
|
||||
{
|
||||
p->repLenEncCounter = REP_LEN_COUNT;
|
||||
LenPriceEnc_UpdateTables(&p->repLenEnc, 1 << p->pb, &p->repLenProbs, p->ProbPrices);
|
||||
LenPriceEnc_UpdateTables(&p->repLenEnc, (unsigned)1 << p->pb, &p->repLenProbs, p->ProbPrices);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2559,11 +2699,13 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, UInt32 maxPackSize, UInt32 maxUnpa
|
||||
static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAllocPtr alloc, ISzAllocPtr allocBig)
|
||||
{
|
||||
UInt32 beforeSize = kNumOpts;
|
||||
UInt32 dictSize;
|
||||
|
||||
if (!RangeEnc_Alloc(&p->rc, alloc))
|
||||
return SZ_ERROR_MEM;
|
||||
|
||||
#ifndef _7ZIP_ST
|
||||
p->mtMode = (p->multiThread && !p->fastMode && (p->matchFinderBase.btMode != 0));
|
||||
p->mtMode = (p->multiThread && !p->fastMode && (MFB.btMode != 0));
|
||||
#endif
|
||||
|
||||
{
|
||||
@@ -2582,36 +2724,56 @@ static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAllocPtr alloc,
|
||||
}
|
||||
}
|
||||
|
||||
p->matchFinderBase.bigHash = (Byte)(p->dictSize > kBigHashDicLimit ? 1 : 0);
|
||||
MFB.bigHash = (Byte)(p->dictSize > kBigHashDicLimit ? 1 : 0);
|
||||
|
||||
if (beforeSize + p->dictSize < keepWindowSize)
|
||||
beforeSize = keepWindowSize - p->dictSize;
|
||||
|
||||
dictSize = p->dictSize;
|
||||
if (dictSize == ((UInt32)2 << 30) ||
|
||||
dictSize == ((UInt32)3 << 30))
|
||||
{
|
||||
/* 21.03 : here we reduce the dictionary for 2 reasons:
|
||||
1) we don't want 32-bit back_distance matches in decoder for 2 GB dictionary.
|
||||
2) we want to elimate useless last MatchFinder_Normalize3() for corner cases,
|
||||
where data size is aligned for 1 GB: 5/6/8 GB.
|
||||
That reducing must be >= 1 for such corner cases. */
|
||||
dictSize -= 1;
|
||||
}
|
||||
|
||||
if (beforeSize + dictSize < keepWindowSize)
|
||||
beforeSize = keepWindowSize - dictSize;
|
||||
|
||||
/* in worst case we can look ahead for
|
||||
max(LZMA_MATCH_LEN_MAX, numFastBytes + 1 + numFastBytes) bytes.
|
||||
we send larger value for (keepAfter) to MantchFinder_Create():
|
||||
(numFastBytes + LZMA_MATCH_LEN_MAX + 1)
|
||||
*/
|
||||
|
||||
#ifndef _7ZIP_ST
|
||||
if (p->mtMode)
|
||||
{
|
||||
RINOK(MatchFinderMt_Create(&p->matchFinderMt, p->dictSize, beforeSize, p->numFastBytes,
|
||||
LZMA_MATCH_LEN_MAX
|
||||
+ 1 /* 18.04 */
|
||||
RINOK(MatchFinderMt_Create(&p->matchFinderMt, dictSize, beforeSize,
|
||||
p->numFastBytes, LZMA_MATCH_LEN_MAX + 1 /* 18.04 */
|
||||
, allocBig));
|
||||
p->matchFinderObj = &p->matchFinderMt;
|
||||
p->matchFinderBase.bigHash = (Byte)(
|
||||
(p->dictSize > kBigHashDicLimit && p->matchFinderBase.hashMask >= 0xFFFFFF) ? 1 : 0);
|
||||
MFB.bigHash = (Byte)(
|
||||
(p->dictSize > kBigHashDicLimit && MFB.hashMask >= 0xFFFFFF) ? 1 : 0);
|
||||
MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (!MatchFinder_Create(&p->matchFinderBase, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig))
|
||||
if (!MatchFinder_Create(&MFB, dictSize, beforeSize,
|
||||
p->numFastBytes, LZMA_MATCH_LEN_MAX + 1 /* 21.03 */
|
||||
, allocBig))
|
||||
return SZ_ERROR_MEM;
|
||||
p->matchFinderObj = &p->matchFinderBase;
|
||||
MatchFinder_CreateVTable(&p->matchFinderBase, &p->matchFinder);
|
||||
p->matchFinderObj = &MFB;
|
||||
MatchFinder_CreateVTable(&MFB, &p->matchFinder);
|
||||
}
|
||||
|
||||
return SZ_OK;
|
||||
}
|
||||
|
||||
void LzmaEnc_Init(CLzmaEnc *p)
|
||||
static void LzmaEnc_Init(CLzmaEnc *p)
|
||||
{
|
||||
unsigned i;
|
||||
p->state = 0;
|
||||
@@ -2675,12 +2837,14 @@ void LzmaEnc_Init(CLzmaEnc *p)
|
||||
|
||||
p->additionalOffset = 0;
|
||||
|
||||
p->pbMask = (1 << p->pb) - 1;
|
||||
p->pbMask = ((unsigned)1 << p->pb) - 1;
|
||||
p->lpMask = ((UInt32)0x100 << p->lp) - ((unsigned)0x100 >> p->lc);
|
||||
|
||||
// p->mf_Failure = False;
|
||||
}
|
||||
|
||||
|
||||
void LzmaEnc_InitPrices(CLzmaEnc *p)
|
||||
static void LzmaEnc_InitPrices(CLzmaEnc *p)
|
||||
{
|
||||
if (!p->fastMode)
|
||||
{
|
||||
@@ -2694,8 +2858,8 @@ void LzmaEnc_InitPrices(CLzmaEnc *p)
|
||||
|
||||
p->repLenEncCounter = REP_LEN_COUNT;
|
||||
|
||||
LenPriceEnc_UpdateTables(&p->lenEnc, 1 << p->pb, &p->lenProbs, p->ProbPrices);
|
||||
LenPriceEnc_UpdateTables(&p->repLenEnc, 1 << p->pb, &p->repLenProbs, p->ProbPrices);
|
||||
LenPriceEnc_UpdateTables(&p->lenEnc, (unsigned)1 << p->pb, &p->lenProbs, p->ProbPrices);
|
||||
LenPriceEnc_UpdateTables(&p->repLenEnc, (unsigned)1 << p->pb, &p->repLenProbs, p->ProbPrices);
|
||||
}
|
||||
|
||||
static SRes LzmaEnc_AllocAndInit(CLzmaEnc *p, UInt32 keepWindowSize, ISzAllocPtr alloc, ISzAllocPtr allocBig)
|
||||
@@ -2719,7 +2883,7 @@ static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInS
|
||||
ISzAllocPtr alloc, ISzAllocPtr allocBig)
|
||||
{
|
||||
CLzmaEnc *p = (CLzmaEnc *)pp;
|
||||
p->matchFinderBase.stream = inStream;
|
||||
MFB.stream = inStream;
|
||||
p->needInit = 1;
|
||||
p->rc.outStream = outStream;
|
||||
return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig);
|
||||
@@ -2730,16 +2894,16 @@ SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp,
|
||||
ISzAllocPtr alloc, ISzAllocPtr allocBig)
|
||||
{
|
||||
CLzmaEnc *p = (CLzmaEnc *)pp;
|
||||
p->matchFinderBase.stream = inStream;
|
||||
MFB.stream = inStream;
|
||||
p->needInit = 1;
|
||||
return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
|
||||
}
|
||||
|
||||
static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen)
|
||||
{
|
||||
p->matchFinderBase.directInput = 1;
|
||||
p->matchFinderBase.bufferBase = (Byte *)src;
|
||||
p->matchFinderBase.directInputRem = srcLen;
|
||||
MFB.directInput = 1;
|
||||
MFB.bufferBase = (Byte *)src;
|
||||
MFB.directInputRem = srcLen;
|
||||
}
|
||||
|
||||
SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen,
|
||||
@@ -2781,19 +2945,23 @@ static size_t SeqOutStreamBuf_Write(const ISeqOutStream *pp, const void *data, s
|
||||
size = p->rem;
|
||||
p->overflow = True;
|
||||
}
|
||||
memcpy(p->data, data, size);
|
||||
p->rem -= size;
|
||||
p->data += size;
|
||||
if (size != 0)
|
||||
{
|
||||
memcpy(p->data, data, size);
|
||||
p->rem -= size;
|
||||
p->data += size;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp)
|
||||
{
|
||||
const CLzmaEnc *p = (CLzmaEnc *)pp;
|
||||
return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp)
|
||||
{
|
||||
@@ -2802,6 +2970,7 @@ const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp)
|
||||
}
|
||||
|
||||
|
||||
// (desiredPackSize == 0) is not allowed
|
||||
SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit,
|
||||
Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize)
|
||||
{
|
||||
@@ -2822,14 +2991,10 @@ SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit,
|
||||
if (reInit)
|
||||
LzmaEnc_Init(p);
|
||||
LzmaEnc_InitPrices(p);
|
||||
|
||||
nowPos64 = p->nowPos64;
|
||||
RangeEnc_Init(&p->rc);
|
||||
p->rc.outStream = &outStream.vt;
|
||||
|
||||
if (desiredPackSize == 0)
|
||||
return SZ_ERROR_OUTPUT_EOF;
|
||||
|
||||
nowPos64 = p->nowPos64;
|
||||
|
||||
res = LzmaEnc_CodeOneBlock(p, desiredPackSize, *unpackSize);
|
||||
|
||||
*unpackSize = (UInt32)(p->nowPos64 - nowPos64);
|
||||
@@ -2841,6 +3006,7 @@ SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit,
|
||||
}
|
||||
|
||||
|
||||
MY_NO_INLINE
|
||||
static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress)
|
||||
{
|
||||
SRes res = SZ_OK;
|
||||
@@ -2870,7 +3036,7 @@ static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress)
|
||||
LzmaEnc_Finish(p);
|
||||
|
||||
/*
|
||||
if (res == SZ_OK && !Inline_MatchFinder_IsFinishedOK(&p->matchFinderBase))
|
||||
if (res == SZ_OK && !Inline_MatchFinder_IsFinishedOK(&MFB))
|
||||
res = SZ_ERROR_FAIL;
|
||||
}
|
||||
*/
|
||||
@@ -2889,35 +3055,43 @@ SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *i
|
||||
|
||||
SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size)
|
||||
{
|
||||
CLzmaEnc *p = (CLzmaEnc *)pp;
|
||||
unsigned i;
|
||||
UInt32 dictSize = p->dictSize;
|
||||
if (*size < LZMA_PROPS_SIZE)
|
||||
return SZ_ERROR_PARAM;
|
||||
*size = LZMA_PROPS_SIZE;
|
||||
props[0] = (Byte)((p->pb * 5 + p->lp) * 9 + p->lc);
|
||||
|
||||
if (dictSize >= ((UInt32)1 << 22))
|
||||
{
|
||||
UInt32 kDictMask = ((UInt32)1 << 20) - 1;
|
||||
if (dictSize < (UInt32)0xFFFFFFFF - kDictMask)
|
||||
dictSize = (dictSize + kDictMask) & ~kDictMask;
|
||||
}
|
||||
else for (i = 11; i <= 30; i++)
|
||||
{
|
||||
if (dictSize <= ((UInt32)2 << i)) { dictSize = (2 << i); break; }
|
||||
if (dictSize <= ((UInt32)3 << i)) { dictSize = (3 << i); break; }
|
||||
}
|
||||
const CLzmaEnc *p = (const CLzmaEnc *)pp;
|
||||
const UInt32 dictSize = p->dictSize;
|
||||
UInt32 v;
|
||||
props[0] = (Byte)((p->pb * 5 + p->lp) * 9 + p->lc);
|
||||
|
||||
// we write aligned dictionary value to properties for lzma decoder
|
||||
if (dictSize >= ((UInt32)1 << 21))
|
||||
{
|
||||
const UInt32 kDictMask = ((UInt32)1 << 20) - 1;
|
||||
v = (dictSize + kDictMask) & ~kDictMask;
|
||||
if (v < dictSize)
|
||||
v = dictSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned i = 11 * 2;
|
||||
do
|
||||
{
|
||||
v = (UInt32)(2 + (i & 1)) << (i >> 1);
|
||||
i++;
|
||||
}
|
||||
while (v < dictSize);
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
props[1 + i] = (Byte)(dictSize >> (8 * i));
|
||||
return SZ_OK;
|
||||
SetUi32(props + 1, v);
|
||||
return SZ_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
unsigned LzmaEnc_IsWriteEndMark(CLzmaEncHandle pp)
|
||||
{
|
||||
return ((CLzmaEnc *)pp)->writeEndMark;
|
||||
return (unsigned)((CLzmaEnc *)pp)->writeEndMark;
|
||||
}
|
||||
|
||||
|
||||
@@ -2974,3 +3148,15 @@ SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
|
||||
LzmaEnc_Destroy(p, alloc, allocBig);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
#ifndef _7ZIP_ST
|
||||
void LzmaEnc_GetLzThreads(CLzmaEncHandle pp, HANDLE lz_threads[2])
|
||||
{
|
||||
const CLzmaEnc *p = (CLzmaEnc *)pp;
|
||||
lz_threads[0] = p->matchFinderMt.hashSync.thread;
|
||||
lz_threads[1] = p->matchFinderMt.btSync.thread;
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/* LzmaEnc.h -- LZMA Encoder
|
||||
2017-07-27 : Igor Pavlov : Public domain */
|
||||
2019-10-30 : Igor Pavlov : Public domain */
|
||||
|
||||
#ifndef __LZMA_ENC_H
|
||||
#define __LZMA_ENC_H
|
||||
@@ -29,6 +29,8 @@ typedef struct _CLzmaEncProps
|
||||
|
||||
UInt64 reduceSize; /* estimated size of data that will be compressed. default = (UInt64)(Int64)-1.
|
||||
Encoder uses this value to reduce dictionary size */
|
||||
|
||||
UInt64 affinity;
|
||||
} CLzmaEncProps;
|
||||
|
||||
void LzmaEncProps_Init(CLzmaEncProps *p);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user