├── .editorconfig ├── .gitattributes ├── .github └── workflows │ └── main.yml ├── .gitignore ├── CHANGELOG.md ├── CHANGELOG.md.meta ├── LICENSE.md ├── LICENSE.md.meta ├── Tests.meta ├── Tests ├── Tests.meta ├── Tests │ ├── Shared.meta │ └── Shared │ │ ├── FpTestUtils.cs │ │ ├── FpTestUtils.cs.meta │ │ ├── TestFp2.gen.cs │ │ ├── TestFp2.gen.cs.meta │ │ ├── TestFp2x2.gen.cs │ │ ├── TestFp2x2.gen.cs.meta │ │ ├── TestFp2x3.gen.cs │ │ ├── TestFp2x3.gen.cs.meta │ │ ├── TestFp2x4.gen.cs │ │ ├── TestFp2x4.gen.cs.meta │ │ ├── TestFp3.gen.cs │ │ ├── TestFp3.gen.cs.meta │ │ ├── TestFp3x2.gen.cs │ │ ├── TestFp3x2.gen.cs.meta │ │ ├── TestFp3x3.gen.cs │ │ ├── TestFp3x3.gen.cs.meta │ │ ├── TestFp3x4.gen.cs │ │ ├── TestFp3x4.gen.cs.meta │ │ ├── TestFp4.gen.cs │ │ ├── TestFp4.gen.cs.meta │ │ ├── TestFp4x2.gen.cs │ │ ├── TestFp4x2.gen.cs.meta │ │ ├── TestFp4x3.gen.cs │ │ ├── TestFp4x3.gen.cs.meta │ │ ├── TestFp4x4.gen.cs │ │ ├── TestFp4x4.gen.cs.meta │ │ ├── TestMath.gen.cs │ │ ├── TestMath.gen.cs.meta │ │ ├── TestUtils.cs │ │ └── TestUtils.cs.meta ├── Unity.Mathematics.Tests.asmdef ├── Unity.Mathematics.Tests.asmdef.meta ├── packages.config └── packages.config.meta ├── Unity.Mathematics.FixedPoint.CodeGen.meta ├── Unity.Mathematics.FixedPoint.CodeGen ├── Program.cs ├── Program.cs.meta ├── Properties.meta ├── Properties │ ├── AssemblyInfo.cs │ └── AssemblyInfo.cs.meta ├── Unity.Mathematics.CodeGen.csproj ├── Unity.Mathematics.CodeGen.csproj.meta ├── VectorGenerator.cs └── VectorGenerator.cs.meta ├── Unity.Mathematics.FixedPoint.meta ├── Unity.Mathematics.FixedPoint ├── Unity.Mathematics.FixedPoint.asmdef ├── Unity.Mathematics.FixedPoint.asmdef.meta ├── fp.meta ├── fp │ ├── LICENSE.txt │ ├── LICENSE.txt.meta │ ├── README.txt │ ├── README.txt.meta │ ├── fp.cs │ ├── fp.cs.meta │ ├── fp_sin_lut.cs │ ├── fp_sin_lut.cs.meta │ ├── fp_tan_lut.cs │ └── fp_tan_lut.cs.meta ├── fp2.gen.cs ├── fp2.gen.cs.meta ├── fp2x2.gen.cs ├── fp2x2.gen.cs.meta ├── fp2x3.gen.cs ├── fp2x3.gen.cs.meta ├── fp2x4.gen.cs ├── fp2x4.gen.cs.meta ├── fp3.gen.cs ├── fp3.gen.cs.meta ├── fp3x2.gen.cs ├── fp3x2.gen.cs.meta ├── fp3x3.gen.cs ├── fp3x3.gen.cs.meta ├── fp3x4.gen.cs ├── fp3x4.gen.cs.meta ├── fp4.gen.cs ├── fp4.gen.cs.meta ├── fp4x2.gen.cs ├── fp4x2.gen.cs.meta ├── fp4x3.gen.cs ├── fp4x3.gen.cs.meta ├── fp4x4.gen.cs ├── fp4x4.gen.cs.meta ├── fpmath.cs ├── fpmath.cs.meta ├── matrix.gen.cs └── matrix.gen.cs.meta ├── package.json ├── package.json.meta ├── readme.md └── readme.md.meta /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome:http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # All Files 7 | [*] 8 | charset = utf-8 9 | indent_style = space 10 | indent_size = 4 11 | insert_final_newline = false 12 | trim_trailing_whitespace = true 13 | 14 | # Solution Files 15 | [*.sln] 16 | indent_style = tab 17 | 18 | # XML Project Files 19 | [*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] 20 | indent_size = 2 21 | 22 | # Configuration Files 23 | [*.{json,xml,yml,config,props,targets,nuspec,resx,ruleset}] 24 | indent_size = 2 25 | 26 | # Markdown Files 27 | [*.md] 28 | trim_trailing_whitespace = false 29 | 30 | # Web Files 31 | [*.{htm,html,js,ts,css,scss,less}] 32 | indent_size = 2 33 | insert_final_newline = true 34 | 35 | # Bash Files 36 | [*.sh] 37 | end_of_line = lf 38 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set default behavior to automatically normalize line endings. 2 | * text=auto 3 | 4 | # shell files should always be LF 5 | *.sh text eol=lf 6 | 7 | # Unity files 8 | *.asset text eol=lf 9 | *.meta text eol=lf 10 | *.asmdef text eol=lf 11 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Run all tests 2 | on: [push] 3 | 4 | jobs: 5 | testRunnerInAllModes: 6 | name: Test play and edit mode 7 | runs-on: ubuntu-latest 8 | steps: 9 | # Checkout repository (required to test local actions) 10 | - name: Checkout repository 11 | uses: actions/checkout@v2 12 | with: 13 | path: Unity.Mathematics.FixedPoint 14 | 15 | # Checkout repository (required to test local actions) 16 | - name: Checkout test project 17 | uses: actions/checkout@v2 18 | with: 19 | repository: danielmansson/Unity.Mathematics.FixedPoint.TestProject 20 | path: test-project 21 | 22 | # Configure test runner 23 | - name: Run tests 24 | id: testRunner 25 | uses: webbertakken/unity-test-runner@v1 26 | env: 27 | UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} 28 | UNITY_PROJECT_PATH: test-project 29 | TEST_MODE: all 30 | 31 | # Upload artifacts 32 | - name: Expose as artifact 33 | uses: actions/upload-artifact@v1 34 | with: 35 | name: Test results (all modes) 36 | path: ${{ steps.testRunner.outputs.artifactsPath }} 37 | 38 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | artifacts/ 46 | 47 | *_i.c 48 | *_p.c 49 | *_i.h 50 | *.ilk 51 | *.obj 52 | *.pch 53 | *.pdb 54 | *.pgc 55 | *.pgd 56 | *.rsp 57 | *.sbr 58 | *.tlb 59 | *.tli 60 | *.tlh 61 | *.tmp 62 | *.tmp_proj 63 | *.log 64 | *.vspscc 65 | *.vssscc 66 | .builds 67 | *.pidb 68 | *.svclog 69 | *.scc 70 | 71 | # Chutzpah Test files 72 | _Chutzpah* 73 | 74 | # Visual C++ cache files 75 | ipch/ 76 | *.aps 77 | *.ncb 78 | *.opensdf 79 | *.sdf 80 | *.cachefile 81 | 82 | # Visual Studio profiler 83 | *.psess 84 | *.vsp 85 | *.vspx 86 | 87 | # TFS 2012 Local Workspace 88 | $tf/ 89 | 90 | # Guidance Automation Toolkit 91 | *.gpState 92 | 93 | # ReSharper is a .NET coding add-in 94 | _ReSharper*/ 95 | *.[Rr]e[Ss]harper 96 | *.DotSettings.user 97 | 98 | # JustCode is a .NET coding add-in 99 | .JustCode 100 | 101 | # TeamCity is a build add-in 102 | _TeamCity* 103 | 104 | # DotCover is a Code Coverage Tool 105 | *.dotCover 106 | 107 | # NCrunch 108 | _NCrunch_* 109 | .*crunch*.local.xml 110 | nCrunchTemp_* 111 | 112 | # MightyMoose 113 | *.mm.* 114 | AutoTest.Net/ 115 | 116 | # Web workbench (sass) 117 | .sass-cache/ 118 | 119 | # Installshield output folder 120 | [Ee]xpress/ 121 | 122 | # DocProject is a documentation generator add-in 123 | DocProject/buildhelp/ 124 | DocProject/Help/*.HxT 125 | DocProject/Help/*.HxC 126 | DocProject/Help/*.hhc 127 | DocProject/Help/*.hhk 128 | DocProject/Help/*.hhp 129 | DocProject/Help/Html2 130 | DocProject/Help/html 131 | 132 | # Click-Once directory 133 | publish/ 134 | 135 | # Publish Web Output 136 | *.[Pp]ublish.xml 137 | *.azurePubxml 138 | # TODO: Comment the next line if you want to checkin your web deploy settings 139 | # but database connection strings (with potential passwords) will be unencrypted 140 | *.pubxml 141 | *.publishproj 142 | 143 | # NuGet Packages 144 | *.nupkg 145 | # The packages folder can be ignored because of Package Restore 146 | #**/packages/* 147 | # except build/, which is used as an MSBuild target. 148 | !**/packages/build/ 149 | # Uncomment if necessary however generally it will be regenerated when needed 150 | #!**/packages/repositories.config 151 | 152 | # Windows Azure Build Output 153 | csx/ 154 | *.build.csdef 155 | 156 | # Windows Store app package directory 157 | AppPackages/ 158 | 159 | # Visual Studio cache files 160 | # files ending in .cache can be ignored 161 | *.[Cc]ache 162 | # but keep track of directories ending in .cache 163 | !*.[Cc]ache/ 164 | 165 | # Others 166 | ClientBin/ 167 | [Ss]tyle[Cc]op.* 168 | ~$* 169 | *~ 170 | *.dbmdl 171 | *.dbproj.schemaview 172 | *.pfx 173 | *.publishsettings 174 | node_modules/ 175 | orleans.codegen.cs 176 | 177 | # RIA/Silverlight projects 178 | Generated_Code/ 179 | 180 | # Backup & report files from converting an old project file 181 | # to a newer Visual Studio version. Backup files are not needed, 182 | # because we have git ;-) 183 | _UpgradeReport_Files/ 184 | Backup*/ 185 | UpgradeLog*.XML 186 | UpgradeLog*.htm 187 | 188 | # SQL Server files 189 | *.mdf 190 | *.ldf 191 | 192 | # Business Intelligence projects 193 | *.rdl.data 194 | *.bim.layout 195 | *.bim_*.settings 196 | 197 | # Microsoft Fakes 198 | FakesAssemblies/ 199 | 200 | # Node.js Tools for Visual Studio 201 | .ntvs_analysis.dat 202 | 203 | # Visual Studio 6 build log 204 | *.plg 205 | 206 | # Visual Studio 6 workspace options file 207 | *.opt 208 | 209 | # Visual Studio LightSwitch build output 210 | **/*.HTMLClient/GeneratedArtifacts 211 | **/*.DesktopClient/GeneratedArtifacts 212 | **/*.DesktopClient/ModelManifest.xml 213 | **/*.Server/GeneratedArtifacts 214 | **/*.Server/ModelManifest.xml 215 | _Pvt_Extensions 216 | 217 | # LLVM extracted file 218 | ext/llvm/win64_debug/ 219 | ext/llvm/win64_release/ 220 | ext/llvm/macos/ 221 | *.idea 222 | .DS_Store 223 | 224 | */Library/ 225 | */packages/ -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [1.1.0] - 2019-07-08 4 | 5 | - Release stable version 6 | 7 | ## [1.1.0-preview.1] - 2019-06-27 8 | 9 | - Add new math.bitmask to return a bit mask from a bool4 10 | 11 | ## [1.0.1] - 2019-04-15 12 | 13 | - Release stable version 14 | - Modify all math constants (e.g `math.PI`) to provide float constant by default instead of double. Use for example `math.PI_DBL` to get the previous double constant. 15 | 16 | ## [1.0.0-preview.1] - 2019-02-28 17 | 18 | - Fixed bug where modifications on prefabs could not be reverted for vector properties when using context menu in Inspector. 19 | - Fixed structure of the package for internal validation 20 | -------------------------------------------------------------------------------- /CHANGELOG.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0a9aed2945c15504ea7496fef0314fce 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright 2020 Daniel Månsson 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /LICENSE.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 18b2e4cef5c384946a619a6d644866a3 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Tests.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a42c1afb54b403047a864a8cf45240e8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Tests/Tests.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5b0e019de595995469c0ad335538704e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Tests/Tests/Shared.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5be19d2a6b200084082bd4eabc9d16e8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/FpTestUtils.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | 3 | namespace Unity.Mathematics.FixedPoint.Tests 4 | { 5 | partial class TestUtils 6 | { 7 | public static void AreEqual(fp a, fp b, fp delta = default) 8 | { 9 | Assert.AreEqual((double)a, (double)b, (double)delta); 10 | } 11 | 12 | public static void AreEqual(double a, double b, long maxUlp, bool signedZeroEqual) 13 | { 14 | if (signedZeroEqual && a == b) 15 | return; 16 | 17 | if (math.isfinite(a) && math.isfinite(b)) 18 | { 19 | long la = math.aslong(a); 20 | long lb = math.aslong(b); 21 | if ((la ^ lb) < 0) 22 | Assert.AreEqual(true, false); 23 | long ulps = math.abs(la - lb); 24 | Assert.AreEqual(true, ulps <= maxUlp, "ulps: " + ulps); 25 | } 26 | else 27 | { 28 | if (a != b && (!math.isnan(a) || !math.isnan(b))) 29 | Assert.AreEqual(true, false); 30 | } 31 | } 32 | 33 | public static void AreEqual(fp a, fp b, long maxUlp, bool signedZeroEqual) 34 | { 35 | try 36 | { 37 | AreEqual((double)a, (double)b, maxUlp, signedZeroEqual); 38 | } 39 | catch (System.Exception e) 40 | { 41 | throw new System.AggregateException($"{a} == {b}", e); 42 | } 43 | } 44 | 45 | // fp 46 | public static void AreEqual(fp2 a, fp2 b, fp delta = default) 47 | { 48 | AreEqual(a.x, b.x, delta); 49 | AreEqual(a.y, b.y, delta); 50 | } 51 | 52 | public static void AreEqual(fp2 a, fp2 b, long maxUlp, bool signedZeroEqual) 53 | { 54 | AreEqual(a.x, b.x, maxUlp, signedZeroEqual); 55 | AreEqual(a.y, b.y, maxUlp, signedZeroEqual); 56 | } 57 | 58 | public static void AreEqual(fp3 a, fp3 b, fp delta = default) 59 | { 60 | AreEqual(a.x, b.x, delta); 61 | AreEqual(a.y, b.y, delta); 62 | AreEqual(a.z, b.z, delta); 63 | } 64 | 65 | public static void AreEqual(fp3 a, fp3 b, long maxUlp, bool signedZeroEqual) 66 | { 67 | AreEqual(a.x, b.x, maxUlp, signedZeroEqual); 68 | AreEqual(a.y, b.y, maxUlp, signedZeroEqual); 69 | AreEqual(a.z, b.z, maxUlp, signedZeroEqual); 70 | } 71 | 72 | public static void AreEqual(fp4 a, fp4 b, fp delta = default) 73 | { 74 | AreEqual(a.x, b.x, delta); 75 | AreEqual(a.y, b.y, delta); 76 | AreEqual(a.z, b.z, delta); 77 | AreEqual(a.w, b.w, delta); 78 | } 79 | 80 | public static void AreEqual(fp4 a, fp4 b, long maxUlp, bool signedZeroEqual) 81 | { 82 | AreEqual(a.x, b.x, maxUlp, signedZeroEqual); 83 | AreEqual(a.y, b.y, maxUlp, signedZeroEqual); 84 | AreEqual(a.z, b.z, maxUlp, signedZeroEqual); 85 | AreEqual(a.w, b.w, maxUlp, signedZeroEqual); 86 | } 87 | 88 | 89 | public static void AreEqual(fp2x2 a, fp2x2 b, fp delta = default) 90 | { 91 | AreEqual(a.c0, b.c0, delta); 92 | AreEqual(a.c1, b.c1, delta); 93 | } 94 | 95 | public static void AreEqual(fp2x2 a, fp2x2 b, int maxUlp, bool signedZeroEqual) 96 | { 97 | AreEqual(a.c0, b.c0, maxUlp, signedZeroEqual); 98 | AreEqual(a.c1, b.c1, maxUlp, signedZeroEqual); 99 | } 100 | 101 | public static void AreEqual(fp3x2 a, fp3x2 b, fp delta = default) 102 | { 103 | AreEqual(a.c0, b.c0, delta); 104 | AreEqual(a.c1, b.c1, delta); 105 | } 106 | 107 | public static void AreEqual(fp3x2 a, fp3x2 b, int maxUlp, bool signedZeroEqual) 108 | { 109 | AreEqual(a.c0, b.c0, maxUlp, signedZeroEqual); 110 | AreEqual(a.c1, b.c1, maxUlp, signedZeroEqual); 111 | } 112 | 113 | public static void AreEqual(fp4x2 a, fp4x2 b, fp delta = default) 114 | { 115 | AreEqual(a.c0, b.c0, delta); 116 | AreEqual(a.c1, b.c1, delta); 117 | } 118 | 119 | public static void AreEqual(fp4x2 a, fp4x2 b, int maxUlp, bool signedZeroEqual) 120 | { 121 | AreEqual(a.c0, b.c0, maxUlp, signedZeroEqual); 122 | AreEqual(a.c1, b.c1, maxUlp, signedZeroEqual); 123 | } 124 | 125 | 126 | public static void AreEqual(fp2x3 a, fp2x3 b, fp delta = default) 127 | { 128 | AreEqual(a.c0, b.c0, delta); 129 | AreEqual(a.c1, b.c1, delta); 130 | AreEqual(a.c2, b.c2, delta); 131 | } 132 | 133 | public static void AreEqual(fp2x3 a, fp2x3 b, int maxUlp, bool signedZeroEqual) 134 | { 135 | AreEqual(a.c0, b.c0, maxUlp, signedZeroEqual); 136 | AreEqual(a.c1, b.c1, maxUlp, signedZeroEqual); 137 | AreEqual(a.c2, b.c2, maxUlp, signedZeroEqual); 138 | } 139 | 140 | public static void AreEqual(fp3x3 a, fp3x3 b, fp delta = default) 141 | { 142 | AreEqual(a.c0, b.c0, delta); 143 | AreEqual(a.c1, b.c1, delta); 144 | AreEqual(a.c2, b.c2, delta); 145 | } 146 | 147 | public static void AreEqual(fp3x3 a, fp3x3 b, int maxUlp, bool signedZeroEqual) 148 | { 149 | AreEqual(a.c0, b.c0, maxUlp, signedZeroEqual); 150 | AreEqual(a.c1, b.c1, maxUlp, signedZeroEqual); 151 | AreEqual(a.c2, b.c2, maxUlp, signedZeroEqual); 152 | } 153 | 154 | public static void AreEqual(fp4x3 a, fp4x3 b, fp delta = default) 155 | { 156 | AreEqual(a.c0, b.c0, delta); 157 | AreEqual(a.c1, b.c1, delta); 158 | AreEqual(a.c2, b.c2, delta); 159 | } 160 | 161 | public static void AreEqual(fp4x3 a, fp4x3 b, int maxUlp, bool signedZeroEqual) 162 | { 163 | AreEqual(a.c0, b.c0, maxUlp, signedZeroEqual); 164 | AreEqual(a.c1, b.c1, maxUlp, signedZeroEqual); 165 | AreEqual(a.c2, b.c2, maxUlp, signedZeroEqual); 166 | } 167 | 168 | 169 | public static void AreEqual(fp2x4 a, fp2x4 b, fp delta = default) 170 | { 171 | AreEqual(a.c0, b.c0, delta); 172 | AreEqual(a.c1, b.c1, delta); 173 | AreEqual(a.c2, b.c2, delta); 174 | AreEqual(a.c3, b.c3, delta); 175 | } 176 | 177 | public static void AreEqual(fp2x4 a, fp2x4 b, int maxUlp, bool signedZeroEqual) 178 | { 179 | AreEqual(a.c0, b.c0, maxUlp, signedZeroEqual); 180 | AreEqual(a.c1, b.c1, maxUlp, signedZeroEqual); 181 | AreEqual(a.c2, b.c2, maxUlp, signedZeroEqual); 182 | AreEqual(a.c3, b.c3, maxUlp, signedZeroEqual); 183 | } 184 | 185 | public static void AreEqual(fp3x4 a, fp3x4 b, fp delta = default) 186 | { 187 | AreEqual(a.c0, b.c0, delta); 188 | AreEqual(a.c1, b.c1, delta); 189 | AreEqual(a.c2, b.c2, delta); 190 | AreEqual(a.c3, b.c3, delta); 191 | } 192 | 193 | public static void AreEqual(fp3x4 a, fp3x4 b, int maxUlp, bool signedZeroEqual) 194 | { 195 | AreEqual(a.c0, b.c0, maxUlp, signedZeroEqual); 196 | AreEqual(a.c1, b.c1, maxUlp, signedZeroEqual); 197 | AreEqual(a.c2, b.c2, maxUlp, signedZeroEqual); 198 | AreEqual(a.c3, b.c3, maxUlp, signedZeroEqual); 199 | } 200 | 201 | public static void AreEqual(fp4x4 a, fp4x4 b, fp delta = default) 202 | { 203 | AreEqual(a.c0, b.c0, delta); 204 | AreEqual(a.c1, b.c1, delta); 205 | AreEqual(a.c2, b.c2, delta); 206 | AreEqual(a.c3, b.c3, delta); 207 | } 208 | 209 | public static void AreEqual(fp4x4 a, fp4x4 b, int maxUlp, bool signedZeroEqual) 210 | { 211 | AreEqual(a.c0, b.c0, maxUlp, signedZeroEqual); 212 | AreEqual(a.c1, b.c1, maxUlp, signedZeroEqual); 213 | AreEqual(a.c2, b.c2, maxUlp, signedZeroEqual); 214 | AreEqual(a.c3, b.c3, maxUlp, signedZeroEqual); 215 | } 216 | } 217 | } 218 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/FpTestUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: da61aeaa08538a94c99c840d42909780 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestFp2.gen.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | using NUnit.Framework; 10 | using static Unity.Mathematics.FixedPoint.fpmath; 11 | using static Unity.Mathematics.math; 12 | 13 | namespace Unity.Mathematics.FixedPoint.Tests 14 | { 15 | [TestFixture] 16 | public class TestFp2 17 | { 18 | [Test] 19 | public static void fp2_zero() 20 | { 21 | TestUtils.AreEqual(fp2.zero.x, (fp)0); 22 | TestUtils.AreEqual(fp2.zero.y, (fp)0); 23 | } 24 | 25 | [Test] 26 | public static void fp2_constructor() 27 | { 28 | fp2 a = new fp2(1, 2); 29 | TestUtils.AreEqual(a.x, 1); 30 | TestUtils.AreEqual(a.y, 2); 31 | } 32 | 33 | [Test] 34 | public static void fp2_scalar_constructor() 35 | { 36 | fp2 a = new fp2(17.0m); 37 | TestUtils.AreEqual(a.x, 17.0m); 38 | TestUtils.AreEqual(a.y, 17.0m); 39 | } 40 | 41 | [Test] 42 | public static void fp2_static_constructor() 43 | { 44 | fp2 a = fp2(1, 2); 45 | TestUtils.AreEqual(a.x, 1); 46 | TestUtils.AreEqual(a.y, 2); 47 | } 48 | 49 | [Test] 50 | public static void fp2_static_scalar_constructor() 51 | { 52 | fp2 a = fp2(17.0m); 53 | TestUtils.AreEqual(a.x, 17.0m); 54 | TestUtils.AreEqual(a.y, 17.0m); 55 | } 56 | 57 | [Test] 58 | public static void fp2_operator_equal_wide_wide() 59 | { 60 | fp2 a0 = fp2(-135.18924m, -49.0941162m); 61 | fp2 b0 = fp2(-220.014648m, 66.98004m); 62 | bool2 r0 = bool2(false, false); 63 | TestUtils.AreEqual(a0 == b0, r0); 64 | 65 | fp2 a1 = fp2(169.129822m, 240.8053m); 66 | fp2 b1 = fp2(499.2016m, -371.1131m); 67 | bool2 r1 = bool2(false, false); 68 | TestUtils.AreEqual(a1 == b1, r1); 69 | 70 | fp2 a2 = fp2(314.7392m, 442.393m); 71 | fp2 b2 = fp2(208.448669m, 390.8037m); 72 | bool2 r2 = bool2(false, false); 73 | TestUtils.AreEqual(a2 == b2, r2); 74 | 75 | fp2 a3 = fp2(177.924438m, 335.5334m); 76 | fp2 b3 = fp2(-72.44382m, 362.97644m); 77 | bool2 r3 = bool2(false, false); 78 | TestUtils.AreEqual(a3 == b3, r3); 79 | } 80 | 81 | [Test] 82 | public static void fp2_operator_equal_wide_scalar() 83 | { 84 | fp2 a0 = fp2(65.6712m, 404.415527m); 85 | fp b0 = (-155.815765m); 86 | bool2 r0 = bool2(false, false); 87 | TestUtils.AreEqual(a0 == b0, r0); 88 | 89 | fp2 a1 = fp2(-269.730164m, 152.9945m); 90 | fp b1 = (83.6306152m); 91 | bool2 r1 = bool2(false, false); 92 | TestUtils.AreEqual(a1 == b1, r1); 93 | 94 | fp2 a2 = fp2(-155.868286m, 386.365173m); 95 | fp b2 = (314.671265m); 96 | bool2 r2 = bool2(false, false); 97 | TestUtils.AreEqual(a2 == b2, r2); 98 | 99 | fp2 a3 = fp2(290.04895m, -65.66748m); 100 | fp b3 = (-132.6352m); 101 | bool2 r3 = bool2(false, false); 102 | TestUtils.AreEqual(a3 == b3, r3); 103 | } 104 | 105 | [Test] 106 | public static void fp2_operator_equal_scalar_wide() 107 | { 108 | fp a0 = (36.38391m); 109 | fp2 b0 = fp2(-400.4892m, -71.2868347m); 110 | bool2 r0 = bool2(false, false); 111 | TestUtils.AreEqual(a0 == b0, r0); 112 | 113 | fp a1 = (156.978088m); 114 | fp2 b1 = fp2(-225.238739m, 499.141785m); 115 | bool2 r1 = bool2(false, false); 116 | TestUtils.AreEqual(a1 == b1, r1); 117 | 118 | fp a2 = (-211.979919m); 119 | fp2 b2 = fp2(428.311951m, -489.501343m); 120 | bool2 r2 = bool2(false, false); 121 | TestUtils.AreEqual(a2 == b2, r2); 122 | 123 | fp a3 = (-5.691559m); 124 | fp2 b3 = fp2(-30.8659363m, -362.9831m); 125 | bool2 r3 = bool2(false, false); 126 | TestUtils.AreEqual(a3 == b3, r3); 127 | } 128 | 129 | [Test] 130 | public static void fp2_operator_not_equal_wide_wide() 131 | { 132 | fp2 a0 = fp2(279.994141m, -43.34201m); 133 | fp2 b0 = fp2(-460.9121m, -476.009033m); 134 | bool2 r0 = bool2(true, true); 135 | TestUtils.AreEqual(a0 != b0, r0); 136 | 137 | fp2 a1 = fp2(-465.724731m, 317.466553m); 138 | fp2 b1 = fp2(468.1364m, -341.012543m); 139 | bool2 r1 = bool2(true, true); 140 | TestUtils.AreEqual(a1 != b1, r1); 141 | 142 | fp2 a2 = fp2(85.7149658m, 360.8905m); 143 | fp2 b2 = fp2(-62.65805m, -458.801666m); 144 | bool2 r2 = bool2(true, true); 145 | TestUtils.AreEqual(a2 != b2, r2); 146 | 147 | fp2 a3 = fp2(366.081543m, 154.542847m); 148 | fp2 b3 = fp2(-457.730225m, -59.5232544m); 149 | bool2 r3 = bool2(true, true); 150 | TestUtils.AreEqual(a3 != b3, r3); 151 | } 152 | 153 | [Test] 154 | public static void fp2_operator_not_equal_wide_scalar() 155 | { 156 | fp2 a0 = fp2(-155.4411m, -19.4266052m); 157 | fp b0 = (-393.413544m); 158 | bool2 r0 = bool2(true, true); 159 | TestUtils.AreEqual(a0 != b0, r0); 160 | 161 | fp2 a1 = fp2(174.633057m, 59.177063m); 162 | fp b1 = (507.920715m); 163 | bool2 r1 = bool2(true, true); 164 | TestUtils.AreEqual(a1 != b1, r1); 165 | 166 | fp2 a2 = fp2(171.151489m, -398.176849m); 167 | fp b2 = (-58.92328m); 168 | bool2 r2 = bool2(true, true); 169 | TestUtils.AreEqual(a2 != b2, r2); 170 | 171 | fp2 a3 = fp2(492.20105m, 270.341m); 172 | fp b3 = (-165.241516m); 173 | bool2 r3 = bool2(true, true); 174 | TestUtils.AreEqual(a3 != b3, r3); 175 | } 176 | 177 | [Test] 178 | public static void fp2_operator_not_equal_scalar_wide() 179 | { 180 | fp a0 = (478.353149m); 181 | fp2 b0 = fp2(459.553223m, 436.453247m); 182 | bool2 r0 = bool2(true, true); 183 | TestUtils.AreEqual(a0 != b0, r0); 184 | 185 | fp a1 = (-488.714172m); 186 | fp2 b1 = fp2(392.767944m, -266.736633m); 187 | bool2 r1 = bool2(true, true); 188 | TestUtils.AreEqual(a1 != b1, r1); 189 | 190 | fp a2 = (338.557861m); 191 | fp2 b2 = fp2(-338.100128m, -152.314545m); 192 | bool2 r2 = bool2(true, true); 193 | TestUtils.AreEqual(a2 != b2, r2); 194 | 195 | fp a3 = (-452.820679m); 196 | fp2 b3 = fp2(209.439331m, 50.10797m); 197 | bool2 r3 = bool2(true, true); 198 | TestUtils.AreEqual(a3 != b3, r3); 199 | } 200 | 201 | [Test] 202 | public static void fp2_shuffle_result_1() 203 | { 204 | fp2 a = fp2(0, 1); 205 | fp2 b = fp2(2, 3); 206 | 207 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftX), (0)); 208 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftY), (1)); 209 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX), (2)); 210 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY), (3)); 211 | } 212 | 213 | [Test] 214 | public static void fp2_shuffle_result_2() 215 | { 216 | fp2 a = fp2(0, 1); 217 | fp2 b = fp2(2, 3); 218 | 219 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftX, ShuffleComponent.LeftX), fp2(0, 0)); 220 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftY, ShuffleComponent.LeftX), fp2(1, 0)); 221 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.LeftX), fp2(2, 0)); 222 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftX), fp2(3, 0)); 223 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftX, ShuffleComponent.LeftY), fp2(0, 1)); 224 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftY, ShuffleComponent.LeftY), fp2(1, 1)); 225 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.LeftY), fp2(2, 1)); 226 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftY), fp2(3, 1)); 227 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftX, ShuffleComponent.RightX), fp2(0, 2)); 228 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftY, ShuffleComponent.RightX), fp2(1, 2)); 229 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.RightX), fp2(2, 2)); 230 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.RightX), fp2(3, 2)); 231 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftX, ShuffleComponent.RightY), fp2(0, 3)); 232 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftY, ShuffleComponent.RightY), fp2(1, 3)); 233 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.RightY), fp2(2, 3)); 234 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.RightY), fp2(3, 3)); 235 | } 236 | 237 | [Test] 238 | public static void fp2_shuffle_result_3() 239 | { 240 | fp2 a = fp2(0, 1); 241 | fp2 b = fp2(2, 3); 242 | 243 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.RightY, ShuffleComponent.RightY), fp3(2, 3, 3)); 244 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.LeftX, ShuffleComponent.RightX), fp3(2, 0, 2)); 245 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftY, ShuffleComponent.RightY), fp3(3, 1, 3)); 246 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftY, ShuffleComponent.LeftY, ShuffleComponent.LeftY), fp3(1, 1, 1)); 247 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.LeftY, ShuffleComponent.RightY), fp3(2, 1, 3)); 248 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftX, ShuffleComponent.RightY, ShuffleComponent.RightY), fp3(0, 3, 3)); 249 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.LeftY, ShuffleComponent.RightY), fp3(2, 1, 3)); 250 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.RightY, ShuffleComponent.LeftX), fp3(3, 3, 0)); 251 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.RightX, ShuffleComponent.RightY), fp3(2, 2, 3)); 252 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.RightX, ShuffleComponent.LeftX), fp3(2, 2, 0)); 253 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftX, ShuffleComponent.LeftY, ShuffleComponent.LeftY), fp3(0, 1, 1)); 254 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.RightX, ShuffleComponent.RightY), fp3(3, 2, 3)); 255 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftX, ShuffleComponent.LeftY, ShuffleComponent.LeftY), fp3(0, 1, 1)); 256 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.RightX, ShuffleComponent.RightX), fp3(3, 2, 2)); 257 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftX, ShuffleComponent.LeftY, ShuffleComponent.RightY), fp3(0, 1, 3)); 258 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftY, ShuffleComponent.LeftY), fp3(3, 1, 1)); 259 | } 260 | 261 | [Test] 262 | public static void fp2_shuffle_result_4() 263 | { 264 | fp2 a = fp2(0, 1); 265 | fp2 b = fp2(2, 3); 266 | 267 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftX, ShuffleComponent.LeftX, ShuffleComponent.LeftY, ShuffleComponent.RightX), fp4(0, 0, 1, 2)); 268 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.LeftY, ShuffleComponent.LeftX, ShuffleComponent.RightY), fp4(2, 1, 0, 3)); 269 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.RightX, ShuffleComponent.RightY, ShuffleComponent.RightX), fp4(3, 2, 3, 2)); 270 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.LeftX, ShuffleComponent.RightY, ShuffleComponent.RightY), fp4(2, 0, 3, 3)); 271 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftX, ShuffleComponent.RightY, ShuffleComponent.LeftX, ShuffleComponent.RightX), fp4(0, 3, 0, 2)); 272 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftX, ShuffleComponent.RightY, ShuffleComponent.LeftY), fp4(3, 0, 3, 1)); 273 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.RightX, ShuffleComponent.RightY, ShuffleComponent.LeftX), fp4(2, 2, 3, 0)); 274 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.RightX, ShuffleComponent.LeftX, ShuffleComponent.RightY), fp4(2, 2, 0, 3)); 275 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftX, ShuffleComponent.LeftY, ShuffleComponent.RightX, ShuffleComponent.LeftY), fp4(0, 1, 2, 1)); 276 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.LeftY, ShuffleComponent.RightY, ShuffleComponent.RightY), fp4(2, 1, 3, 3)); 277 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.RightY, ShuffleComponent.RightY, ShuffleComponent.LeftY), fp4(3, 3, 3, 1)); 278 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.RightX, ShuffleComponent.LeftY, ShuffleComponent.LeftY), fp4(2, 2, 1, 1)); 279 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftX, ShuffleComponent.LeftX, ShuffleComponent.LeftX), fp4(3, 0, 0, 0)); 280 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.RightX, ShuffleComponent.RightX, ShuffleComponent.RightY), fp4(2, 2, 2, 3)); 281 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftX, ShuffleComponent.RightY, ShuffleComponent.LeftX, ShuffleComponent.RightY), fp4(0, 3, 0, 3)); 282 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.LeftX, ShuffleComponent.LeftX, ShuffleComponent.LeftX), fp4(2, 0, 0, 0)); 283 | } 284 | 285 | 286 | } 287 | } 288 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestFp2.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6ab19deec3ec21e4b9e2e0bce3ea8d29 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestFp2x2.gen.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | using NUnit.Framework; 10 | using static Unity.Mathematics.FixedPoint.fpmath; 11 | using static Unity.Mathematics.math; 12 | 13 | namespace Unity.Mathematics.FixedPoint.Tests 14 | { 15 | [TestFixture] 16 | public class TestFp2x2 17 | { 18 | [Test] 19 | public static void fp2x2_zero() 20 | { 21 | TestUtils.AreEqual(fp2x2.zero.c0.x, (fp)0); 22 | TestUtils.AreEqual(fp2x2.zero.c0.y, (fp)0); 23 | TestUtils.AreEqual(fp2x2.zero.c1.x, (fp)0); 24 | TestUtils.AreEqual(fp2x2.zero.c1.y, (fp)0); 25 | } 26 | 27 | [Test] 28 | public static void fp2x2_identity() 29 | { 30 | TestUtils.AreEqual(fp2x2.identity.c0.x, (fp)1); 31 | TestUtils.AreEqual(fp2x2.identity.c0.y, (fp)0); 32 | TestUtils.AreEqual(fp2x2.identity.c1.x, (fp)0); 33 | TestUtils.AreEqual(fp2x2.identity.c1.y, (fp)1); 34 | } 35 | 36 | [Test] 37 | public static void fp2x2_operator_equal_wide_wide() 38 | { 39 | fp2x2 a0 = fp2x2(-135.18924m, -49.0941162m, 169.129822m, 240.8053m); 40 | fp2x2 b0 = fp2x2(-220.014648m, 66.98004m, 499.2016m, -371.1131m); 41 | bool2x2 r0 = bool2x2(false, false, false, false); 42 | TestUtils.AreEqual(a0 == b0, r0); 43 | 44 | fp2x2 a1 = fp2x2(314.7392m, 442.393m, 177.924438m, 335.5334m); 45 | fp2x2 b1 = fp2x2(208.448669m, 390.8037m, -72.44382m, 362.97644m); 46 | bool2x2 r1 = bool2x2(false, false, false, false); 47 | TestUtils.AreEqual(a1 == b1, r1); 48 | 49 | fp2x2 a2 = fp2x2(168.15448m, 350.729553m, 367.178467m, 46.9414673m); 50 | fp2x2 b2 = fp2x2(194.678345m, 471.644836m, -404.044678m, -144.696747m); 51 | bool2x2 r2 = bool2x2(false, false, false, false); 52 | TestUtils.AreEqual(a2 == b2, r2); 53 | 54 | fp2x2 a3 = fp2x2(188.76416m, -97.2113953m, -293.320984m, -234.822937m); 55 | fp2x2 b3 = fp2x2(-494.446655m, -252.970367m, 234.417114m, 398.724m); 56 | bool2x2 r3 = bool2x2(false, false, false, false); 57 | TestUtils.AreEqual(a3 == b3, r3); 58 | } 59 | 60 | [Test] 61 | public static void fp2x2_operator_equal_wide_scalar() 62 | { 63 | fp2x2 a0 = fp2x2(65.6712m, 404.415527m, -269.730164m, 83.6306152m); 64 | fp b0 = (-155.815765m); 65 | bool2x2 r0 = bool2x2(false, false, false, false); 66 | TestUtils.AreEqual(a0 == b0, r0); 67 | 68 | fp2x2 a1 = fp2x2(152.9945m, 314.671265m, 386.365173m, 290.04895m); 69 | fp b1 = (-155.868286m); 70 | bool2x2 r1 = bool2x2(false, false, false, false); 71 | TestUtils.AreEqual(a1 == b1, r1); 72 | 73 | fp2x2 a2 = fp2x2(-132.6352m, -69.68326m, -191.190765m, 186.845215m); 74 | fp b2 = (-65.66748m); 75 | bool2x2 r2 = bool2x2(false, false, false, false); 76 | TestUtils.AreEqual(a2 == b2, r2); 77 | 78 | fp2x2 a3 = fp2x2(-232.895691m, -49.70108m, -300.8819m, 333.396851m); 79 | fp b3 = (-319.144043m); 80 | bool2x2 r3 = bool2x2(false, false, false, false); 81 | TestUtils.AreEqual(a3 == b3, r3); 82 | } 83 | 84 | [Test] 85 | public static void fp2x2_operator_equal_scalar_wide() 86 | { 87 | fp a0 = (36.38391m); 88 | fp2x2 b0 = fp2x2(-400.4892m, -71.2868347m, 156.978088m, -225.238739m); 89 | bool2x2 r0 = bool2x2(false, false, false, false); 90 | TestUtils.AreEqual(a0 == b0, r0); 91 | 92 | fp a1 = (499.141785m); 93 | fp2x2 b1 = fp2x2(-211.979919m, 428.311951m, -489.501343m, -5.691559m); 94 | bool2x2 r1 = bool2x2(false, false, false, false); 95 | TestUtils.AreEqual(a1 == b1, r1); 96 | 97 | fp a2 = (-30.8659363m); 98 | fp2x2 b2 = fp2x2(-362.9831m, 184.503174m, -160.470612m, 316.668823m); 99 | bool2x2 r2 = bool2x2(false, false, false, false); 100 | TestUtils.AreEqual(a2 == b2, r2); 101 | 102 | fp a3 = (390.369263m); 103 | fp2x2 b3 = fp2x2(505.1051m, -294.6487m, 443.1991m, 96.5592651m); 104 | bool2x2 r3 = bool2x2(false, false, false, false); 105 | TestUtils.AreEqual(a3 == b3, r3); 106 | } 107 | 108 | [Test] 109 | public static void fp2x2_operator_not_equal_wide_wide() 110 | { 111 | fp2x2 a0 = fp2x2(279.994141m, -43.34201m, -465.724731m, 317.466553m); 112 | fp2x2 b0 = fp2x2(-460.9121m, -476.009033m, 468.1364m, -341.012543m); 113 | bool2x2 r0 = bool2x2(true, true, true, true); 114 | TestUtils.AreEqual(a0 != b0, r0); 115 | 116 | fp2x2 a1 = fp2x2(85.7149658m, 360.8905m, 366.081543m, 154.542847m); 117 | fp2x2 b1 = fp2x2(-62.65805m, -458.801666m, -457.730225m, -59.5232544m); 118 | bool2x2 r1 = bool2x2(true, true, true, true); 119 | TestUtils.AreEqual(a1 != b1, r1); 120 | 121 | fp2x2 a2 = fp2x2(332.4262m, 397.11322m, -431.374969m, 489.0108m); 122 | fp2x2 b2 = fp2x2(3.024231m, 155.812744m, -19.8399048m, -6.01693726m); 123 | bool2x2 r2 = bool2x2(true, true, true, true); 124 | TestUtils.AreEqual(a2 != b2, r2); 125 | 126 | fp2x2 a3 = fp2x2(398.4336m, -489.817932m, 171.4049m, -67.82968m); 127 | fp2x2 b3 = fp2x2(-406.207916m, -102.420715m, -40.362915m, 452.6754m); 128 | bool2x2 r3 = bool2x2(true, true, true, true); 129 | TestUtils.AreEqual(a3 != b3, r3); 130 | } 131 | 132 | [Test] 133 | public static void fp2x2_operator_not_equal_wide_scalar() 134 | { 135 | fp2x2 a0 = fp2x2(-155.4411m, -19.4266052m, 174.633057m, 507.920715m); 136 | fp b0 = (-393.413544m); 137 | bool2x2 r0 = bool2x2(true, true, true, true); 138 | TestUtils.AreEqual(a0 != b0, r0); 139 | 140 | fp2x2 a1 = fp2x2(59.177063m, -58.92328m, -398.176849m, 492.20105m); 141 | fp b1 = (171.151489m); 142 | bool2x2 r1 = bool2x2(true, true, true, true); 143 | TestUtils.AreEqual(a1 != b1, r1); 144 | 145 | fp2x2 a2 = fp2x2(-165.241516m, -380.243256m, 501.899048m, -134.345459m); 146 | fp b2 = (270.341m); 147 | bool2x2 r2 = bool2x2(true, true, true, true); 148 | TestUtils.AreEqual(a2 != b2, r2); 149 | 150 | fp2x2 a3 = fp2x2(458.400452m, 161.459961m, 261.514221m, -145.6124m); 151 | fp b3 = (46.7709961m); 152 | bool2x2 r3 = bool2x2(true, true, true, true); 153 | TestUtils.AreEqual(a3 != b3, r3); 154 | } 155 | 156 | [Test] 157 | public static void fp2x2_operator_not_equal_scalar_wide() 158 | { 159 | fp a0 = (478.353149m); 160 | fp2x2 b0 = fp2x2(459.553223m, 436.453247m, -488.714172m, 392.767944m); 161 | bool2x2 r0 = bool2x2(true, true, true, true); 162 | TestUtils.AreEqual(a0 != b0, r0); 163 | 164 | fp a1 = (-266.736633m); 165 | fp2x2 b1 = fp2x2(338.557861m, -338.100128m, -152.314545m, -452.820679m); 166 | bool2x2 r1 = bool2x2(true, true, true, true); 167 | TestUtils.AreEqual(a1 != b1, r1); 168 | 169 | fp a2 = (209.439331m); 170 | fp2x2 b2 = fp2x2(50.10797m, 372.4344m, -488.0213m, 489.740784m); 171 | bool2x2 r2 = bool2x2(true, true, true, true); 172 | TestUtils.AreEqual(a2 != b2, r2); 173 | 174 | fp a3 = (270.4001m); 175 | fp2x2 b3 = fp2x2(-472.846771m, -286.850464m, -384.691864m, 443.423523m); 176 | bool2x2 r3 = bool2x2(true, true, true, true); 177 | TestUtils.AreEqual(a3 != b3, r3); 178 | } 179 | 180 | 181 | } 182 | } 183 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestFp2x2.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e989bf99353e00f4890b0b90f1dfa0fa 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestFp2x3.gen.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | using NUnit.Framework; 10 | using static Unity.Mathematics.FixedPoint.fpmath; 11 | using static Unity.Mathematics.math; 12 | 13 | namespace Unity.Mathematics.FixedPoint.Tests 14 | { 15 | [TestFixture] 16 | public class TestFp2x3 17 | { 18 | [Test] 19 | public static void fp2x3_zero() 20 | { 21 | TestUtils.AreEqual(fp2x3.zero.c0.x, (fp)0); 22 | TestUtils.AreEqual(fp2x3.zero.c0.y, (fp)0); 23 | TestUtils.AreEqual(fp2x3.zero.c1.x, (fp)0); 24 | TestUtils.AreEqual(fp2x3.zero.c1.y, (fp)0); 25 | TestUtils.AreEqual(fp2x3.zero.c2.x, (fp)0); 26 | TestUtils.AreEqual(fp2x3.zero.c2.y, (fp)0); 27 | } 28 | 29 | [Test] 30 | public static void fp2x3_operator_equal_wide_wide() 31 | { 32 | fp2x3 a0 = fp2x3(-135.18924m, -49.0941162m, 169.129822m, 240.8053m, 314.7392m, 442.393m); 33 | fp2x3 b0 = fp2x3(-220.014648m, 66.98004m, 499.2016m, -371.1131m, 208.448669m, 390.8037m); 34 | bool2x3 r0 = bool2x3(false, false, false, false, false, false); 35 | TestUtils.AreEqual(a0 == b0, r0); 36 | 37 | fp2x3 a1 = fp2x3(177.924438m, 335.5334m, 168.15448m, 350.729553m, 367.178467m, 46.9414673m); 38 | fp2x3 b1 = fp2x3(-72.44382m, 362.97644m, 194.678345m, 471.644836m, -404.044678m, -144.696747m); 39 | bool2x3 r1 = bool2x3(false, false, false, false, false, false); 40 | TestUtils.AreEqual(a1 == b1, r1); 41 | 42 | fp2x3 a2 = fp2x3(188.76416m, -97.2113953m, -293.320984m, -234.822937m, 417.0337m, 26.3864136m); 43 | fp2x3 b2 = fp2x3(-494.446655m, -252.970367m, 234.417114m, 398.724m, 260.4287m, 370.144226m); 44 | bool2x3 r2 = bool2x3(false, false, false, false, false, false); 45 | TestUtils.AreEqual(a2 == b2, r2); 46 | 47 | fp2x3 a3 = fp2x3(269.245728m, 29.4741821m, 479.485229m, -237.230957m, -221.9837m, -506.672546m); 48 | fp2x3 b3 = fp2x3(89.579834m, -434.816833m, -109.845337m, 336.973022m, -409.154968m, 500.387573m); 49 | bool2x3 r3 = bool2x3(false, false, false, false, false, false); 50 | TestUtils.AreEqual(a3 == b3, r3); 51 | } 52 | 53 | [Test] 54 | public static void fp2x3_operator_equal_wide_scalar() 55 | { 56 | fp2x3 a0 = fp2x3(65.6712m, 404.415527m, -269.730164m, 83.6306152m, 152.9945m, -155.868286m); 57 | fp b0 = (-155.815765m); 58 | bool2x3 r0 = bool2x3(false, false, false, false, false, false); 59 | TestUtils.AreEqual(a0 == b0, r0); 60 | 61 | fp2x3 a1 = fp2x3(314.671265m, 290.04895m, -132.6352m, -65.66748m, -69.68326m, -191.190765m); 62 | fp b1 = (386.365173m); 63 | bool2x3 r1 = bool2x3(false, false, false, false, false, false); 64 | TestUtils.AreEqual(a1 == b1, r1); 65 | 66 | fp2x3 a2 = fp2x3(186.845215m, -319.144043m, -49.70108m, -300.8819m, 333.396851m, 386.3775m); 67 | fp b2 = (-232.895691m); 68 | bool2x3 r2 = bool2x3(false, false, false, false, false, false); 69 | TestUtils.AreEqual(a2 == b2, r2); 70 | 71 | fp2x3 a3 = fp2x3(-296.7019m, 141.542358m, -227.323334m, 83.87286m, -410.91687m, 110.501282m); 72 | fp b3 = (-309.1172m); 73 | bool2x3 r3 = bool2x3(false, false, false, false, false, false); 74 | TestUtils.AreEqual(a3 == b3, r3); 75 | } 76 | 77 | [Test] 78 | public static void fp2x3_operator_equal_scalar_wide() 79 | { 80 | fp a0 = (36.38391m); 81 | fp2x3 b0 = fp2x3(-400.4892m, -71.2868347m, 156.978088m, -225.238739m, 499.141785m, -211.979919m); 82 | bool2x3 r0 = bool2x3(false, false, false, false, false, false); 83 | TestUtils.AreEqual(a0 == b0, r0); 84 | 85 | fp a1 = (428.311951m); 86 | fp2x3 b1 = fp2x3(-489.501343m, -5.691559m, -30.8659363m, -362.9831m, 184.503174m, -160.470612m); 87 | bool2x3 r1 = bool2x3(false, false, false, false, false, false); 88 | TestUtils.AreEqual(a1 == b1, r1); 89 | 90 | fp a2 = (316.668823m); 91 | fp2x3 b2 = fp2x3(390.369263m, 505.1051m, -294.6487m, 443.1991m, 96.5592651m, -257.012939m); 92 | bool2x3 r2 = bool2x3(false, false, false, false, false, false); 93 | TestUtils.AreEqual(a2 == b2, r2); 94 | 95 | fp a3 = (-245.054962m); 96 | fp2x3 b3 = fp2x3(326.464844m, -23.9599m, -168.694885m, 386.2486m, -227.090637m, -336.612427m); 97 | bool2x3 r3 = bool2x3(false, false, false, false, false, false); 98 | TestUtils.AreEqual(a3 == b3, r3); 99 | } 100 | 101 | [Test] 102 | public static void fp2x3_operator_not_equal_wide_wide() 103 | { 104 | fp2x3 a0 = fp2x3(279.994141m, -43.34201m, -465.724731m, 317.466553m, 85.7149658m, 360.8905m); 105 | fp2x3 b0 = fp2x3(-460.9121m, -476.009033m, 468.1364m, -341.012543m, -62.65805m, -458.801666m); 106 | bool2x3 r0 = bool2x3(true, true, true, true, true, true); 107 | TestUtils.AreEqual(a0 != b0, r0); 108 | 109 | fp2x3 a1 = fp2x3(366.081543m, 154.542847m, 332.4262m, 397.11322m, -431.374969m, 489.0108m); 110 | fp2x3 b1 = fp2x3(-457.730225m, -59.5232544m, 3.024231m, 155.812744m, -19.8399048m, -6.01693726m); 111 | bool2x3 r1 = bool2x3(true, true, true, true, true, true); 112 | TestUtils.AreEqual(a1 != b1, r1); 113 | 114 | fp2x3 a2 = fp2x3(398.4336m, -489.817932m, 171.4049m, -67.82968m, -192.278717m, 227.84082m); 115 | fp2x3 b2 = fp2x3(-406.207916m, -102.420715m, -40.362915m, 452.6754m, 93.25757m, -258.378052m); 116 | bool2x3 r2 = bool2x3(true, true, true, true, true, true); 117 | TestUtils.AreEqual(a2 != b2, r2); 118 | 119 | fp2x3 a3 = fp2x3(62.1381836m, 262.186462m, -404.0531m, 34.449585m, -204.795776m, -285.4118m); 120 | fp2x3 b3 = fp2x3(-184.0498m, -379.2353m, -370.687317m, -255.947235m, 29.0557861m, 322.407654m); 121 | bool2x3 r3 = bool2x3(true, true, true, true, true, true); 122 | TestUtils.AreEqual(a3 != b3, r3); 123 | } 124 | 125 | [Test] 126 | public static void fp2x3_operator_not_equal_wide_scalar() 127 | { 128 | fp2x3 a0 = fp2x3(-155.4411m, -19.4266052m, 174.633057m, 507.920715m, 59.177063m, 171.151489m); 129 | fp b0 = (-393.413544m); 130 | bool2x3 r0 = bool2x3(true, true, true, true, true, true); 131 | TestUtils.AreEqual(a0 != b0, r0); 132 | 133 | fp2x3 a1 = fp2x3(-58.92328m, 492.20105m, -165.241516m, 270.341m, -380.243256m, 501.899048m); 134 | fp b1 = (-398.176849m); 135 | bool2x3 r1 = bool2x3(true, true, true, true, true, true); 136 | TestUtils.AreEqual(a1 != b1, r1); 137 | 138 | fp2x3 a2 = fp2x3(-134.345459m, 46.7709961m, 161.459961m, 261.514221m, -145.6124m, -0.449920654m); 139 | fp b2 = (458.400452m); 140 | bool2x3 r2 = bool2x3(true, true, true, true, true, true); 141 | TestUtils.AreEqual(a2 != b2, r2); 142 | 143 | fp2x3 a3 = fp2x3(350.461426m, 242.664m, 382.677063m, -468.967957m, -497.459473m, -80.93225m); 144 | fp b3 = (202.221008m); 145 | bool2x3 r3 = bool2x3(true, true, true, true, true, true); 146 | TestUtils.AreEqual(a3 != b3, r3); 147 | } 148 | 149 | [Test] 150 | public static void fp2x3_operator_not_equal_scalar_wide() 151 | { 152 | fp a0 = (478.353149m); 153 | fp2x3 b0 = fp2x3(459.553223m, 436.453247m, -488.714172m, 392.767944m, -266.736633m, 338.557861m); 154 | bool2x3 r0 = bool2x3(true, true, true, true, true, true); 155 | TestUtils.AreEqual(a0 != b0, r0); 156 | 157 | fp a1 = (-338.100128m); 158 | fp2x3 b1 = fp2x3(-152.314545m, -452.820679m, 209.439331m, 50.10797m, 372.4344m, -488.0213m); 159 | bool2x3 r1 = bool2x3(true, true, true, true, true, true); 160 | TestUtils.AreEqual(a1 != b1, r1); 161 | 162 | fp a2 = (489.740784m); 163 | fp2x3 b2 = fp2x3(270.4001m, -472.846771m, -286.850464m, -384.691864m, 443.423523m, 358.7472m); 164 | bool2x3 r2 = bool2x3(true, true, true, true, true, true); 165 | TestUtils.AreEqual(a2 != b2, r2); 166 | 167 | fp a3 = (-15.4140625m); 168 | fp2x3 b3 = fp2x3(-342.179169m, 468.967529m, -130.568085m, 401.785828m, -268.352264m, -239.231018m); 169 | bool2x3 r3 = bool2x3(true, true, true, true, true, true); 170 | TestUtils.AreEqual(a3 != b3, r3); 171 | } 172 | 173 | 174 | } 175 | } 176 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestFp2x3.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8cd723d13ba8ea14da58c4ae6ab10835 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestFp2x4.gen.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | using NUnit.Framework; 10 | using static Unity.Mathematics.FixedPoint.fpmath; 11 | using static Unity.Mathematics.math; 12 | 13 | namespace Unity.Mathematics.FixedPoint.Tests 14 | { 15 | [TestFixture] 16 | public class TestFp2x4 17 | { 18 | [Test] 19 | public static void fp2x4_zero() 20 | { 21 | TestUtils.AreEqual(fp2x4.zero.c0.x, (fp)0); 22 | TestUtils.AreEqual(fp2x4.zero.c0.y, (fp)0); 23 | TestUtils.AreEqual(fp2x4.zero.c1.x, (fp)0); 24 | TestUtils.AreEqual(fp2x4.zero.c1.y, (fp)0); 25 | TestUtils.AreEqual(fp2x4.zero.c2.x, (fp)0); 26 | TestUtils.AreEqual(fp2x4.zero.c2.y, (fp)0); 27 | TestUtils.AreEqual(fp2x4.zero.c3.x, (fp)0); 28 | TestUtils.AreEqual(fp2x4.zero.c3.y, (fp)0); 29 | } 30 | 31 | [Test] 32 | public static void fp2x4_operator_equal_wide_wide() 33 | { 34 | fp2x4 a0 = fp2x4(-135.18924m, -49.0941162m, 169.129822m, 240.8053m, 314.7392m, 442.393m, 177.924438m, 335.5334m); 35 | fp2x4 b0 = fp2x4(-220.014648m, 66.98004m, 499.2016m, -371.1131m, 208.448669m, 390.8037m, -72.44382m, 362.97644m); 36 | bool2x4 r0 = bool2x4(false, false, false, false, false, false, false, false); 37 | TestUtils.AreEqual(a0 == b0, r0); 38 | 39 | fp2x4 a1 = fp2x4(168.15448m, 350.729553m, 367.178467m, 46.9414673m, 188.76416m, -97.2113953m, -293.320984m, -234.822937m); 40 | fp2x4 b1 = fp2x4(194.678345m, 471.644836m, -404.044678m, -144.696747m, -494.446655m, -252.970367m, 234.417114m, 398.724m); 41 | bool2x4 r1 = bool2x4(false, false, false, false, false, false, false, false); 42 | TestUtils.AreEqual(a1 == b1, r1); 43 | 44 | fp2x4 a2 = fp2x4(417.0337m, 26.3864136m, 269.245728m, 29.4741821m, 479.485229m, -237.230957m, -221.9837m, -506.672546m); 45 | fp2x4 b2 = fp2x4(260.4287m, 370.144226m, 89.579834m, -434.816833m, -109.845337m, 336.973022m, -409.154968m, 500.387573m); 46 | bool2x4 r2 = bool2x4(false, false, false, false, false, false, false, false); 47 | TestUtils.AreEqual(a2 == b2, r2); 48 | 49 | fp2x4 a3 = fp2x4(-22.98944m, 487.260864m, -419.731964m, 337.2033m, 245.043884m, 390.215881m, 84.4129639m, 434.2079m); 50 | fp2x4 b3 = fp2x4(-174.081818m, 395.101135m, 350.3393m, -243.144592m, -416.397369m, 151.576477m, -18.2243347m, -431.677917m); 51 | bool2x4 r3 = bool2x4(false, false, false, false, false, false, false, false); 52 | TestUtils.AreEqual(a3 == b3, r3); 53 | } 54 | 55 | [Test] 56 | public static void fp2x4_operator_equal_wide_scalar() 57 | { 58 | fp2x4 a0 = fp2x4(65.6712m, 404.415527m, -269.730164m, 83.6306152m, 152.9945m, -155.868286m, 314.671265m, 386.365173m); 59 | fp b0 = (-155.815765m); 60 | bool2x4 r0 = bool2x4(false, false, false, false, false, false, false, false); 61 | TestUtils.AreEqual(a0 == b0, r0); 62 | 63 | fp2x4 a1 = fp2x4(290.04895m, -65.66748m, -69.68326m, -191.190765m, 186.845215m, -232.895691m, -319.144043m, -49.70108m); 64 | fp b1 = (-132.6352m); 65 | bool2x4 r1 = bool2x4(false, false, false, false, false, false, false, false); 66 | TestUtils.AreEqual(a1 == b1, r1); 67 | 68 | fp2x4 a2 = fp2x4(-300.8819m, 386.3775m, -296.7019m, -309.1172m, 141.542358m, -227.323334m, 83.87286m, -410.91687m); 69 | fp b2 = (333.396851m); 70 | bool2x4 r2 = bool2x4(false, false, false, false, false, false, false, false); 71 | TestUtils.AreEqual(a2 == b2, r2); 72 | 73 | fp2x4 a3 = fp2x4(110.501282m, 36.57434m, -427.541443m, -268.170837m, 175.8117m, -193.47995m, 291.051941m, 423.97168m); 74 | fp b3 = (-390.103577m); 75 | bool2x4 r3 = bool2x4(false, false, false, false, false, false, false, false); 76 | TestUtils.AreEqual(a3 == b3, r3); 77 | } 78 | 79 | [Test] 80 | public static void fp2x4_operator_equal_scalar_wide() 81 | { 82 | fp a0 = (36.38391m); 83 | fp2x4 b0 = fp2x4(-400.4892m, -71.2868347m, 156.978088m, -225.238739m, 499.141785m, -211.979919m, 428.311951m, -489.501343m); 84 | bool2x4 r0 = bool2x4(false, false, false, false, false, false, false, false); 85 | TestUtils.AreEqual(a0 == b0, r0); 86 | 87 | fp a1 = (-5.691559m); 88 | fp2x4 b1 = fp2x4(-30.8659363m, -362.9831m, 184.503174m, -160.470612m, 316.668823m, 390.369263m, 505.1051m, -294.6487m); 89 | bool2x4 r1 = bool2x4(false, false, false, false, false, false, false, false); 90 | TestUtils.AreEqual(a1 == b1, r1); 91 | 92 | fp a2 = (443.1991m); 93 | fp2x4 b2 = fp2x4(96.5592651m, -257.012939m, -245.054962m, 326.464844m, -23.9599m, -168.694885m, 386.2486m, -227.090637m); 94 | bool2x4 r2 = bool2x4(false, false, false, false, false, false, false, false); 95 | TestUtils.AreEqual(a2 == b2, r2); 96 | 97 | fp a3 = (-336.612427m); 98 | fp2x4 b3 = fp2x4(365.108154m, -405.390839m, -473.995483m, 298.435364m, -149.86322m, 450.0664m, 153.47644m, 56.28778m); 99 | bool2x4 r3 = bool2x4(false, false, false, false, false, false, false, false); 100 | TestUtils.AreEqual(a3 == b3, r3); 101 | } 102 | 103 | [Test] 104 | public static void fp2x4_operator_not_equal_wide_wide() 105 | { 106 | fp2x4 a0 = fp2x4(279.994141m, -43.34201m, -465.724731m, 317.466553m, 85.7149658m, 360.8905m, 366.081543m, 154.542847m); 107 | fp2x4 b0 = fp2x4(-460.9121m, -476.009033m, 468.1364m, -341.012543m, -62.65805m, -458.801666m, -457.730225m, -59.5232544m); 108 | bool2x4 r0 = bool2x4(true, true, true, true, true, true, true, true); 109 | TestUtils.AreEqual(a0 != b0, r0); 110 | 111 | fp2x4 a1 = fp2x4(332.4262m, 397.11322m, -431.374969m, 489.0108m, 398.4336m, -489.817932m, 171.4049m, -67.82968m); 112 | fp2x4 b1 = fp2x4(3.024231m, 155.812744m, -19.8399048m, -6.01693726m, -406.207916m, -102.420715m, -40.362915m, 452.6754m); 113 | bool2x4 r1 = bool2x4(true, true, true, true, true, true, true, true); 114 | TestUtils.AreEqual(a1 != b1, r1); 115 | 116 | fp2x4 a2 = fp2x4(-192.278717m, 227.84082m, 62.1381836m, 262.186462m, -404.0531m, 34.449585m, -204.795776m, -285.4118m); 117 | fp2x4 b2 = fp2x4(93.25757m, -258.378052m, -184.0498m, -379.2353m, -370.687317m, -255.947235m, 29.0557861m, 322.407654m); 118 | bool2x4 r2 = bool2x4(true, true, true, true, true, true, true, true); 119 | TestUtils.AreEqual(a2 != b2, r2); 120 | 121 | fp2x4 a3 = fp2x4(-72.20682m, 444.749268m, 238.81781m, 365.1801m, -437.9229m, -362.442627m, 445.954346m, -0.417480469m); 122 | fp2x4 b3 = fp2x4(415.071716m, -467.726135m, -433.784668m, -212.165924m, 474.674927m, 452.483215m, -92.11273m, -385.9221m); 123 | bool2x4 r3 = bool2x4(true, true, true, true, true, true, true, true); 124 | TestUtils.AreEqual(a3 != b3, r3); 125 | } 126 | 127 | [Test] 128 | public static void fp2x4_operator_not_equal_wide_scalar() 129 | { 130 | fp2x4 a0 = fp2x4(-155.4411m, -19.4266052m, 174.633057m, 507.920715m, 59.177063m, 171.151489m, -58.92328m, -398.176849m); 131 | fp b0 = (-393.413544m); 132 | bool2x4 r0 = bool2x4(true, true, true, true, true, true, true, true); 133 | TestUtils.AreEqual(a0 != b0, r0); 134 | 135 | fp2x4 a1 = fp2x4(492.20105m, 270.341m, -380.243256m, 501.899048m, -134.345459m, 458.400452m, 46.7709961m, 161.459961m); 136 | fp b1 = (-165.241516m); 137 | bool2x4 r1 = bool2x4(true, true, true, true, true, true, true, true); 138 | TestUtils.AreEqual(a1 != b1, r1); 139 | 140 | fp2x4 a2 = fp2x4(261.514221m, -0.449920654m, 350.461426m, 202.221008m, 242.664m, 382.677063m, -468.967957m, -497.459473m); 141 | fp b2 = (-145.6124m); 142 | bool2x4 r2 = bool2x4(true, true, true, true, true, true, true, true); 143 | TestUtils.AreEqual(a2 != b2, r2); 144 | 145 | fp2x4 a3 = fp2x4(-80.93225m, -506.490326m, 449.348145m, 210.771m, 249.181824m, -338.468536m, 229.670654m, -76.5433044m); 146 | fp b3 = (-328.587769m); 147 | bool2x4 r3 = bool2x4(true, true, true, true, true, true, true, true); 148 | TestUtils.AreEqual(a3 != b3, r3); 149 | } 150 | 151 | [Test] 152 | public static void fp2x4_operator_not_equal_scalar_wide() 153 | { 154 | fp a0 = (478.353149m); 155 | fp2x4 b0 = fp2x4(459.553223m, 436.453247m, -488.714172m, 392.767944m, -266.736633m, 338.557861m, -338.100128m, -152.314545m); 156 | bool2x4 r0 = bool2x4(true, true, true, true, true, true, true, true); 157 | TestUtils.AreEqual(a0 != b0, r0); 158 | 159 | fp a1 = (-452.820679m); 160 | fp2x4 b1 = fp2x4(209.439331m, 50.10797m, 372.4344m, -488.0213m, 489.740784m, 270.4001m, -472.846771m, -286.850464m); 161 | bool2x4 r1 = bool2x4(true, true, true, true, true, true, true, true); 162 | TestUtils.AreEqual(a1 != b1, r1); 163 | 164 | fp a2 = (-384.691864m); 165 | fp2x4 b2 = fp2x4(443.423523m, 358.7472m, -15.4140625m, -342.179169m, 468.967529m, -130.568085m, 401.785828m, -268.352264m); 166 | bool2x4 r2 = bool2x4(true, true, true, true, true, true, true, true); 167 | TestUtils.AreEqual(a2 != b2, r2); 168 | 169 | fp a3 = (-239.231018m); 170 | fp2x4 b3 = fp2x4(411.386536m, 139.769348m, 334.522034m, -223.629242m, -12.4884644m, 113.468872m, -189.652252m, -212.846558m); 171 | bool2x4 r3 = bool2x4(true, true, true, true, true, true, true, true); 172 | TestUtils.AreEqual(a3 != b3, r3); 173 | } 174 | 175 | 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestFp2x4.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d48d1d5c3b4994a4eac3377fcad1c150 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestFp3.gen.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | using NUnit.Framework; 10 | using static Unity.Mathematics.FixedPoint.fpmath; 11 | using static Unity.Mathematics.math; 12 | 13 | namespace Unity.Mathematics.FixedPoint.Tests 14 | { 15 | [TestFixture] 16 | public class TestFp3 17 | { 18 | [Test] 19 | public static void fp3_zero() 20 | { 21 | TestUtils.AreEqual(fp3.zero.x, (fp)0); 22 | TestUtils.AreEqual(fp3.zero.y, (fp)0); 23 | TestUtils.AreEqual(fp3.zero.z, (fp)0); 24 | } 25 | 26 | [Test] 27 | public static void fp3_constructor() 28 | { 29 | fp3 a = new fp3(1, 2, 3); 30 | TestUtils.AreEqual(a.x, 1); 31 | TestUtils.AreEqual(a.y, 2); 32 | TestUtils.AreEqual(a.z, 3); 33 | } 34 | 35 | [Test] 36 | public static void fp3_scalar_constructor() 37 | { 38 | fp3 a = new fp3(17.0m); 39 | TestUtils.AreEqual(a.x, 17.0m); 40 | TestUtils.AreEqual(a.y, 17.0m); 41 | TestUtils.AreEqual(a.z, 17.0m); 42 | } 43 | 44 | [Test] 45 | public static void fp3_static_constructor() 46 | { 47 | fp3 a = fp3(1, 2, 3); 48 | TestUtils.AreEqual(a.x, 1); 49 | TestUtils.AreEqual(a.y, 2); 50 | TestUtils.AreEqual(a.z, 3); 51 | } 52 | 53 | [Test] 54 | public static void fp3_static_scalar_constructor() 55 | { 56 | fp3 a = fp3(17.0m); 57 | TestUtils.AreEqual(a.x, 17.0m); 58 | TestUtils.AreEqual(a.y, 17.0m); 59 | TestUtils.AreEqual(a.z, 17.0m); 60 | } 61 | 62 | [Test] 63 | public static void fp3_operator_equal_wide_wide() 64 | { 65 | fp3 a0 = fp3(-135.18924m, -49.0941162m, 169.129822m); 66 | fp3 b0 = fp3(-220.014648m, 66.98004m, 499.2016m); 67 | bool3 r0 = bool3(false, false, false); 68 | TestUtils.AreEqual(a0 == b0, r0); 69 | 70 | fp3 a1 = fp3(240.8053m, 314.7392m, 442.393m); 71 | fp3 b1 = fp3(-371.1131m, 208.448669m, 390.8037m); 72 | bool3 r1 = bool3(false, false, false); 73 | TestUtils.AreEqual(a1 == b1, r1); 74 | 75 | fp3 a2 = fp3(177.924438m, 335.5334m, 168.15448m); 76 | fp3 b2 = fp3(-72.44382m, 362.97644m, 194.678345m); 77 | bool3 r2 = bool3(false, false, false); 78 | TestUtils.AreEqual(a2 == b2, r2); 79 | 80 | fp3 a3 = fp3(350.729553m, 367.178467m, 46.9414673m); 81 | fp3 b3 = fp3(471.644836m, -404.044678m, -144.696747m); 82 | bool3 r3 = bool3(false, false, false); 83 | TestUtils.AreEqual(a3 == b3, r3); 84 | } 85 | 86 | [Test] 87 | public static void fp3_operator_equal_wide_scalar() 88 | { 89 | fp3 a0 = fp3(65.6712m, 404.415527m, -269.730164m); 90 | fp b0 = (-155.815765m); 91 | bool3 r0 = bool3(false, false, false); 92 | TestUtils.AreEqual(a0 == b0, r0); 93 | 94 | fp3 a1 = fp3(83.6306152m, -155.868286m, 314.671265m); 95 | fp b1 = (152.9945m); 96 | bool3 r1 = bool3(false, false, false); 97 | TestUtils.AreEqual(a1 == b1, r1); 98 | 99 | fp3 a2 = fp3(386.365173m, -132.6352m, -65.66748m); 100 | fp b2 = (290.04895m); 101 | bool3 r2 = bool3(false, false, false); 102 | TestUtils.AreEqual(a2 == b2, r2); 103 | 104 | fp3 a3 = fp3(-69.68326m, 186.845215m, -232.895691m); 105 | fp b3 = (-191.190765m); 106 | bool3 r3 = bool3(false, false, false); 107 | TestUtils.AreEqual(a3 == b3, r3); 108 | } 109 | 110 | [Test] 111 | public static void fp3_operator_equal_scalar_wide() 112 | { 113 | fp a0 = (36.38391m); 114 | fp3 b0 = fp3(-400.4892m, -71.2868347m, 156.978088m); 115 | bool3 r0 = bool3(false, false, false); 116 | TestUtils.AreEqual(a0 == b0, r0); 117 | 118 | fp a1 = (-225.238739m); 119 | fp3 b1 = fp3(499.141785m, -211.979919m, 428.311951m); 120 | bool3 r1 = bool3(false, false, false); 121 | TestUtils.AreEqual(a1 == b1, r1); 122 | 123 | fp a2 = (-489.501343m); 124 | fp3 b2 = fp3(-5.691559m, -30.8659363m, -362.9831m); 125 | bool3 r2 = bool3(false, false, false); 126 | TestUtils.AreEqual(a2 == b2, r2); 127 | 128 | fp a3 = (184.503174m); 129 | fp3 b3 = fp3(-160.470612m, 316.668823m, 390.369263m); 130 | bool3 r3 = bool3(false, false, false); 131 | TestUtils.AreEqual(a3 == b3, r3); 132 | } 133 | 134 | [Test] 135 | public static void fp3_operator_not_equal_wide_wide() 136 | { 137 | fp3 a0 = fp3(279.994141m, -43.34201m, -465.724731m); 138 | fp3 b0 = fp3(-460.9121m, -476.009033m, 468.1364m); 139 | bool3 r0 = bool3(true, true, true); 140 | TestUtils.AreEqual(a0 != b0, r0); 141 | 142 | fp3 a1 = fp3(317.466553m, 85.7149658m, 360.8905m); 143 | fp3 b1 = fp3(-341.012543m, -62.65805m, -458.801666m); 144 | bool3 r1 = bool3(true, true, true); 145 | TestUtils.AreEqual(a1 != b1, r1); 146 | 147 | fp3 a2 = fp3(366.081543m, 154.542847m, 332.4262m); 148 | fp3 b2 = fp3(-457.730225m, -59.5232544m, 3.024231m); 149 | bool3 r2 = bool3(true, true, true); 150 | TestUtils.AreEqual(a2 != b2, r2); 151 | 152 | fp3 a3 = fp3(397.11322m, -431.374969m, 489.0108m); 153 | fp3 b3 = fp3(155.812744m, -19.8399048m, -6.01693726m); 154 | bool3 r3 = bool3(true, true, true); 155 | TestUtils.AreEqual(a3 != b3, r3); 156 | } 157 | 158 | [Test] 159 | public static void fp3_operator_not_equal_wide_scalar() 160 | { 161 | fp3 a0 = fp3(-155.4411m, -19.4266052m, 174.633057m); 162 | fp b0 = (-393.413544m); 163 | bool3 r0 = bool3(true, true, true); 164 | TestUtils.AreEqual(a0 != b0, r0); 165 | 166 | fp3 a1 = fp3(507.920715m, 171.151489m, -58.92328m); 167 | fp b1 = (59.177063m); 168 | bool3 r1 = bool3(true, true, true); 169 | TestUtils.AreEqual(a1 != b1, r1); 170 | 171 | fp3 a2 = fp3(-398.176849m, -165.241516m, 270.341m); 172 | fp b2 = (492.20105m); 173 | bool3 r2 = bool3(true, true, true); 174 | TestUtils.AreEqual(a2 != b2, r2); 175 | 176 | fp3 a3 = fp3(-380.243256m, -134.345459m, 458.400452m); 177 | fp b3 = (501.899048m); 178 | bool3 r3 = bool3(true, true, true); 179 | TestUtils.AreEqual(a3 != b3, r3); 180 | } 181 | 182 | [Test] 183 | public static void fp3_operator_not_equal_scalar_wide() 184 | { 185 | fp a0 = (478.353149m); 186 | fp3 b0 = fp3(459.553223m, 436.453247m, -488.714172m); 187 | bool3 r0 = bool3(true, true, true); 188 | TestUtils.AreEqual(a0 != b0, r0); 189 | 190 | fp a1 = (392.767944m); 191 | fp3 b1 = fp3(-266.736633m, 338.557861m, -338.100128m); 192 | bool3 r1 = bool3(true, true, true); 193 | TestUtils.AreEqual(a1 != b1, r1); 194 | 195 | fp a2 = (-152.314545m); 196 | fp3 b2 = fp3(-452.820679m, 209.439331m, 50.10797m); 197 | bool3 r2 = bool3(true, true, true); 198 | TestUtils.AreEqual(a2 != b2, r2); 199 | 200 | fp a3 = (372.4344m); 201 | fp3 b3 = fp3(-488.0213m, 489.740784m, 270.4001m); 202 | bool3 r3 = bool3(true, true, true); 203 | TestUtils.AreEqual(a3 != b3, r3); 204 | } 205 | 206 | [Test] 207 | public static void fp3_shuffle_result_1() 208 | { 209 | fp3 a = fp3(0, 1, 2); 210 | fp3 b = fp3(3, 4, 5); 211 | 212 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftX), (0)); 213 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftY), (1)); 214 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftZ), (2)); 215 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX), (3)); 216 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY), (4)); 217 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ), (5)); 218 | } 219 | 220 | [Test] 221 | public static void fp3_shuffle_result_2() 222 | { 223 | fp3 a = fp3(0, 1, 2); 224 | fp3 b = fp3(3, 4, 5); 225 | 226 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.RightY), fp2(4, 4)); 227 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.RightX), fp2(4, 3)); 228 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftY, ShuffleComponent.RightX), fp2(1, 3)); 229 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.LeftZ), fp2(5, 2)); 230 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.LeftY), fp2(5, 1)); 231 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftY, ShuffleComponent.LeftZ), fp2(1, 2)); 232 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.LeftZ), fp2(3, 2)); 233 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.LeftX), fp2(5, 0)); 234 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.RightZ), fp2(5, 5)); 235 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftY), fp2(4, 1)); 236 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.RightZ), fp2(4, 5)); 237 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.LeftX), fp2(5, 0)); 238 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.RightX), fp2(4, 3)); 239 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.RightY), fp2(5, 4)); 240 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.LeftX), fp2(3, 0)); 241 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftY, ShuffleComponent.LeftZ), fp2(1, 2)); 242 | } 243 | 244 | [Test] 245 | public static void fp3_shuffle_result_3() 246 | { 247 | fp3 a = fp3(0, 1, 2); 248 | fp3 b = fp3(3, 4, 5); 249 | 250 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftY, ShuffleComponent.RightZ, ShuffleComponent.RightX), fp3(1, 5, 3)); 251 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftX, ShuffleComponent.LeftZ), fp3(4, 0, 2)); 252 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftZ, ShuffleComponent.RightZ, ShuffleComponent.RightX), fp3(2, 5, 3)); 253 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftX, ShuffleComponent.LeftY), fp3(4, 0, 1)); 254 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.RightY, ShuffleComponent.LeftZ), fp3(5, 4, 2)); 255 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftZ, ShuffleComponent.LeftX, ShuffleComponent.LeftY), fp3(2, 0, 1)); 256 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftZ, ShuffleComponent.RightY, ShuffleComponent.RightX), fp3(2, 4, 3)); 257 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftZ, ShuffleComponent.LeftY, ShuffleComponent.RightZ), fp3(2, 1, 5)); 258 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.RightY, ShuffleComponent.RightZ), fp3(4, 4, 5)); 259 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.RightX, ShuffleComponent.LeftY), fp3(4, 3, 1)); 260 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.RightZ, ShuffleComponent.LeftX), fp3(5, 5, 0)); 261 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.LeftY, ShuffleComponent.RightX), fp3(5, 1, 3)); 262 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftY, ShuffleComponent.RightZ), fp3(4, 1, 5)); 263 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftZ, ShuffleComponent.RightX, ShuffleComponent.RightY), fp3(2, 3, 4)); 264 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftX, ShuffleComponent.RightY), fp3(4, 0, 4)); 265 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftX, ShuffleComponent.RightZ), fp3(4, 0, 5)); 266 | } 267 | 268 | [Test] 269 | public static void fp3_shuffle_result_4() 270 | { 271 | fp3 a = fp3(0, 1, 2); 272 | fp3 b = fp3(3, 4, 5); 273 | 274 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftY, ShuffleComponent.LeftZ, ShuffleComponent.RightX, ShuffleComponent.LeftY), fp4(1, 2, 3, 1)); 275 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftZ, ShuffleComponent.RightZ, ShuffleComponent.RightY), fp4(4, 2, 5, 4)); 276 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.RightY, ShuffleComponent.RightZ, ShuffleComponent.LeftY), fp4(4, 4, 5, 1)); 277 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.RightX, ShuffleComponent.LeftY, ShuffleComponent.LeftY), fp4(3, 3, 1, 1)); 278 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftY, ShuffleComponent.LeftY, ShuffleComponent.LeftX), fp4(4, 1, 1, 0)); 279 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.RightY, ShuffleComponent.RightX, ShuffleComponent.RightZ), fp4(3, 4, 3, 5)); 280 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftY, ShuffleComponent.RightZ, ShuffleComponent.LeftX, ShuffleComponent.RightZ), fp4(1, 5, 0, 5)); 281 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftX, ShuffleComponent.LeftX, ShuffleComponent.LeftX), fp4(4, 0, 0, 0)); 282 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.RightZ, ShuffleComponent.LeftZ, ShuffleComponent.LeftX), fp4(3, 5, 2, 0)); 283 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.RightX, ShuffleComponent.LeftY, ShuffleComponent.RightX), fp4(4, 3, 1, 3)); 284 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftX, ShuffleComponent.LeftZ, ShuffleComponent.RightZ, ShuffleComponent.LeftX), fp4(0, 2, 5, 0)); 285 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftY, ShuffleComponent.RightY, ShuffleComponent.RightZ, ShuffleComponent.RightZ), fp4(1, 4, 5, 5)); 286 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftZ, ShuffleComponent.RightX, ShuffleComponent.LeftY, ShuffleComponent.RightX), fp4(2, 3, 1, 3)); 287 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.LeftX, ShuffleComponent.LeftY, ShuffleComponent.LeftZ), fp4(3, 0, 1, 2)); 288 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.RightX, ShuffleComponent.LeftX, ShuffleComponent.RightY), fp4(5, 3, 0, 4)); 289 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftZ, ShuffleComponent.RightZ, ShuffleComponent.LeftX, ShuffleComponent.RightY), fp4(2, 5, 0, 4)); 290 | } 291 | 292 | 293 | } 294 | } 295 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestFp3.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0c44b556476367f4a956a5adcee55770 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestFp3x2.gen.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | using NUnit.Framework; 10 | using static Unity.Mathematics.FixedPoint.fpmath; 11 | using static Unity.Mathematics.math; 12 | 13 | namespace Unity.Mathematics.FixedPoint.Tests 14 | { 15 | [TestFixture] 16 | public class TestFp3x2 17 | { 18 | [Test] 19 | public static void fp3x2_zero() 20 | { 21 | TestUtils.AreEqual(fp3x2.zero.c0.x, (fp)0); 22 | TestUtils.AreEqual(fp3x2.zero.c0.y, (fp)0); 23 | TestUtils.AreEqual(fp3x2.zero.c0.z, (fp)0); 24 | TestUtils.AreEqual(fp3x2.zero.c1.x, (fp)0); 25 | TestUtils.AreEqual(fp3x2.zero.c1.y, (fp)0); 26 | TestUtils.AreEqual(fp3x2.zero.c1.z, (fp)0); 27 | } 28 | 29 | [Test] 30 | public static void fp3x2_operator_equal_wide_wide() 31 | { 32 | fp3x2 a0 = fp3x2(-135.18924m, -49.0941162m, 169.129822m, 240.8053m, 314.7392m, 442.393m); 33 | fp3x2 b0 = fp3x2(-220.014648m, 66.98004m, 499.2016m, -371.1131m, 208.448669m, 390.8037m); 34 | bool3x2 r0 = bool3x2(false, false, false, false, false, false); 35 | TestUtils.AreEqual(a0 == b0, r0); 36 | 37 | fp3x2 a1 = fp3x2(177.924438m, 335.5334m, 168.15448m, 350.729553m, 367.178467m, 46.9414673m); 38 | fp3x2 b1 = fp3x2(-72.44382m, 362.97644m, 194.678345m, 471.644836m, -404.044678m, -144.696747m); 39 | bool3x2 r1 = bool3x2(false, false, false, false, false, false); 40 | TestUtils.AreEqual(a1 == b1, r1); 41 | 42 | fp3x2 a2 = fp3x2(188.76416m, -97.2113953m, -293.320984m, -234.822937m, 417.0337m, 26.3864136m); 43 | fp3x2 b2 = fp3x2(-494.446655m, -252.970367m, 234.417114m, 398.724m, 260.4287m, 370.144226m); 44 | bool3x2 r2 = bool3x2(false, false, false, false, false, false); 45 | TestUtils.AreEqual(a2 == b2, r2); 46 | 47 | fp3x2 a3 = fp3x2(269.245728m, 29.4741821m, 479.485229m, -237.230957m, -221.9837m, -506.672546m); 48 | fp3x2 b3 = fp3x2(89.579834m, -434.816833m, -109.845337m, 336.973022m, -409.154968m, 500.387573m); 49 | bool3x2 r3 = bool3x2(false, false, false, false, false, false); 50 | TestUtils.AreEqual(a3 == b3, r3); 51 | } 52 | 53 | [Test] 54 | public static void fp3x2_operator_equal_wide_scalar() 55 | { 56 | fp3x2 a0 = fp3x2(65.6712m, 404.415527m, -269.730164m, 83.6306152m, 152.9945m, -155.868286m); 57 | fp b0 = (-155.815765m); 58 | bool3x2 r0 = bool3x2(false, false, false, false, false, false); 59 | TestUtils.AreEqual(a0 == b0, r0); 60 | 61 | fp3x2 a1 = fp3x2(314.671265m, 290.04895m, -132.6352m, -65.66748m, -69.68326m, -191.190765m); 62 | fp b1 = (386.365173m); 63 | bool3x2 r1 = bool3x2(false, false, false, false, false, false); 64 | TestUtils.AreEqual(a1 == b1, r1); 65 | 66 | fp3x2 a2 = fp3x2(186.845215m, -319.144043m, -49.70108m, -300.8819m, 333.396851m, 386.3775m); 67 | fp b2 = (-232.895691m); 68 | bool3x2 r2 = bool3x2(false, false, false, false, false, false); 69 | TestUtils.AreEqual(a2 == b2, r2); 70 | 71 | fp3x2 a3 = fp3x2(-296.7019m, 141.542358m, -227.323334m, 83.87286m, -410.91687m, 110.501282m); 72 | fp b3 = (-309.1172m); 73 | bool3x2 r3 = bool3x2(false, false, false, false, false, false); 74 | TestUtils.AreEqual(a3 == b3, r3); 75 | } 76 | 77 | [Test] 78 | public static void fp3x2_operator_equal_scalar_wide() 79 | { 80 | fp a0 = (36.38391m); 81 | fp3x2 b0 = fp3x2(-400.4892m, -71.2868347m, 156.978088m, -225.238739m, 499.141785m, -211.979919m); 82 | bool3x2 r0 = bool3x2(false, false, false, false, false, false); 83 | TestUtils.AreEqual(a0 == b0, r0); 84 | 85 | fp a1 = (428.311951m); 86 | fp3x2 b1 = fp3x2(-489.501343m, -5.691559m, -30.8659363m, -362.9831m, 184.503174m, -160.470612m); 87 | bool3x2 r1 = bool3x2(false, false, false, false, false, false); 88 | TestUtils.AreEqual(a1 == b1, r1); 89 | 90 | fp a2 = (316.668823m); 91 | fp3x2 b2 = fp3x2(390.369263m, 505.1051m, -294.6487m, 443.1991m, 96.5592651m, -257.012939m); 92 | bool3x2 r2 = bool3x2(false, false, false, false, false, false); 93 | TestUtils.AreEqual(a2 == b2, r2); 94 | 95 | fp a3 = (-245.054962m); 96 | fp3x2 b3 = fp3x2(326.464844m, -23.9599m, -168.694885m, 386.2486m, -227.090637m, -336.612427m); 97 | bool3x2 r3 = bool3x2(false, false, false, false, false, false); 98 | TestUtils.AreEqual(a3 == b3, r3); 99 | } 100 | 101 | [Test] 102 | public static void fp3x2_operator_not_equal_wide_wide() 103 | { 104 | fp3x2 a0 = fp3x2(279.994141m, -43.34201m, -465.724731m, 317.466553m, 85.7149658m, 360.8905m); 105 | fp3x2 b0 = fp3x2(-460.9121m, -476.009033m, 468.1364m, -341.012543m, -62.65805m, -458.801666m); 106 | bool3x2 r0 = bool3x2(true, true, true, true, true, true); 107 | TestUtils.AreEqual(a0 != b0, r0); 108 | 109 | fp3x2 a1 = fp3x2(366.081543m, 154.542847m, 332.4262m, 397.11322m, -431.374969m, 489.0108m); 110 | fp3x2 b1 = fp3x2(-457.730225m, -59.5232544m, 3.024231m, 155.812744m, -19.8399048m, -6.01693726m); 111 | bool3x2 r1 = bool3x2(true, true, true, true, true, true); 112 | TestUtils.AreEqual(a1 != b1, r1); 113 | 114 | fp3x2 a2 = fp3x2(398.4336m, -489.817932m, 171.4049m, -67.82968m, -192.278717m, 227.84082m); 115 | fp3x2 b2 = fp3x2(-406.207916m, -102.420715m, -40.362915m, 452.6754m, 93.25757m, -258.378052m); 116 | bool3x2 r2 = bool3x2(true, true, true, true, true, true); 117 | TestUtils.AreEqual(a2 != b2, r2); 118 | 119 | fp3x2 a3 = fp3x2(62.1381836m, 262.186462m, -404.0531m, 34.449585m, -204.795776m, -285.4118m); 120 | fp3x2 b3 = fp3x2(-184.0498m, -379.2353m, -370.687317m, -255.947235m, 29.0557861m, 322.407654m); 121 | bool3x2 r3 = bool3x2(true, true, true, true, true, true); 122 | TestUtils.AreEqual(a3 != b3, r3); 123 | } 124 | 125 | [Test] 126 | public static void fp3x2_operator_not_equal_wide_scalar() 127 | { 128 | fp3x2 a0 = fp3x2(-155.4411m, -19.4266052m, 174.633057m, 507.920715m, 59.177063m, 171.151489m); 129 | fp b0 = (-393.413544m); 130 | bool3x2 r0 = bool3x2(true, true, true, true, true, true); 131 | TestUtils.AreEqual(a0 != b0, r0); 132 | 133 | fp3x2 a1 = fp3x2(-58.92328m, 492.20105m, -165.241516m, 270.341m, -380.243256m, 501.899048m); 134 | fp b1 = (-398.176849m); 135 | bool3x2 r1 = bool3x2(true, true, true, true, true, true); 136 | TestUtils.AreEqual(a1 != b1, r1); 137 | 138 | fp3x2 a2 = fp3x2(-134.345459m, 46.7709961m, 161.459961m, 261.514221m, -145.6124m, -0.449920654m); 139 | fp b2 = (458.400452m); 140 | bool3x2 r2 = bool3x2(true, true, true, true, true, true); 141 | TestUtils.AreEqual(a2 != b2, r2); 142 | 143 | fp3x2 a3 = fp3x2(350.461426m, 242.664m, 382.677063m, -468.967957m, -497.459473m, -80.93225m); 144 | fp b3 = (202.221008m); 145 | bool3x2 r3 = bool3x2(true, true, true, true, true, true); 146 | TestUtils.AreEqual(a3 != b3, r3); 147 | } 148 | 149 | [Test] 150 | public static void fp3x2_operator_not_equal_scalar_wide() 151 | { 152 | fp a0 = (478.353149m); 153 | fp3x2 b0 = fp3x2(459.553223m, 436.453247m, -488.714172m, 392.767944m, -266.736633m, 338.557861m); 154 | bool3x2 r0 = bool3x2(true, true, true, true, true, true); 155 | TestUtils.AreEqual(a0 != b0, r0); 156 | 157 | fp a1 = (-338.100128m); 158 | fp3x2 b1 = fp3x2(-152.314545m, -452.820679m, 209.439331m, 50.10797m, 372.4344m, -488.0213m); 159 | bool3x2 r1 = bool3x2(true, true, true, true, true, true); 160 | TestUtils.AreEqual(a1 != b1, r1); 161 | 162 | fp a2 = (489.740784m); 163 | fp3x2 b2 = fp3x2(270.4001m, -472.846771m, -286.850464m, -384.691864m, 443.423523m, 358.7472m); 164 | bool3x2 r2 = bool3x2(true, true, true, true, true, true); 165 | TestUtils.AreEqual(a2 != b2, r2); 166 | 167 | fp a3 = (-15.4140625m); 168 | fp3x2 b3 = fp3x2(-342.179169m, 468.967529m, -130.568085m, 401.785828m, -268.352264m, -239.231018m); 169 | bool3x2 r3 = bool3x2(true, true, true, true, true, true); 170 | TestUtils.AreEqual(a3 != b3, r3); 171 | } 172 | 173 | 174 | } 175 | } 176 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestFp3x2.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a5d2625ffc85e72449c924623c87ffcb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestFp3x3.gen.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | using NUnit.Framework; 10 | using static Unity.Mathematics.FixedPoint.fpmath; 11 | using static Unity.Mathematics.math; 12 | 13 | namespace Unity.Mathematics.FixedPoint.Tests 14 | { 15 | [TestFixture] 16 | public class TestFp3x3 17 | { 18 | [Test] 19 | public static void fp3x3_zero() 20 | { 21 | TestUtils.AreEqual(fp3x3.zero.c0.x, (fp)0); 22 | TestUtils.AreEqual(fp3x3.zero.c0.y, (fp)0); 23 | TestUtils.AreEqual(fp3x3.zero.c0.z, (fp)0); 24 | TestUtils.AreEqual(fp3x3.zero.c1.x, (fp)0); 25 | TestUtils.AreEqual(fp3x3.zero.c1.y, (fp)0); 26 | TestUtils.AreEqual(fp3x3.zero.c1.z, (fp)0); 27 | TestUtils.AreEqual(fp3x3.zero.c2.x, (fp)0); 28 | TestUtils.AreEqual(fp3x3.zero.c2.y, (fp)0); 29 | TestUtils.AreEqual(fp3x3.zero.c2.z, (fp)0); 30 | } 31 | 32 | [Test] 33 | public static void fp3x3_identity() 34 | { 35 | TestUtils.AreEqual(fp3x3.identity.c0.x, (fp)1); 36 | TestUtils.AreEqual(fp3x3.identity.c0.y, (fp)0); 37 | TestUtils.AreEqual(fp3x3.identity.c0.z, (fp)0); 38 | TestUtils.AreEqual(fp3x3.identity.c1.x, (fp)0); 39 | TestUtils.AreEqual(fp3x3.identity.c1.y, (fp)1); 40 | TestUtils.AreEqual(fp3x3.identity.c1.z, (fp)0); 41 | TestUtils.AreEqual(fp3x3.identity.c2.x, (fp)0); 42 | TestUtils.AreEqual(fp3x3.identity.c2.y, (fp)0); 43 | TestUtils.AreEqual(fp3x3.identity.c2.z, (fp)1); 44 | } 45 | 46 | [Test] 47 | public static void fp3x3_operator_equal_wide_wide() 48 | { 49 | fp3x3 a0 = fp3x3(-135.18924m, -49.0941162m, 169.129822m, 240.8053m, 314.7392m, 442.393m, 177.924438m, 335.5334m, 168.15448m); 50 | fp3x3 b0 = fp3x3(-220.014648m, 66.98004m, 499.2016m, -371.1131m, 208.448669m, 390.8037m, -72.44382m, 362.97644m, 194.678345m); 51 | bool3x3 r0 = bool3x3(false, false, false, false, false, false, false, false, false); 52 | TestUtils.AreEqual(a0 == b0, r0); 53 | 54 | fp3x3 a1 = fp3x3(350.729553m, 367.178467m, 46.9414673m, 188.76416m, -97.2113953m, -293.320984m, -234.822937m, 417.0337m, 26.3864136m); 55 | fp3x3 b1 = fp3x3(471.644836m, -404.044678m, -144.696747m, -494.446655m, -252.970367m, 234.417114m, 398.724m, 260.4287m, 370.144226m); 56 | bool3x3 r1 = bool3x3(false, false, false, false, false, false, false, false, false); 57 | TestUtils.AreEqual(a1 == b1, r1); 58 | 59 | fp3x3 a2 = fp3x3(269.245728m, 29.4741821m, 479.485229m, -237.230957m, -221.9837m, -506.672546m, -22.98944m, 487.260864m, -419.731964m); 60 | fp3x3 b2 = fp3x3(89.579834m, -434.816833m, -109.845337m, 336.973022m, -409.154968m, 500.387573m, -174.081818m, 395.101135m, 350.3393m); 61 | bool3x3 r2 = bool3x3(false, false, false, false, false, false, false, false, false); 62 | TestUtils.AreEqual(a2 == b2, r2); 63 | 64 | fp3x3 a3 = fp3x3(337.2033m, 245.043884m, 390.215881m, 84.4129639m, 434.2079m, -68.7284241m, 485.769958m, 413.169739m, -418.2693m); 65 | fp3x3 b3 = fp3x3(-243.144592m, -416.397369m, 151.576477m, -18.2243347m, -431.677917m, -468.330963m, 429.495728m, 477.389221m, -433.4254m); 66 | bool3x3 r3 = bool3x3(false, false, false, false, false, false, false, false, false); 67 | TestUtils.AreEqual(a3 == b3, r3); 68 | } 69 | 70 | [Test] 71 | public static void fp3x3_operator_equal_wide_scalar() 72 | { 73 | fp3x3 a0 = fp3x3(65.6712m, 404.415527m, -269.730164m, 83.6306152m, 152.9945m, -155.868286m, 314.671265m, 386.365173m, 290.04895m); 74 | fp b0 = (-155.815765m); 75 | bool3x3 r0 = bool3x3(false, false, false, false, false, false, false, false, false); 76 | TestUtils.AreEqual(a0 == b0, r0); 77 | 78 | fp3x3 a1 = fp3x3(-132.6352m, -69.68326m, -191.190765m, 186.845215m, -232.895691m, -319.144043m, -49.70108m, -300.8819m, 333.396851m); 79 | fp b1 = (-65.66748m); 80 | bool3x3 r1 = bool3x3(false, false, false, false, false, false, false, false, false); 81 | TestUtils.AreEqual(a1 == b1, r1); 82 | 83 | fp3x3 a2 = fp3x3(386.3775m, -309.1172m, 141.542358m, -227.323334m, 83.87286m, -410.91687m, 110.501282m, -390.103577m, 36.57434m); 84 | fp b2 = (-296.7019m); 85 | bool3x3 r2 = bool3x3(false, false, false, false, false, false, false, false, false); 86 | TestUtils.AreEqual(a2 == b2, r2); 87 | 88 | fp3x3 a3 = fp3x3(-427.541443m, 175.8117m, -193.47995m, 291.051941m, 423.97168m, -429.8739m, -275.156952m, -56.3323669m, -95.83597m); 89 | fp b3 = (-268.170837m); 90 | bool3x3 r3 = bool3x3(false, false, false, false, false, false, false, false, false); 91 | TestUtils.AreEqual(a3 == b3, r3); 92 | } 93 | 94 | [Test] 95 | public static void fp3x3_operator_equal_scalar_wide() 96 | { 97 | fp a0 = (36.38391m); 98 | fp3x3 b0 = fp3x3(-400.4892m, -71.2868347m, 156.978088m, -225.238739m, 499.141785m, -211.979919m, 428.311951m, -489.501343m, -5.691559m); 99 | bool3x3 r0 = bool3x3(false, false, false, false, false, false, false, false, false); 100 | TestUtils.AreEqual(a0 == b0, r0); 101 | 102 | fp a1 = (-30.8659363m); 103 | fp3x3 b1 = fp3x3(-362.9831m, 184.503174m, -160.470612m, 316.668823m, 390.369263m, 505.1051m, -294.6487m, 443.1991m, 96.5592651m); 104 | bool3x3 r1 = bool3x3(false, false, false, false, false, false, false, false, false); 105 | TestUtils.AreEqual(a1 == b1, r1); 106 | 107 | fp a2 = (-257.012939m); 108 | fp3x3 b2 = fp3x3(-245.054962m, 326.464844m, -23.9599m, -168.694885m, 386.2486m, -227.090637m, -336.612427m, 365.108154m, -405.390839m); 109 | bool3x3 r2 = bool3x3(false, false, false, false, false, false, false, false, false); 110 | TestUtils.AreEqual(a2 == b2, r2); 111 | 112 | fp a3 = (-473.995483m); 113 | fp3x3 b3 = fp3x3(298.435364m, -149.86322m, 450.0664m, 153.47644m, 56.28778m, 39.3421021m, -350.403717m, -482.717224m, 239.9654m); 114 | bool3x3 r3 = bool3x3(false, false, false, false, false, false, false, false, false); 115 | TestUtils.AreEqual(a3 == b3, r3); 116 | } 117 | 118 | [Test] 119 | public static void fp3x3_operator_not_equal_wide_wide() 120 | { 121 | fp3x3 a0 = fp3x3(279.994141m, -43.34201m, -465.724731m, 317.466553m, 85.7149658m, 360.8905m, 366.081543m, 154.542847m, 332.4262m); 122 | fp3x3 b0 = fp3x3(-460.9121m, -476.009033m, 468.1364m, -341.012543m, -62.65805m, -458.801666m, -457.730225m, -59.5232544m, 3.024231m); 123 | bool3x3 r0 = bool3x3(true, true, true, true, true, true, true, true, true); 124 | TestUtils.AreEqual(a0 != b0, r0); 125 | 126 | fp3x3 a1 = fp3x3(397.11322m, -431.374969m, 489.0108m, 398.4336m, -489.817932m, 171.4049m, -67.82968m, -192.278717m, 227.84082m); 127 | fp3x3 b1 = fp3x3(155.812744m, -19.8399048m, -6.01693726m, -406.207916m, -102.420715m, -40.362915m, 452.6754m, 93.25757m, -258.378052m); 128 | bool3x3 r1 = bool3x3(true, true, true, true, true, true, true, true, true); 129 | TestUtils.AreEqual(a1 != b1, r1); 130 | 131 | fp3x3 a2 = fp3x3(62.1381836m, 262.186462m, -404.0531m, 34.449585m, -204.795776m, -285.4118m, -72.20682m, 444.749268m, 238.81781m); 132 | fp3x3 b2 = fp3x3(-184.0498m, -379.2353m, -370.687317m, -255.947235m, 29.0557861m, 322.407654m, 415.071716m, -467.726135m, -433.784668m); 133 | bool3x3 r2 = bool3x3(true, true, true, true, true, true, true, true, true); 134 | TestUtils.AreEqual(a2 != b2, r2); 135 | 136 | fp3x3 a3 = fp3x3(365.1801m, -437.9229m, -362.442627m, 445.954346m, -0.417480469m, -506.828369m, 245.477051m, -173.571045m, 390.338562m); 137 | fp3x3 b3 = fp3x3(-212.165924m, 474.674927m, 452.483215m, -92.11273m, -385.9221m, 420.2151m, -239.176056m, -99.0791m, 4.476013m); 138 | bool3x3 r3 = bool3x3(true, true, true, true, true, true, true, true, true); 139 | TestUtils.AreEqual(a3 != b3, r3); 140 | } 141 | 142 | [Test] 143 | public static void fp3x3_operator_not_equal_wide_scalar() 144 | { 145 | fp3x3 a0 = fp3x3(-155.4411m, -19.4266052m, 174.633057m, 507.920715m, 59.177063m, 171.151489m, -58.92328m, -398.176849m, 492.20105m); 146 | fp b0 = (-393.413544m); 147 | bool3x3 r0 = bool3x3(true, true, true, true, true, true, true, true, true); 148 | TestUtils.AreEqual(a0 != b0, r0); 149 | 150 | fp3x3 a1 = fp3x3(-165.241516m, -380.243256m, 501.899048m, -134.345459m, 458.400452m, 46.7709961m, 161.459961m, 261.514221m, -145.6124m); 151 | fp b1 = (270.341m); 152 | bool3x3 r1 = bool3x3(true, true, true, true, true, true, true, true, true); 153 | TestUtils.AreEqual(a1 != b1, r1); 154 | 155 | fp3x3 a2 = fp3x3(-0.449920654m, 202.221008m, 242.664m, 382.677063m, -468.967957m, -497.459473m, -80.93225m, -328.587769m, -506.490326m); 156 | fp b2 = (350.461426m); 157 | bool3x3 r2 = bool3x3(true, true, true, true, true, true, true, true, true); 158 | TestUtils.AreEqual(a2 != b2, r2); 159 | 160 | fp3x3 a3 = fp3x3(449.348145m, 249.181824m, -338.468536m, 229.670654m, -76.5433044m, 317.286072m, 401.939575m, 210.984863m, -147.096313m); 161 | fp b3 = (210.771m); 162 | bool3x3 r3 = bool3x3(true, true, true, true, true, true, true, true, true); 163 | TestUtils.AreEqual(a3 != b3, r3); 164 | } 165 | 166 | [Test] 167 | public static void fp3x3_operator_not_equal_scalar_wide() 168 | { 169 | fp a0 = (478.353149m); 170 | fp3x3 b0 = fp3x3(459.553223m, 436.453247m, -488.714172m, 392.767944m, -266.736633m, 338.557861m, -338.100128m, -152.314545m, -452.820679m); 171 | bool3x3 r0 = bool3x3(true, true, true, true, true, true, true, true, true); 172 | TestUtils.AreEqual(a0 != b0, r0); 173 | 174 | fp a1 = (209.439331m); 175 | fp3x3 b1 = fp3x3(50.10797m, 372.4344m, -488.0213m, 489.740784m, 270.4001m, -472.846771m, -286.850464m, -384.691864m, 443.423523m); 176 | bool3x3 r1 = bool3x3(true, true, true, true, true, true, true, true, true); 177 | TestUtils.AreEqual(a1 != b1, r1); 178 | 179 | fp a2 = (358.7472m); 180 | fp3x3 b2 = fp3x3(-15.4140625m, -342.179169m, 468.967529m, -130.568085m, 401.785828m, -268.352264m, -239.231018m, 411.386536m, 139.769348m); 181 | bool3x3 r2 = bool3x3(true, true, true, true, true, true, true, true, true); 182 | TestUtils.AreEqual(a2 != b2, r2); 183 | 184 | fp a3 = (334.522034m); 185 | fp3x3 b3 = fp3x3(-223.629242m, -12.4884644m, 113.468872m, -189.652252m, -212.846558m, 306.1256m, -178.330383m, 382.141968m, -340.8656m); 186 | bool3x3 r3 = bool3x3(true, true, true, true, true, true, true, true, true); 187 | TestUtils.AreEqual(a3 != b3, r3); 188 | } 189 | 190 | 191 | } 192 | } 193 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestFp3x3.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cc1104c40a140f04bae3dae343cff383 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestFp3x4.gen.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | using NUnit.Framework; 10 | using static Unity.Mathematics.FixedPoint.fpmath; 11 | using static Unity.Mathematics.math; 12 | 13 | namespace Unity.Mathematics.FixedPoint.Tests 14 | { 15 | [TestFixture] 16 | public class TestFp3x4 17 | { 18 | [Test] 19 | public static void fp3x4_zero() 20 | { 21 | TestUtils.AreEqual(fp3x4.zero.c0.x, (fp)0); 22 | TestUtils.AreEqual(fp3x4.zero.c0.y, (fp)0); 23 | TestUtils.AreEqual(fp3x4.zero.c0.z, (fp)0); 24 | TestUtils.AreEqual(fp3x4.zero.c1.x, (fp)0); 25 | TestUtils.AreEqual(fp3x4.zero.c1.y, (fp)0); 26 | TestUtils.AreEqual(fp3x4.zero.c1.z, (fp)0); 27 | TestUtils.AreEqual(fp3x4.zero.c2.x, (fp)0); 28 | TestUtils.AreEqual(fp3x4.zero.c2.y, (fp)0); 29 | TestUtils.AreEqual(fp3x4.zero.c2.z, (fp)0); 30 | TestUtils.AreEqual(fp3x4.zero.c3.x, (fp)0); 31 | TestUtils.AreEqual(fp3x4.zero.c3.y, (fp)0); 32 | TestUtils.AreEqual(fp3x4.zero.c3.z, (fp)0); 33 | } 34 | 35 | [Test] 36 | public static void fp3x4_operator_equal_wide_wide() 37 | { 38 | fp3x4 a0 = fp3x4(-135.18924m, -49.0941162m, 169.129822m, 240.8053m, 314.7392m, 442.393m, 177.924438m, 335.5334m, 168.15448m, 350.729553m, 367.178467m, 46.9414673m); 39 | fp3x4 b0 = fp3x4(-220.014648m, 66.98004m, 499.2016m, -371.1131m, 208.448669m, 390.8037m, -72.44382m, 362.97644m, 194.678345m, 471.644836m, -404.044678m, -144.696747m); 40 | bool3x4 r0 = bool3x4(false, false, false, false, false, false, false, false, false, false, false, false); 41 | TestUtils.AreEqual(a0 == b0, r0); 42 | 43 | fp3x4 a1 = fp3x4(188.76416m, -97.2113953m, -293.320984m, -234.822937m, 417.0337m, 26.3864136m, 269.245728m, 29.4741821m, 479.485229m, -237.230957m, -221.9837m, -506.672546m); 44 | fp3x4 b1 = fp3x4(-494.446655m, -252.970367m, 234.417114m, 398.724m, 260.4287m, 370.144226m, 89.579834m, -434.816833m, -109.845337m, 336.973022m, -409.154968m, 500.387573m); 45 | bool3x4 r1 = bool3x4(false, false, false, false, false, false, false, false, false, false, false, false); 46 | TestUtils.AreEqual(a1 == b1, r1); 47 | 48 | fp3x4 a2 = fp3x4(-22.98944m, 487.260864m, -419.731964m, 337.2033m, 245.043884m, 390.215881m, 84.4129639m, 434.2079m, -68.7284241m, 485.769958m, 413.169739m, -418.2693m); 49 | fp3x4 b2 = fp3x4(-174.081818m, 395.101135m, 350.3393m, -243.144592m, -416.397369m, 151.576477m, -18.2243347m, -431.677917m, -468.330963m, 429.495728m, 477.389221m, -433.4254m); 50 | bool3x4 r2 = bool3x4(false, false, false, false, false, false, false, false, false, false, false, false); 51 | TestUtils.AreEqual(a2 == b2, r2); 52 | 53 | fp3x4 a3 = fp3x4(-346.795868m, 504.159668m, 345.186279m, -434.713043m, -499.7741m, 282.019043m, 259.15625m, 306.455933m, 435.2254m, -386.8997m, 211.364014m, -7.229828m); 54 | fp3x4 b3 = fp3x4(273.5464m, -34.9762268m, 221.968445m, 85.91913m, -85.59894m, 392.7608m, -117.924072m, -445.3056m, -242.468964m, 173.643066m, 389.897766m, -14.2904663m); 55 | bool3x4 r3 = bool3x4(false, false, false, false, false, false, false, false, false, false, false, false); 56 | TestUtils.AreEqual(a3 == b3, r3); 57 | } 58 | 59 | [Test] 60 | public static void fp3x4_operator_equal_wide_scalar() 61 | { 62 | fp3x4 a0 = fp3x4(65.6712m, 404.415527m, -269.730164m, 83.6306152m, 152.9945m, -155.868286m, 314.671265m, 386.365173m, 290.04895m, -132.6352m, -65.66748m, -69.68326m); 63 | fp b0 = (-155.815765m); 64 | bool3x4 r0 = bool3x4(false, false, false, false, false, false, false, false, false, false, false, false); 65 | TestUtils.AreEqual(a0 == b0, r0); 66 | 67 | fp3x4 a1 = fp3x4(-191.190765m, -232.895691m, -319.144043m, -49.70108m, -300.8819m, 333.396851m, 386.3775m, -296.7019m, -309.1172m, 141.542358m, -227.323334m, 83.87286m); 68 | fp b1 = (186.845215m); 69 | bool3x4 r1 = bool3x4(false, false, false, false, false, false, false, false, false, false, false, false); 70 | TestUtils.AreEqual(a1 == b1, r1); 71 | 72 | fp3x4 a2 = fp3x4(-410.91687m, -390.103577m, 36.57434m, -427.541443m, -268.170837m, 175.8117m, -193.47995m, 291.051941m, 423.97168m, -429.8739m, -275.156952m, -56.3323669m); 73 | fp b2 = (110.501282m); 74 | bool3x4 r2 = bool3x4(false, false, false, false, false, false, false, false, false, false, false, false); 75 | TestUtils.AreEqual(a2 == b2, r2); 76 | 77 | fp3x4 a3 = fp3x4(-95.83597m, 253.006165m, -300.509521m, 314.866516m, 195.616211m, -26.1289063m, -284.7747m, -242.672058m, 140.3606m, 505.644348m, 506.537964m, -502.3698m); 78 | fp b3 = (-124.865326m); 79 | bool3x4 r3 = bool3x4(false, false, false, false, false, false, false, false, false, false, false, false); 80 | TestUtils.AreEqual(a3 == b3, r3); 81 | } 82 | 83 | [Test] 84 | public static void fp3x4_operator_equal_scalar_wide() 85 | { 86 | fp a0 = (36.38391m); 87 | fp3x4 b0 = fp3x4(-400.4892m, -71.2868347m, 156.978088m, -225.238739m, 499.141785m, -211.979919m, 428.311951m, -489.501343m, -5.691559m, -30.8659363m, -362.9831m, 184.503174m); 88 | bool3x4 r0 = bool3x4(false, false, false, false, false, false, false, false, false, false, false, false); 89 | TestUtils.AreEqual(a0 == b0, r0); 90 | 91 | fp a1 = (-160.470612m); 92 | fp3x4 b1 = fp3x4(316.668823m, 390.369263m, 505.1051m, -294.6487m, 443.1991m, 96.5592651m, -257.012939m, -245.054962m, 326.464844m, -23.9599m, -168.694885m, 386.2486m); 93 | bool3x4 r1 = bool3x4(false, false, false, false, false, false, false, false, false, false, false, false); 94 | TestUtils.AreEqual(a1 == b1, r1); 95 | 96 | fp a2 = (-227.090637m); 97 | fp3x4 b2 = fp3x4(-336.612427m, 365.108154m, -405.390839m, -473.995483m, 298.435364m, -149.86322m, 450.0664m, 153.47644m, 56.28778m, 39.3421021m, -350.403717m, -482.717224m); 98 | bool3x4 r2 = bool3x4(false, false, false, false, false, false, false, false, false, false, false, false); 99 | TestUtils.AreEqual(a2 == b2, r2); 100 | 101 | fp a3 = (239.9654m); 102 | fp3x4 b3 = fp3x4(-3.40603638m, -1.49484253m, 105.960449m, 151.537537m, 63.2832031m, -289.693176m, 137.553772m, -247.666473m, -339.420563m, 23.2382813m, 21.1778564m, 477.03656m); 103 | bool3x4 r3 = bool3x4(false, false, false, false, false, false, false, false, false, false, false, false); 104 | TestUtils.AreEqual(a3 == b3, r3); 105 | } 106 | 107 | [Test] 108 | public static void fp3x4_operator_not_equal_wide_wide() 109 | { 110 | fp3x4 a0 = fp3x4(279.994141m, -43.34201m, -465.724731m, 317.466553m, 85.7149658m, 360.8905m, 366.081543m, 154.542847m, 332.4262m, 397.11322m, -431.374969m, 489.0108m); 111 | fp3x4 b0 = fp3x4(-460.9121m, -476.009033m, 468.1364m, -341.012543m, -62.65805m, -458.801666m, -457.730225m, -59.5232544m, 3.024231m, 155.812744m, -19.8399048m, -6.01693726m); 112 | bool3x4 r0 = bool3x4(true, true, true, true, true, true, true, true, true, true, true, true); 113 | TestUtils.AreEqual(a0 != b0, r0); 114 | 115 | fp3x4 a1 = fp3x4(398.4336m, -489.817932m, 171.4049m, -67.82968m, -192.278717m, 227.84082m, 62.1381836m, 262.186462m, -404.0531m, 34.449585m, -204.795776m, -285.4118m); 116 | fp3x4 b1 = fp3x4(-406.207916m, -102.420715m, -40.362915m, 452.6754m, 93.25757m, -258.378052m, -184.0498m, -379.2353m, -370.687317m, -255.947235m, 29.0557861m, 322.407654m); 117 | bool3x4 r1 = bool3x4(true, true, true, true, true, true, true, true, true, true, true, true); 118 | TestUtils.AreEqual(a1 != b1, r1); 119 | 120 | fp3x4 a2 = fp3x4(-72.20682m, 444.749268m, 238.81781m, 365.1801m, -437.9229m, -362.442627m, 445.954346m, -0.417480469m, -506.828369m, 245.477051m, -173.571045m, 390.338562m); 121 | fp3x4 b2 = fp3x4(415.071716m, -467.726135m, -433.784668m, -212.165924m, 474.674927m, 452.483215m, -92.11273m, -385.9221m, 420.2151m, -239.176056m, -99.0791m, 4.476013m); 122 | bool3x4 r2 = bool3x4(true, true, true, true, true, true, true, true, true, true, true, true); 123 | TestUtils.AreEqual(a2 != b2, r2); 124 | 125 | fp3x4 a3 = fp3x4(252.837769m, 47.8658447m, 457.7105m, -313.22113m, 391.203857m, 481.786133m, 26.8878174m, -298.1424m, 240.077454m, -332.455139m, -333.607178m, -313.1897m); 126 | fp3x4 b3 = fp3x4(264.348572m, 451.312317m, 232.958008m, -142.6222m, -300.2256m, 268.333252m, -112.103546m, -270.494019m, -71.9932251m, 99.46326m, 321.7033m, 200.059631m); 127 | bool3x4 r3 = bool3x4(true, true, true, true, true, true, true, true, true, true, true, true); 128 | TestUtils.AreEqual(a3 != b3, r3); 129 | } 130 | 131 | [Test] 132 | public static void fp3x4_operator_not_equal_wide_scalar() 133 | { 134 | fp3x4 a0 = fp3x4(-155.4411m, -19.4266052m, 174.633057m, 507.920715m, 59.177063m, 171.151489m, -58.92328m, -398.176849m, 492.20105m, -165.241516m, 270.341m, -380.243256m); 135 | fp b0 = (-393.413544m); 136 | bool3x4 r0 = bool3x4(true, true, true, true, true, true, true, true, true, true, true, true); 137 | TestUtils.AreEqual(a0 != b0, r0); 138 | 139 | fp3x4 a1 = fp3x4(501.899048m, 458.400452m, 46.7709961m, 161.459961m, 261.514221m, -145.6124m, -0.449920654m, 350.461426m, 202.221008m, 242.664m, 382.677063m, -468.967957m); 140 | fp b1 = (-134.345459m); 141 | bool3x4 r1 = bool3x4(true, true, true, true, true, true, true, true, true, true, true, true); 142 | TestUtils.AreEqual(a1 != b1, r1); 143 | 144 | fp3x4 a2 = fp3x4(-497.459473m, -328.587769m, -506.490326m, 449.348145m, 210.771m, 249.181824m, -338.468536m, 229.670654m, -76.5433044m, 317.286072m, 401.939575m, 210.984863m); 145 | fp b2 = (-80.93225m); 146 | bool3x4 r2 = bool3x4(true, true, true, true, true, true, true, true, true, true, true, true); 147 | TestUtils.AreEqual(a2 != b2, r2); 148 | 149 | fp3x4 a3 = fp3x4(-147.096313m, 207.731384m, 284.3921m, -509.0853m, 414.307617m, -52.2944641m, -140.437927m, -316.787781m, -358.696838m, 312.31897m, 270.629456m, -140.016724m); 150 | fp b3 = (-193.399048m); 151 | bool3x4 r3 = bool3x4(true, true, true, true, true, true, true, true, true, true, true, true); 152 | TestUtils.AreEqual(a3 != b3, r3); 153 | } 154 | 155 | [Test] 156 | public static void fp3x4_operator_not_equal_scalar_wide() 157 | { 158 | fp a0 = (478.353149m); 159 | fp3x4 b0 = fp3x4(459.553223m, 436.453247m, -488.714172m, 392.767944m, -266.736633m, 338.557861m, -338.100128m, -152.314545m, -452.820679m, 209.439331m, 50.10797m, 372.4344m); 160 | bool3x4 r0 = bool3x4(true, true, true, true, true, true, true, true, true, true, true, true); 161 | TestUtils.AreEqual(a0 != b0, r0); 162 | 163 | fp a1 = (-488.0213m); 164 | fp3x4 b1 = fp3x4(489.740784m, 270.4001m, -472.846771m, -286.850464m, -384.691864m, 443.423523m, 358.7472m, -15.4140625m, -342.179169m, 468.967529m, -130.568085m, 401.785828m); 165 | bool3x4 r1 = bool3x4(true, true, true, true, true, true, true, true, true, true, true, true); 166 | TestUtils.AreEqual(a1 != b1, r1); 167 | 168 | fp a2 = (-268.352264m); 169 | fp3x4 b2 = fp3x4(-239.231018m, 411.386536m, 139.769348m, 334.522034m, -223.629242m, -12.4884644m, 113.468872m, -189.652252m, -212.846558m, 306.1256m, -178.330383m, 382.141968m); 170 | bool3x4 r2 = bool3x4(true, true, true, true, true, true, true, true, true, true, true, true); 171 | TestUtils.AreEqual(a2 != b2, r2); 172 | 173 | fp a3 = (-340.8656m); 174 | fp3x4 b3 = fp3x4(-17.58023m, -409.874847m, -349.70166m, 275.8543m, -229.371948m, -127.505737m, 90.75342m, -422.087128m, -2.44754028m, -280.5517m, -484.374359m, -33.7634277m); 175 | bool3x4 r3 = bool3x4(true, true, true, true, true, true, true, true, true, true, true, true); 176 | TestUtils.AreEqual(a3 != b3, r3); 177 | } 178 | 179 | 180 | } 181 | } 182 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestFp3x4.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 02b0fb6bc1a52c6448b30524de74498f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestFp4.gen.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | using NUnit.Framework; 10 | using static Unity.Mathematics.FixedPoint.fpmath; 11 | using static Unity.Mathematics.math; 12 | 13 | namespace Unity.Mathematics.FixedPoint.Tests 14 | { 15 | [TestFixture] 16 | public class TestFp4 17 | { 18 | [Test] 19 | public static void fp4_zero() 20 | { 21 | TestUtils.AreEqual(fp4.zero.x, (fp)0); 22 | TestUtils.AreEqual(fp4.zero.y, (fp)0); 23 | TestUtils.AreEqual(fp4.zero.z, (fp)0); 24 | TestUtils.AreEqual(fp4.zero.w, (fp)0); 25 | } 26 | 27 | [Test] 28 | public static void fp4_constructor() 29 | { 30 | fp4 a = new fp4(1, 2, 3, 4); 31 | TestUtils.AreEqual(a.x, 1); 32 | TestUtils.AreEqual(a.y, 2); 33 | TestUtils.AreEqual(a.z, 3); 34 | TestUtils.AreEqual(a.w, 4); 35 | } 36 | 37 | [Test] 38 | public static void fp4_scalar_constructor() 39 | { 40 | fp4 a = new fp4(17.0m); 41 | TestUtils.AreEqual(a.x, 17.0m); 42 | TestUtils.AreEqual(a.y, 17.0m); 43 | TestUtils.AreEqual(a.z, 17.0m); 44 | TestUtils.AreEqual(a.w, 17.0m); 45 | } 46 | 47 | [Test] 48 | public static void fp4_static_constructor() 49 | { 50 | fp4 a = fp4(1, 2, 3, 4); 51 | TestUtils.AreEqual(a.x, 1); 52 | TestUtils.AreEqual(a.y, 2); 53 | TestUtils.AreEqual(a.z, 3); 54 | TestUtils.AreEqual(a.w, 4); 55 | } 56 | 57 | [Test] 58 | public static void fp4_static_scalar_constructor() 59 | { 60 | fp4 a = fp4(17.0m); 61 | TestUtils.AreEqual(a.x, 17.0m); 62 | TestUtils.AreEqual(a.y, 17.0m); 63 | TestUtils.AreEqual(a.z, 17.0m); 64 | TestUtils.AreEqual(a.w, 17.0m); 65 | } 66 | 67 | [Test] 68 | public static void fp4_operator_equal_wide_wide() 69 | { 70 | fp4 a0 = fp4(-135.18924m, -49.0941162m, 169.129822m, 240.8053m); 71 | fp4 b0 = fp4(-220.014648m, 66.98004m, 499.2016m, -371.1131m); 72 | bool4 r0 = bool4(false, false, false, false); 73 | TestUtils.AreEqual(a0 == b0, r0); 74 | 75 | fp4 a1 = fp4(314.7392m, 442.393m, 177.924438m, 335.5334m); 76 | fp4 b1 = fp4(208.448669m, 390.8037m, -72.44382m, 362.97644m); 77 | bool4 r1 = bool4(false, false, false, false); 78 | TestUtils.AreEqual(a1 == b1, r1); 79 | 80 | fp4 a2 = fp4(168.15448m, 350.729553m, 367.178467m, 46.9414673m); 81 | fp4 b2 = fp4(194.678345m, 471.644836m, -404.044678m, -144.696747m); 82 | bool4 r2 = bool4(false, false, false, false); 83 | TestUtils.AreEqual(a2 == b2, r2); 84 | 85 | fp4 a3 = fp4(188.76416m, -97.2113953m, -293.320984m, -234.822937m); 86 | fp4 b3 = fp4(-494.446655m, -252.970367m, 234.417114m, 398.724m); 87 | bool4 r3 = bool4(false, false, false, false); 88 | TestUtils.AreEqual(a3 == b3, r3); 89 | } 90 | 91 | [Test] 92 | public static void fp4_operator_equal_wide_scalar() 93 | { 94 | fp4 a0 = fp4(65.6712m, 404.415527m, -269.730164m, 83.6306152m); 95 | fp b0 = (-155.815765m); 96 | bool4 r0 = bool4(false, false, false, false); 97 | TestUtils.AreEqual(a0 == b0, r0); 98 | 99 | fp4 a1 = fp4(152.9945m, 314.671265m, 386.365173m, 290.04895m); 100 | fp b1 = (-155.868286m); 101 | bool4 r1 = bool4(false, false, false, false); 102 | TestUtils.AreEqual(a1 == b1, r1); 103 | 104 | fp4 a2 = fp4(-132.6352m, -69.68326m, -191.190765m, 186.845215m); 105 | fp b2 = (-65.66748m); 106 | bool4 r2 = bool4(false, false, false, false); 107 | TestUtils.AreEqual(a2 == b2, r2); 108 | 109 | fp4 a3 = fp4(-232.895691m, -49.70108m, -300.8819m, 333.396851m); 110 | fp b3 = (-319.144043m); 111 | bool4 r3 = bool4(false, false, false, false); 112 | TestUtils.AreEqual(a3 == b3, r3); 113 | } 114 | 115 | [Test] 116 | public static void fp4_operator_equal_scalar_wide() 117 | { 118 | fp a0 = (36.38391m); 119 | fp4 b0 = fp4(-400.4892m, -71.2868347m, 156.978088m, -225.238739m); 120 | bool4 r0 = bool4(false, false, false, false); 121 | TestUtils.AreEqual(a0 == b0, r0); 122 | 123 | fp a1 = (499.141785m); 124 | fp4 b1 = fp4(-211.979919m, 428.311951m, -489.501343m, -5.691559m); 125 | bool4 r1 = bool4(false, false, false, false); 126 | TestUtils.AreEqual(a1 == b1, r1); 127 | 128 | fp a2 = (-30.8659363m); 129 | fp4 b2 = fp4(-362.9831m, 184.503174m, -160.470612m, 316.668823m); 130 | bool4 r2 = bool4(false, false, false, false); 131 | TestUtils.AreEqual(a2 == b2, r2); 132 | 133 | fp a3 = (390.369263m); 134 | fp4 b3 = fp4(505.1051m, -294.6487m, 443.1991m, 96.5592651m); 135 | bool4 r3 = bool4(false, false, false, false); 136 | TestUtils.AreEqual(a3 == b3, r3); 137 | } 138 | 139 | [Test] 140 | public static void fp4_operator_not_equal_wide_wide() 141 | { 142 | fp4 a0 = fp4(279.994141m, -43.34201m, -465.724731m, 317.466553m); 143 | fp4 b0 = fp4(-460.9121m, -476.009033m, 468.1364m, -341.012543m); 144 | bool4 r0 = bool4(true, true, true, true); 145 | TestUtils.AreEqual(a0 != b0, r0); 146 | 147 | fp4 a1 = fp4(85.7149658m, 360.8905m, 366.081543m, 154.542847m); 148 | fp4 b1 = fp4(-62.65805m, -458.801666m, -457.730225m, -59.5232544m); 149 | bool4 r1 = bool4(true, true, true, true); 150 | TestUtils.AreEqual(a1 != b1, r1); 151 | 152 | fp4 a2 = fp4(332.4262m, 397.11322m, -431.374969m, 489.0108m); 153 | fp4 b2 = fp4(3.024231m, 155.812744m, -19.8399048m, -6.01693726m); 154 | bool4 r2 = bool4(true, true, true, true); 155 | TestUtils.AreEqual(a2 != b2, r2); 156 | 157 | fp4 a3 = fp4(398.4336m, -489.817932m, 171.4049m, -67.82968m); 158 | fp4 b3 = fp4(-406.207916m, -102.420715m, -40.362915m, 452.6754m); 159 | bool4 r3 = bool4(true, true, true, true); 160 | TestUtils.AreEqual(a3 != b3, r3); 161 | } 162 | 163 | [Test] 164 | public static void fp4_operator_not_equal_wide_scalar() 165 | { 166 | fp4 a0 = fp4(-155.4411m, -19.4266052m, 174.633057m, 507.920715m); 167 | fp b0 = (-393.413544m); 168 | bool4 r0 = bool4(true, true, true, true); 169 | TestUtils.AreEqual(a0 != b0, r0); 170 | 171 | fp4 a1 = fp4(59.177063m, -58.92328m, -398.176849m, 492.20105m); 172 | fp b1 = (171.151489m); 173 | bool4 r1 = bool4(true, true, true, true); 174 | TestUtils.AreEqual(a1 != b1, r1); 175 | 176 | fp4 a2 = fp4(-165.241516m, -380.243256m, 501.899048m, -134.345459m); 177 | fp b2 = (270.341m); 178 | bool4 r2 = bool4(true, true, true, true); 179 | TestUtils.AreEqual(a2 != b2, r2); 180 | 181 | fp4 a3 = fp4(458.400452m, 161.459961m, 261.514221m, -145.6124m); 182 | fp b3 = (46.7709961m); 183 | bool4 r3 = bool4(true, true, true, true); 184 | TestUtils.AreEqual(a3 != b3, r3); 185 | } 186 | 187 | [Test] 188 | public static void fp4_operator_not_equal_scalar_wide() 189 | { 190 | fp a0 = (478.353149m); 191 | fp4 b0 = fp4(459.553223m, 436.453247m, -488.714172m, 392.767944m); 192 | bool4 r0 = bool4(true, true, true, true); 193 | TestUtils.AreEqual(a0 != b0, r0); 194 | 195 | fp a1 = (-266.736633m); 196 | fp4 b1 = fp4(338.557861m, -338.100128m, -152.314545m, -452.820679m); 197 | bool4 r1 = bool4(true, true, true, true); 198 | TestUtils.AreEqual(a1 != b1, r1); 199 | 200 | fp a2 = (209.439331m); 201 | fp4 b2 = fp4(50.10797m, 372.4344m, -488.0213m, 489.740784m); 202 | bool4 r2 = bool4(true, true, true, true); 203 | TestUtils.AreEqual(a2 != b2, r2); 204 | 205 | fp a3 = (270.4001m); 206 | fp4 b3 = fp4(-472.846771m, -286.850464m, -384.691864m, 443.423523m); 207 | bool4 r3 = bool4(true, true, true, true); 208 | TestUtils.AreEqual(a3 != b3, r3); 209 | } 210 | 211 | [Test] 212 | public static void fp4_shuffle_result_1() 213 | { 214 | fp4 a = fp4(0, 1, 2, 3); 215 | fp4 b = fp4(4, 5, 6, 7); 216 | 217 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftX), (0)); 218 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftY), (1)); 219 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftZ), (2)); 220 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftW), (3)); 221 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX), (4)); 222 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY), (5)); 223 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ), (6)); 224 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightW), (7)); 225 | } 226 | 227 | [Test] 228 | public static void fp4_shuffle_result_2() 229 | { 230 | fp4 a = fp4(0, 1, 2, 3); 231 | fp4 b = fp4(4, 5, 6, 7); 232 | 233 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.RightZ), fp2(5, 6)); 234 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.RightX), fp2(6, 4)); 235 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftY, ShuffleComponent.RightX), fp2(1, 4)); 236 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightW, ShuffleComponent.LeftW), fp2(7, 3)); 237 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightW, ShuffleComponent.LeftZ), fp2(7, 2)); 238 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftZ, ShuffleComponent.LeftW), fp2(2, 3)); 239 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftW), fp2(5, 3)); 240 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightW, ShuffleComponent.LeftX), fp2(7, 0)); 241 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.RightW), fp2(6, 7)); 242 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftZ), fp2(5, 2)); 243 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.RightZ), fp2(6, 6)); 244 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightW, ShuffleComponent.LeftX), fp2(7, 0)); 245 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.RightX), fp2(5, 4)); 246 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightW, ShuffleComponent.RightY), fp2(7, 5)); 247 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.LeftX), fp2(4, 0)); 248 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftY, ShuffleComponent.LeftW), fp2(1, 3)); 249 | } 250 | 251 | [Test] 252 | public static void fp4_shuffle_result_3() 253 | { 254 | fp4 a = fp4(0, 1, 2, 3); 255 | fp4 b = fp4(4, 5, 6, 7); 256 | 257 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftZ, ShuffleComponent.RightW, ShuffleComponent.RightY), fp3(2, 7, 5)); 258 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.LeftX, ShuffleComponent.LeftW), fp3(6, 0, 3)); 259 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftZ, ShuffleComponent.RightW, ShuffleComponent.RightX), fp3(2, 7, 4)); 260 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftX, ShuffleComponent.LeftZ), fp3(5, 0, 2)); 261 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightW, ShuffleComponent.RightZ, ShuffleComponent.LeftZ), fp3(7, 6, 2)); 262 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftW, ShuffleComponent.LeftY, ShuffleComponent.LeftY), fp3(3, 1, 1)); 263 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftW, ShuffleComponent.RightY, ShuffleComponent.RightX), fp3(3, 5, 4)); 264 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftW, ShuffleComponent.LeftY, ShuffleComponent.RightW), fp3(3, 1, 7)); 265 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.RightY, ShuffleComponent.RightZ), fp3(6, 5, 6)); 266 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.RightX, ShuffleComponent.LeftY), fp3(5, 4, 1)); 267 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightW, ShuffleComponent.RightW, ShuffleComponent.LeftX), fp3(7, 7, 0)); 268 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.LeftY, ShuffleComponent.RightY), fp3(6, 1, 5)); 269 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.LeftY, ShuffleComponent.RightW), fp3(6, 1, 7)); 270 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftW, ShuffleComponent.RightY, ShuffleComponent.RightY), fp3(3, 5, 5)); 271 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.LeftX, ShuffleComponent.RightY), fp3(6, 0, 5)); 272 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftY, ShuffleComponent.RightW), fp3(5, 1, 7)); 273 | } 274 | 275 | [Test] 276 | public static void fp4_shuffle_result_4() 277 | { 278 | fp4 a = fp4(0, 1, 2, 3); 279 | fp4 b = fp4(4, 5, 6, 7); 280 | 281 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftY, ShuffleComponent.LeftW, ShuffleComponent.RightX, ShuffleComponent.LeftZ), fp4(1, 3, 4, 2)); 282 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftW, ShuffleComponent.RightZ, ShuffleComponent.RightZ), fp4(5, 3, 6, 6)); 283 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.RightZ, ShuffleComponent.RightW, ShuffleComponent.LeftZ), fp4(6, 6, 7, 2)); 284 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.RightY, ShuffleComponent.LeftZ, ShuffleComponent.LeftZ), fp4(4, 5, 2, 2)); 285 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.LeftY, ShuffleComponent.LeftY, ShuffleComponent.LeftX), fp4(6, 1, 1, 0)); 286 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.RightY, ShuffleComponent.RightY, ShuffleComponent.RightW), fp4(4, 5, 5, 7)); 287 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftY, ShuffleComponent.RightW, ShuffleComponent.LeftX, ShuffleComponent.RightW), fp4(1, 7, 0, 7)); 288 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftX, ShuffleComponent.LeftY, ShuffleComponent.LeftX), fp4(5, 0, 1, 0)); 289 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.RightW, ShuffleComponent.LeftW, ShuffleComponent.LeftY), fp4(4, 7, 3, 1)); 290 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.RightX, ShuffleComponent.LeftY, ShuffleComponent.RightX), fp4(5, 4, 1, 4)); 291 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftX, ShuffleComponent.LeftZ, ShuffleComponent.RightZ, ShuffleComponent.LeftX), fp4(0, 2, 6, 0)); 292 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftZ, ShuffleComponent.RightY, ShuffleComponent.RightW, ShuffleComponent.RightW), fp4(2, 5, 7, 7)); 293 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftW, ShuffleComponent.RightX, ShuffleComponent.LeftZ, ShuffleComponent.RightX), fp4(3, 4, 2, 4)); 294 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.LeftX, ShuffleComponent.LeftZ, ShuffleComponent.LeftW), fp4(4, 0, 2, 3)); 295 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightZ, ShuffleComponent.RightX, ShuffleComponent.LeftX, ShuffleComponent.RightY), fp4(6, 4, 0, 5)); 296 | TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftW, ShuffleComponent.RightW, ShuffleComponent.LeftY, ShuffleComponent.RightY), fp4(3, 7, 1, 5)); 297 | } 298 | 299 | 300 | } 301 | } 302 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestFp4.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1aab6885186a3d14fb5afb1fb5f1c116 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestFp4x2.gen.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | using NUnit.Framework; 10 | using static Unity.Mathematics.FixedPoint.fpmath; 11 | using static Unity.Mathematics.math; 12 | 13 | namespace Unity.Mathematics.FixedPoint.Tests 14 | { 15 | [TestFixture] 16 | public class TestFp4x2 17 | { 18 | [Test] 19 | public static void fp4x2_zero() 20 | { 21 | TestUtils.AreEqual(fp4x2.zero.c0.x, (fp)0); 22 | TestUtils.AreEqual(fp4x2.zero.c0.y, (fp)0); 23 | TestUtils.AreEqual(fp4x2.zero.c0.z, (fp)0); 24 | TestUtils.AreEqual(fp4x2.zero.c0.w, (fp)0); 25 | TestUtils.AreEqual(fp4x2.zero.c1.x, (fp)0); 26 | TestUtils.AreEqual(fp4x2.zero.c1.y, (fp)0); 27 | TestUtils.AreEqual(fp4x2.zero.c1.z, (fp)0); 28 | TestUtils.AreEqual(fp4x2.zero.c1.w, (fp)0); 29 | } 30 | 31 | [Test] 32 | public static void fp4x2_operator_equal_wide_wide() 33 | { 34 | fp4x2 a0 = fp4x2(-135.18924m, -49.0941162m, 169.129822m, 240.8053m, 314.7392m, 442.393m, 177.924438m, 335.5334m); 35 | fp4x2 b0 = fp4x2(-220.014648m, 66.98004m, 499.2016m, -371.1131m, 208.448669m, 390.8037m, -72.44382m, 362.97644m); 36 | bool4x2 r0 = bool4x2(false, false, false, false, false, false, false, false); 37 | TestUtils.AreEqual(a0 == b0, r0); 38 | 39 | fp4x2 a1 = fp4x2(168.15448m, 350.729553m, 367.178467m, 46.9414673m, 188.76416m, -97.2113953m, -293.320984m, -234.822937m); 40 | fp4x2 b1 = fp4x2(194.678345m, 471.644836m, -404.044678m, -144.696747m, -494.446655m, -252.970367m, 234.417114m, 398.724m); 41 | bool4x2 r1 = bool4x2(false, false, false, false, false, false, false, false); 42 | TestUtils.AreEqual(a1 == b1, r1); 43 | 44 | fp4x2 a2 = fp4x2(417.0337m, 26.3864136m, 269.245728m, 29.4741821m, 479.485229m, -237.230957m, -221.9837m, -506.672546m); 45 | fp4x2 b2 = fp4x2(260.4287m, 370.144226m, 89.579834m, -434.816833m, -109.845337m, 336.973022m, -409.154968m, 500.387573m); 46 | bool4x2 r2 = bool4x2(false, false, false, false, false, false, false, false); 47 | TestUtils.AreEqual(a2 == b2, r2); 48 | 49 | fp4x2 a3 = fp4x2(-22.98944m, 487.260864m, -419.731964m, 337.2033m, 245.043884m, 390.215881m, 84.4129639m, 434.2079m); 50 | fp4x2 b3 = fp4x2(-174.081818m, 395.101135m, 350.3393m, -243.144592m, -416.397369m, 151.576477m, -18.2243347m, -431.677917m); 51 | bool4x2 r3 = bool4x2(false, false, false, false, false, false, false, false); 52 | TestUtils.AreEqual(a3 == b3, r3); 53 | } 54 | 55 | [Test] 56 | public static void fp4x2_operator_equal_wide_scalar() 57 | { 58 | fp4x2 a0 = fp4x2(65.6712m, 404.415527m, -269.730164m, 83.6306152m, 152.9945m, -155.868286m, 314.671265m, 386.365173m); 59 | fp b0 = (-155.815765m); 60 | bool4x2 r0 = bool4x2(false, false, false, false, false, false, false, false); 61 | TestUtils.AreEqual(a0 == b0, r0); 62 | 63 | fp4x2 a1 = fp4x2(290.04895m, -65.66748m, -69.68326m, -191.190765m, 186.845215m, -232.895691m, -319.144043m, -49.70108m); 64 | fp b1 = (-132.6352m); 65 | bool4x2 r1 = bool4x2(false, false, false, false, false, false, false, false); 66 | TestUtils.AreEqual(a1 == b1, r1); 67 | 68 | fp4x2 a2 = fp4x2(-300.8819m, 386.3775m, -296.7019m, -309.1172m, 141.542358m, -227.323334m, 83.87286m, -410.91687m); 69 | fp b2 = (333.396851m); 70 | bool4x2 r2 = bool4x2(false, false, false, false, false, false, false, false); 71 | TestUtils.AreEqual(a2 == b2, r2); 72 | 73 | fp4x2 a3 = fp4x2(110.501282m, 36.57434m, -427.541443m, -268.170837m, 175.8117m, -193.47995m, 291.051941m, 423.97168m); 74 | fp b3 = (-390.103577m); 75 | bool4x2 r3 = bool4x2(false, false, false, false, false, false, false, false); 76 | TestUtils.AreEqual(a3 == b3, r3); 77 | } 78 | 79 | [Test] 80 | public static void fp4x2_operator_equal_scalar_wide() 81 | { 82 | fp a0 = (36.38391m); 83 | fp4x2 b0 = fp4x2(-400.4892m, -71.2868347m, 156.978088m, -225.238739m, 499.141785m, -211.979919m, 428.311951m, -489.501343m); 84 | bool4x2 r0 = bool4x2(false, false, false, false, false, false, false, false); 85 | TestUtils.AreEqual(a0 == b0, r0); 86 | 87 | fp a1 = (-5.691559m); 88 | fp4x2 b1 = fp4x2(-30.8659363m, -362.9831m, 184.503174m, -160.470612m, 316.668823m, 390.369263m, 505.1051m, -294.6487m); 89 | bool4x2 r1 = bool4x2(false, false, false, false, false, false, false, false); 90 | TestUtils.AreEqual(a1 == b1, r1); 91 | 92 | fp a2 = (443.1991m); 93 | fp4x2 b2 = fp4x2(96.5592651m, -257.012939m, -245.054962m, 326.464844m, -23.9599m, -168.694885m, 386.2486m, -227.090637m); 94 | bool4x2 r2 = bool4x2(false, false, false, false, false, false, false, false); 95 | TestUtils.AreEqual(a2 == b2, r2); 96 | 97 | fp a3 = (-336.612427m); 98 | fp4x2 b3 = fp4x2(365.108154m, -405.390839m, -473.995483m, 298.435364m, -149.86322m, 450.0664m, 153.47644m, 56.28778m); 99 | bool4x2 r3 = bool4x2(false, false, false, false, false, false, false, false); 100 | TestUtils.AreEqual(a3 == b3, r3); 101 | } 102 | 103 | [Test] 104 | public static void fp4x2_operator_not_equal_wide_wide() 105 | { 106 | fp4x2 a0 = fp4x2(279.994141m, -43.34201m, -465.724731m, 317.466553m, 85.7149658m, 360.8905m, 366.081543m, 154.542847m); 107 | fp4x2 b0 = fp4x2(-460.9121m, -476.009033m, 468.1364m, -341.012543m, -62.65805m, -458.801666m, -457.730225m, -59.5232544m); 108 | bool4x2 r0 = bool4x2(true, true, true, true, true, true, true, true); 109 | TestUtils.AreEqual(a0 != b0, r0); 110 | 111 | fp4x2 a1 = fp4x2(332.4262m, 397.11322m, -431.374969m, 489.0108m, 398.4336m, -489.817932m, 171.4049m, -67.82968m); 112 | fp4x2 b1 = fp4x2(3.024231m, 155.812744m, -19.8399048m, -6.01693726m, -406.207916m, -102.420715m, -40.362915m, 452.6754m); 113 | bool4x2 r1 = bool4x2(true, true, true, true, true, true, true, true); 114 | TestUtils.AreEqual(a1 != b1, r1); 115 | 116 | fp4x2 a2 = fp4x2(-192.278717m, 227.84082m, 62.1381836m, 262.186462m, -404.0531m, 34.449585m, -204.795776m, -285.4118m); 117 | fp4x2 b2 = fp4x2(93.25757m, -258.378052m, -184.0498m, -379.2353m, -370.687317m, -255.947235m, 29.0557861m, 322.407654m); 118 | bool4x2 r2 = bool4x2(true, true, true, true, true, true, true, true); 119 | TestUtils.AreEqual(a2 != b2, r2); 120 | 121 | fp4x2 a3 = fp4x2(-72.20682m, 444.749268m, 238.81781m, 365.1801m, -437.9229m, -362.442627m, 445.954346m, -0.417480469m); 122 | fp4x2 b3 = fp4x2(415.071716m, -467.726135m, -433.784668m, -212.165924m, 474.674927m, 452.483215m, -92.11273m, -385.9221m); 123 | bool4x2 r3 = bool4x2(true, true, true, true, true, true, true, true); 124 | TestUtils.AreEqual(a3 != b3, r3); 125 | } 126 | 127 | [Test] 128 | public static void fp4x2_operator_not_equal_wide_scalar() 129 | { 130 | fp4x2 a0 = fp4x2(-155.4411m, -19.4266052m, 174.633057m, 507.920715m, 59.177063m, 171.151489m, -58.92328m, -398.176849m); 131 | fp b0 = (-393.413544m); 132 | bool4x2 r0 = bool4x2(true, true, true, true, true, true, true, true); 133 | TestUtils.AreEqual(a0 != b0, r0); 134 | 135 | fp4x2 a1 = fp4x2(492.20105m, 270.341m, -380.243256m, 501.899048m, -134.345459m, 458.400452m, 46.7709961m, 161.459961m); 136 | fp b1 = (-165.241516m); 137 | bool4x2 r1 = bool4x2(true, true, true, true, true, true, true, true); 138 | TestUtils.AreEqual(a1 != b1, r1); 139 | 140 | fp4x2 a2 = fp4x2(261.514221m, -0.449920654m, 350.461426m, 202.221008m, 242.664m, 382.677063m, -468.967957m, -497.459473m); 141 | fp b2 = (-145.6124m); 142 | bool4x2 r2 = bool4x2(true, true, true, true, true, true, true, true); 143 | TestUtils.AreEqual(a2 != b2, r2); 144 | 145 | fp4x2 a3 = fp4x2(-80.93225m, -506.490326m, 449.348145m, 210.771m, 249.181824m, -338.468536m, 229.670654m, -76.5433044m); 146 | fp b3 = (-328.587769m); 147 | bool4x2 r3 = bool4x2(true, true, true, true, true, true, true, true); 148 | TestUtils.AreEqual(a3 != b3, r3); 149 | } 150 | 151 | [Test] 152 | public static void fp4x2_operator_not_equal_scalar_wide() 153 | { 154 | fp a0 = (478.353149m); 155 | fp4x2 b0 = fp4x2(459.553223m, 436.453247m, -488.714172m, 392.767944m, -266.736633m, 338.557861m, -338.100128m, -152.314545m); 156 | bool4x2 r0 = bool4x2(true, true, true, true, true, true, true, true); 157 | TestUtils.AreEqual(a0 != b0, r0); 158 | 159 | fp a1 = (-452.820679m); 160 | fp4x2 b1 = fp4x2(209.439331m, 50.10797m, 372.4344m, -488.0213m, 489.740784m, 270.4001m, -472.846771m, -286.850464m); 161 | bool4x2 r1 = bool4x2(true, true, true, true, true, true, true, true); 162 | TestUtils.AreEqual(a1 != b1, r1); 163 | 164 | fp a2 = (-384.691864m); 165 | fp4x2 b2 = fp4x2(443.423523m, 358.7472m, -15.4140625m, -342.179169m, 468.967529m, -130.568085m, 401.785828m, -268.352264m); 166 | bool4x2 r2 = bool4x2(true, true, true, true, true, true, true, true); 167 | TestUtils.AreEqual(a2 != b2, r2); 168 | 169 | fp a3 = (-239.231018m); 170 | fp4x2 b3 = fp4x2(411.386536m, 139.769348m, 334.522034m, -223.629242m, -12.4884644m, 113.468872m, -189.652252m, -212.846558m); 171 | bool4x2 r3 = bool4x2(true, true, true, true, true, true, true, true); 172 | TestUtils.AreEqual(a3 != b3, r3); 173 | } 174 | 175 | 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestFp4x2.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9ef8112f860b09a46a1e6e54d6e7506f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestFp4x3.gen.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | using NUnit.Framework; 10 | using static Unity.Mathematics.FixedPoint.fpmath; 11 | using static Unity.Mathematics.math; 12 | 13 | namespace Unity.Mathematics.FixedPoint.Tests 14 | { 15 | [TestFixture] 16 | public class TestFp4x3 17 | { 18 | [Test] 19 | public static void fp4x3_zero() 20 | { 21 | TestUtils.AreEqual(fp4x3.zero.c0.x, (fp)0); 22 | TestUtils.AreEqual(fp4x3.zero.c0.y, (fp)0); 23 | TestUtils.AreEqual(fp4x3.zero.c0.z, (fp)0); 24 | TestUtils.AreEqual(fp4x3.zero.c0.w, (fp)0); 25 | TestUtils.AreEqual(fp4x3.zero.c1.x, (fp)0); 26 | TestUtils.AreEqual(fp4x3.zero.c1.y, (fp)0); 27 | TestUtils.AreEqual(fp4x3.zero.c1.z, (fp)0); 28 | TestUtils.AreEqual(fp4x3.zero.c1.w, (fp)0); 29 | TestUtils.AreEqual(fp4x3.zero.c2.x, (fp)0); 30 | TestUtils.AreEqual(fp4x3.zero.c2.y, (fp)0); 31 | TestUtils.AreEqual(fp4x3.zero.c2.z, (fp)0); 32 | TestUtils.AreEqual(fp4x3.zero.c2.w, (fp)0); 33 | } 34 | 35 | [Test] 36 | public static void fp4x3_operator_equal_wide_wide() 37 | { 38 | fp4x3 a0 = fp4x3(-135.18924m, -49.0941162m, 169.129822m, 240.8053m, 314.7392m, 442.393m, 177.924438m, 335.5334m, 168.15448m, 350.729553m, 367.178467m, 46.9414673m); 39 | fp4x3 b0 = fp4x3(-220.014648m, 66.98004m, 499.2016m, -371.1131m, 208.448669m, 390.8037m, -72.44382m, 362.97644m, 194.678345m, 471.644836m, -404.044678m, -144.696747m); 40 | bool4x3 r0 = bool4x3(false, false, false, false, false, false, false, false, false, false, false, false); 41 | TestUtils.AreEqual(a0 == b0, r0); 42 | 43 | fp4x3 a1 = fp4x3(188.76416m, -97.2113953m, -293.320984m, -234.822937m, 417.0337m, 26.3864136m, 269.245728m, 29.4741821m, 479.485229m, -237.230957m, -221.9837m, -506.672546m); 44 | fp4x3 b1 = fp4x3(-494.446655m, -252.970367m, 234.417114m, 398.724m, 260.4287m, 370.144226m, 89.579834m, -434.816833m, -109.845337m, 336.973022m, -409.154968m, 500.387573m); 45 | bool4x3 r1 = bool4x3(false, false, false, false, false, false, false, false, false, false, false, false); 46 | TestUtils.AreEqual(a1 == b1, r1); 47 | 48 | fp4x3 a2 = fp4x3(-22.98944m, 487.260864m, -419.731964m, 337.2033m, 245.043884m, 390.215881m, 84.4129639m, 434.2079m, -68.7284241m, 485.769958m, 413.169739m, -418.2693m); 49 | fp4x3 b2 = fp4x3(-174.081818m, 395.101135m, 350.3393m, -243.144592m, -416.397369m, 151.576477m, -18.2243347m, -431.677917m, -468.330963m, 429.495728m, 477.389221m, -433.4254m); 50 | bool4x3 r2 = bool4x3(false, false, false, false, false, false, false, false, false, false, false, false); 51 | TestUtils.AreEqual(a2 == b2, r2); 52 | 53 | fp4x3 a3 = fp4x3(-346.795868m, 504.159668m, 345.186279m, -434.713043m, -499.7741m, 282.019043m, 259.15625m, 306.455933m, 435.2254m, -386.8997m, 211.364014m, -7.229828m); 54 | fp4x3 b3 = fp4x3(273.5464m, -34.9762268m, 221.968445m, 85.91913m, -85.59894m, 392.7608m, -117.924072m, -445.3056m, -242.468964m, 173.643066m, 389.897766m, -14.2904663m); 55 | bool4x3 r3 = bool4x3(false, false, false, false, false, false, false, false, false, false, false, false); 56 | TestUtils.AreEqual(a3 == b3, r3); 57 | } 58 | 59 | [Test] 60 | public static void fp4x3_operator_equal_wide_scalar() 61 | { 62 | fp4x3 a0 = fp4x3(65.6712m, 404.415527m, -269.730164m, 83.6306152m, 152.9945m, -155.868286m, 314.671265m, 386.365173m, 290.04895m, -132.6352m, -65.66748m, -69.68326m); 63 | fp b0 = (-155.815765m); 64 | bool4x3 r0 = bool4x3(false, false, false, false, false, false, false, false, false, false, false, false); 65 | TestUtils.AreEqual(a0 == b0, r0); 66 | 67 | fp4x3 a1 = fp4x3(-191.190765m, -232.895691m, -319.144043m, -49.70108m, -300.8819m, 333.396851m, 386.3775m, -296.7019m, -309.1172m, 141.542358m, -227.323334m, 83.87286m); 68 | fp b1 = (186.845215m); 69 | bool4x3 r1 = bool4x3(false, false, false, false, false, false, false, false, false, false, false, false); 70 | TestUtils.AreEqual(a1 == b1, r1); 71 | 72 | fp4x3 a2 = fp4x3(-410.91687m, -390.103577m, 36.57434m, -427.541443m, -268.170837m, 175.8117m, -193.47995m, 291.051941m, 423.97168m, -429.8739m, -275.156952m, -56.3323669m); 73 | fp b2 = (110.501282m); 74 | bool4x3 r2 = bool4x3(false, false, false, false, false, false, false, false, false, false, false, false); 75 | TestUtils.AreEqual(a2 == b2, r2); 76 | 77 | fp4x3 a3 = fp4x3(-95.83597m, 253.006165m, -300.509521m, 314.866516m, 195.616211m, -26.1289063m, -284.7747m, -242.672058m, 140.3606m, 505.644348m, 506.537964m, -502.3698m); 78 | fp b3 = (-124.865326m); 79 | bool4x3 r3 = bool4x3(false, false, false, false, false, false, false, false, false, false, false, false); 80 | TestUtils.AreEqual(a3 == b3, r3); 81 | } 82 | 83 | [Test] 84 | public static void fp4x3_operator_equal_scalar_wide() 85 | { 86 | fp a0 = (36.38391m); 87 | fp4x3 b0 = fp4x3(-400.4892m, -71.2868347m, 156.978088m, -225.238739m, 499.141785m, -211.979919m, 428.311951m, -489.501343m, -5.691559m, -30.8659363m, -362.9831m, 184.503174m); 88 | bool4x3 r0 = bool4x3(false, false, false, false, false, false, false, false, false, false, false, false); 89 | TestUtils.AreEqual(a0 == b0, r0); 90 | 91 | fp a1 = (-160.470612m); 92 | fp4x3 b1 = fp4x3(316.668823m, 390.369263m, 505.1051m, -294.6487m, 443.1991m, 96.5592651m, -257.012939m, -245.054962m, 326.464844m, -23.9599m, -168.694885m, 386.2486m); 93 | bool4x3 r1 = bool4x3(false, false, false, false, false, false, false, false, false, false, false, false); 94 | TestUtils.AreEqual(a1 == b1, r1); 95 | 96 | fp a2 = (-227.090637m); 97 | fp4x3 b2 = fp4x3(-336.612427m, 365.108154m, -405.390839m, -473.995483m, 298.435364m, -149.86322m, 450.0664m, 153.47644m, 56.28778m, 39.3421021m, -350.403717m, -482.717224m); 98 | bool4x3 r2 = bool4x3(false, false, false, false, false, false, false, false, false, false, false, false); 99 | TestUtils.AreEqual(a2 == b2, r2); 100 | 101 | fp a3 = (239.9654m); 102 | fp4x3 b3 = fp4x3(-3.40603638m, -1.49484253m, 105.960449m, 151.537537m, 63.2832031m, -289.693176m, 137.553772m, -247.666473m, -339.420563m, 23.2382813m, 21.1778564m, 477.03656m); 103 | bool4x3 r3 = bool4x3(false, false, false, false, false, false, false, false, false, false, false, false); 104 | TestUtils.AreEqual(a3 == b3, r3); 105 | } 106 | 107 | [Test] 108 | public static void fp4x3_operator_not_equal_wide_wide() 109 | { 110 | fp4x3 a0 = fp4x3(279.994141m, -43.34201m, -465.724731m, 317.466553m, 85.7149658m, 360.8905m, 366.081543m, 154.542847m, 332.4262m, 397.11322m, -431.374969m, 489.0108m); 111 | fp4x3 b0 = fp4x3(-460.9121m, -476.009033m, 468.1364m, -341.012543m, -62.65805m, -458.801666m, -457.730225m, -59.5232544m, 3.024231m, 155.812744m, -19.8399048m, -6.01693726m); 112 | bool4x3 r0 = bool4x3(true, true, true, true, true, true, true, true, true, true, true, true); 113 | TestUtils.AreEqual(a0 != b0, r0); 114 | 115 | fp4x3 a1 = fp4x3(398.4336m, -489.817932m, 171.4049m, -67.82968m, -192.278717m, 227.84082m, 62.1381836m, 262.186462m, -404.0531m, 34.449585m, -204.795776m, -285.4118m); 116 | fp4x3 b1 = fp4x3(-406.207916m, -102.420715m, -40.362915m, 452.6754m, 93.25757m, -258.378052m, -184.0498m, -379.2353m, -370.687317m, -255.947235m, 29.0557861m, 322.407654m); 117 | bool4x3 r1 = bool4x3(true, true, true, true, true, true, true, true, true, true, true, true); 118 | TestUtils.AreEqual(a1 != b1, r1); 119 | 120 | fp4x3 a2 = fp4x3(-72.20682m, 444.749268m, 238.81781m, 365.1801m, -437.9229m, -362.442627m, 445.954346m, -0.417480469m, -506.828369m, 245.477051m, -173.571045m, 390.338562m); 121 | fp4x3 b2 = fp4x3(415.071716m, -467.726135m, -433.784668m, -212.165924m, 474.674927m, 452.483215m, -92.11273m, -385.9221m, 420.2151m, -239.176056m, -99.0791m, 4.476013m); 122 | bool4x3 r2 = bool4x3(true, true, true, true, true, true, true, true, true, true, true, true); 123 | TestUtils.AreEqual(a2 != b2, r2); 124 | 125 | fp4x3 a3 = fp4x3(252.837769m, 47.8658447m, 457.7105m, -313.22113m, 391.203857m, 481.786133m, 26.8878174m, -298.1424m, 240.077454m, -332.455139m, -333.607178m, -313.1897m); 126 | fp4x3 b3 = fp4x3(264.348572m, 451.312317m, 232.958008m, -142.6222m, -300.2256m, 268.333252m, -112.103546m, -270.494019m, -71.9932251m, 99.46326m, 321.7033m, 200.059631m); 127 | bool4x3 r3 = bool4x3(true, true, true, true, true, true, true, true, true, true, true, true); 128 | TestUtils.AreEqual(a3 != b3, r3); 129 | } 130 | 131 | [Test] 132 | public static void fp4x3_operator_not_equal_wide_scalar() 133 | { 134 | fp4x3 a0 = fp4x3(-155.4411m, -19.4266052m, 174.633057m, 507.920715m, 59.177063m, 171.151489m, -58.92328m, -398.176849m, 492.20105m, -165.241516m, 270.341m, -380.243256m); 135 | fp b0 = (-393.413544m); 136 | bool4x3 r0 = bool4x3(true, true, true, true, true, true, true, true, true, true, true, true); 137 | TestUtils.AreEqual(a0 != b0, r0); 138 | 139 | fp4x3 a1 = fp4x3(501.899048m, 458.400452m, 46.7709961m, 161.459961m, 261.514221m, -145.6124m, -0.449920654m, 350.461426m, 202.221008m, 242.664m, 382.677063m, -468.967957m); 140 | fp b1 = (-134.345459m); 141 | bool4x3 r1 = bool4x3(true, true, true, true, true, true, true, true, true, true, true, true); 142 | TestUtils.AreEqual(a1 != b1, r1); 143 | 144 | fp4x3 a2 = fp4x3(-497.459473m, -328.587769m, -506.490326m, 449.348145m, 210.771m, 249.181824m, -338.468536m, 229.670654m, -76.5433044m, 317.286072m, 401.939575m, 210.984863m); 145 | fp b2 = (-80.93225m); 146 | bool4x3 r2 = bool4x3(true, true, true, true, true, true, true, true, true, true, true, true); 147 | TestUtils.AreEqual(a2 != b2, r2); 148 | 149 | fp4x3 a3 = fp4x3(-147.096313m, 207.731384m, 284.3921m, -509.0853m, 414.307617m, -52.2944641m, -140.437927m, -316.787781m, -358.696838m, 312.31897m, 270.629456m, -140.016724m); 150 | fp b3 = (-193.399048m); 151 | bool4x3 r3 = bool4x3(true, true, true, true, true, true, true, true, true, true, true, true); 152 | TestUtils.AreEqual(a3 != b3, r3); 153 | } 154 | 155 | [Test] 156 | public static void fp4x3_operator_not_equal_scalar_wide() 157 | { 158 | fp a0 = (478.353149m); 159 | fp4x3 b0 = fp4x3(459.553223m, 436.453247m, -488.714172m, 392.767944m, -266.736633m, 338.557861m, -338.100128m, -152.314545m, -452.820679m, 209.439331m, 50.10797m, 372.4344m); 160 | bool4x3 r0 = bool4x3(true, true, true, true, true, true, true, true, true, true, true, true); 161 | TestUtils.AreEqual(a0 != b0, r0); 162 | 163 | fp a1 = (-488.0213m); 164 | fp4x3 b1 = fp4x3(489.740784m, 270.4001m, -472.846771m, -286.850464m, -384.691864m, 443.423523m, 358.7472m, -15.4140625m, -342.179169m, 468.967529m, -130.568085m, 401.785828m); 165 | bool4x3 r1 = bool4x3(true, true, true, true, true, true, true, true, true, true, true, true); 166 | TestUtils.AreEqual(a1 != b1, r1); 167 | 168 | fp a2 = (-268.352264m); 169 | fp4x3 b2 = fp4x3(-239.231018m, 411.386536m, 139.769348m, 334.522034m, -223.629242m, -12.4884644m, 113.468872m, -189.652252m, -212.846558m, 306.1256m, -178.330383m, 382.141968m); 170 | bool4x3 r2 = bool4x3(true, true, true, true, true, true, true, true, true, true, true, true); 171 | TestUtils.AreEqual(a2 != b2, r2); 172 | 173 | fp a3 = (-340.8656m); 174 | fp4x3 b3 = fp4x3(-17.58023m, -409.874847m, -349.70166m, 275.8543m, -229.371948m, -127.505737m, 90.75342m, -422.087128m, -2.44754028m, -280.5517m, -484.374359m, -33.7634277m); 175 | bool4x3 r3 = bool4x3(true, true, true, true, true, true, true, true, true, true, true, true); 176 | TestUtils.AreEqual(a3 != b3, r3); 177 | } 178 | 179 | 180 | } 181 | } 182 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestFp4x3.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9ca0509c537be574f8f89af3a9dd639b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestFp4x4.gen.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | using NUnit.Framework; 10 | using static Unity.Mathematics.FixedPoint.fpmath; 11 | using static Unity.Mathematics.math; 12 | 13 | namespace Unity.Mathematics.FixedPoint.Tests 14 | { 15 | [TestFixture] 16 | public class TestFp4x4 17 | { 18 | [Test] 19 | public static void fp4x4_zero() 20 | { 21 | TestUtils.AreEqual(fp4x4.zero.c0.x, (fp)0); 22 | TestUtils.AreEqual(fp4x4.zero.c0.y, (fp)0); 23 | TestUtils.AreEqual(fp4x4.zero.c0.z, (fp)0); 24 | TestUtils.AreEqual(fp4x4.zero.c0.w, (fp)0); 25 | TestUtils.AreEqual(fp4x4.zero.c1.x, (fp)0); 26 | TestUtils.AreEqual(fp4x4.zero.c1.y, (fp)0); 27 | TestUtils.AreEqual(fp4x4.zero.c1.z, (fp)0); 28 | TestUtils.AreEqual(fp4x4.zero.c1.w, (fp)0); 29 | TestUtils.AreEqual(fp4x4.zero.c2.x, (fp)0); 30 | TestUtils.AreEqual(fp4x4.zero.c2.y, (fp)0); 31 | TestUtils.AreEqual(fp4x4.zero.c2.z, (fp)0); 32 | TestUtils.AreEqual(fp4x4.zero.c2.w, (fp)0); 33 | TestUtils.AreEqual(fp4x4.zero.c3.x, (fp)0); 34 | TestUtils.AreEqual(fp4x4.zero.c3.y, (fp)0); 35 | TestUtils.AreEqual(fp4x4.zero.c3.z, (fp)0); 36 | TestUtils.AreEqual(fp4x4.zero.c3.w, (fp)0); 37 | } 38 | 39 | [Test] 40 | public static void fp4x4_identity() 41 | { 42 | TestUtils.AreEqual(fp4x4.identity.c0.x, (fp)1); 43 | TestUtils.AreEqual(fp4x4.identity.c0.y, (fp)0); 44 | TestUtils.AreEqual(fp4x4.identity.c0.z, (fp)0); 45 | TestUtils.AreEqual(fp4x4.identity.c0.w, (fp)0); 46 | TestUtils.AreEqual(fp4x4.identity.c1.x, (fp)0); 47 | TestUtils.AreEqual(fp4x4.identity.c1.y, (fp)1); 48 | TestUtils.AreEqual(fp4x4.identity.c1.z, (fp)0); 49 | TestUtils.AreEqual(fp4x4.identity.c1.w, (fp)0); 50 | TestUtils.AreEqual(fp4x4.identity.c2.x, (fp)0); 51 | TestUtils.AreEqual(fp4x4.identity.c2.y, (fp)0); 52 | TestUtils.AreEqual(fp4x4.identity.c2.z, (fp)1); 53 | TestUtils.AreEqual(fp4x4.identity.c2.w, (fp)0); 54 | TestUtils.AreEqual(fp4x4.identity.c3.x, (fp)0); 55 | TestUtils.AreEqual(fp4x4.identity.c3.y, (fp)0); 56 | TestUtils.AreEqual(fp4x4.identity.c3.z, (fp)0); 57 | TestUtils.AreEqual(fp4x4.identity.c3.w, (fp)1); 58 | } 59 | 60 | [Test] 61 | public static void fp4x4_operator_equal_wide_wide() 62 | { 63 | fp4x4 a0 = fp4x4(-135.18924m, -49.0941162m, 169.129822m, 240.8053m, 314.7392m, 442.393m, 177.924438m, 335.5334m, 168.15448m, 350.729553m, 367.178467m, 46.9414673m, 188.76416m, -97.2113953m, -293.320984m, -234.822937m); 64 | fp4x4 b0 = fp4x4(-220.014648m, 66.98004m, 499.2016m, -371.1131m, 208.448669m, 390.8037m, -72.44382m, 362.97644m, 194.678345m, 471.644836m, -404.044678m, -144.696747m, -494.446655m, -252.970367m, 234.417114m, 398.724m); 65 | bool4x4 r0 = bool4x4(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false); 66 | TestUtils.AreEqual(a0 == b0, r0); 67 | 68 | fp4x4 a1 = fp4x4(417.0337m, 26.3864136m, 269.245728m, 29.4741821m, 479.485229m, -237.230957m, -221.9837m, -506.672546m, -22.98944m, 487.260864m, -419.731964m, 337.2033m, 245.043884m, 390.215881m, 84.4129639m, 434.2079m); 69 | fp4x4 b1 = fp4x4(260.4287m, 370.144226m, 89.579834m, -434.816833m, -109.845337m, 336.973022m, -409.154968m, 500.387573m, -174.081818m, 395.101135m, 350.3393m, -243.144592m, -416.397369m, 151.576477m, -18.2243347m, -431.677917m); 70 | bool4x4 r1 = bool4x4(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false); 71 | TestUtils.AreEqual(a1 == b1, r1); 72 | 73 | fp4x4 a2 = fp4x4(-68.7284241m, 485.769958m, 413.169739m, -418.2693m, -346.795868m, 504.159668m, 345.186279m, -434.713043m, -499.7741m, 282.019043m, 259.15625m, 306.455933m, 435.2254m, -386.8997m, 211.364014m, -7.229828m); 74 | fp4x4 b2 = fp4x4(-468.330963m, 429.495728m, 477.389221m, -433.4254m, 273.5464m, -34.9762268m, 221.968445m, 85.91913m, -85.59894m, 392.7608m, -117.924072m, -445.3056m, -242.468964m, 173.643066m, 389.897766m, -14.2904663m); 75 | bool4x4 r2 = bool4x4(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false); 76 | TestUtils.AreEqual(a2 == b2, r2); 77 | 78 | fp4x4 a3 = fp4x4(-32.0532227m, -106.298553m, -382.924957m, -424.7822m, -267.8125m, 229.897034m, 358.1797m, -76.33087m, -493.684326m, 139.350586m, 211.756653m, -178.8342m, -262.786865m, 506.270325m, 352.288879m, -132.7894m); 79 | fp4x4 b3 = fp4x4(-317.55304m, -265.652771m, -424.168274m, 11.6213379m, 408.686218m, -181.278351m, -139.8205m, -488.924561m, -207.703278m, -341.9881m, -470.552917m, -462.804352m, 419.075562m, 143.638733m, -79.912384m, -224.6936m); 80 | bool4x4 r3 = bool4x4(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false); 81 | TestUtils.AreEqual(a3 == b3, r3); 82 | } 83 | 84 | [Test] 85 | public static void fp4x4_operator_equal_wide_scalar() 86 | { 87 | fp4x4 a0 = fp4x4(65.6712m, 404.415527m, -269.730164m, 83.6306152m, 152.9945m, -155.868286m, 314.671265m, 386.365173m, 290.04895m, -132.6352m, -65.66748m, -69.68326m, -191.190765m, 186.845215m, -232.895691m, -319.144043m); 88 | fp b0 = (-155.815765m); 89 | bool4x4 r0 = bool4x4(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false); 90 | TestUtils.AreEqual(a0 == b0, r0); 91 | 92 | fp4x4 a1 = fp4x4(-49.70108m, 333.396851m, 386.3775m, -296.7019m, -309.1172m, 141.542358m, -227.323334m, 83.87286m, -410.91687m, 110.501282m, -390.103577m, 36.57434m, -427.541443m, -268.170837m, 175.8117m, -193.47995m); 93 | fp b1 = (-300.8819m); 94 | bool4x4 r1 = bool4x4(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false); 95 | TestUtils.AreEqual(a1 == b1, r1); 96 | 97 | fp4x4 a2 = fp4x4(291.051941m, -429.8739m, -275.156952m, -56.3323669m, -95.83597m, -124.865326m, 253.006165m, -300.509521m, 314.866516m, 195.616211m, -26.1289063m, -284.7747m, -242.672058m, 140.3606m, 505.644348m, 506.537964m); 98 | fp b2 = (423.97168m); 99 | bool4x4 r2 = bool4x4(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false); 100 | TestUtils.AreEqual(a2 == b2, r2); 101 | 102 | fp4x4 a3 = fp4x4(-502.3698m, 87.36731m, -433.136383m, -149.626923m, -358.698547m, -249.126862m, 469.5932m, 511.757751m, 51.911377m, 245.630432m, 192.774841m, -162.209167m, 205.5904m, -376.464355m, 270.5208m, -388.2033m); 103 | fp b3 = (-249.517639m); 104 | bool4x4 r3 = bool4x4(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false); 105 | TestUtils.AreEqual(a3 == b3, r3); 106 | } 107 | 108 | [Test] 109 | public static void fp4x4_operator_equal_scalar_wide() 110 | { 111 | fp a0 = (36.38391m); 112 | fp4x4 b0 = fp4x4(-400.4892m, -71.2868347m, 156.978088m, -225.238739m, 499.141785m, -211.979919m, 428.311951m, -489.501343m, -5.691559m, -30.8659363m, -362.9831m, 184.503174m, -160.470612m, 316.668823m, 390.369263m, 505.1051m); 113 | bool4x4 r0 = bool4x4(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false); 114 | TestUtils.AreEqual(a0 == b0, r0); 115 | 116 | fp a1 = (-294.6487m); 117 | fp4x4 b1 = fp4x4(443.1991m, 96.5592651m, -257.012939m, -245.054962m, 326.464844m, -23.9599m, -168.694885m, 386.2486m, -227.090637m, -336.612427m, 365.108154m, -405.390839m, -473.995483m, 298.435364m, -149.86322m, 450.0664m); 118 | bool4x4 r1 = bool4x4(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false); 119 | TestUtils.AreEqual(a1 == b1, r1); 120 | 121 | fp a2 = (153.47644m); 122 | fp4x4 b2 = fp4x4(56.28778m, 39.3421021m, -350.403717m, -482.717224m, 239.9654m, -3.40603638m, -1.49484253m, 105.960449m, 151.537537m, 63.2832031m, -289.693176m, 137.553772m, -247.666473m, -339.420563m, 23.2382813m, 21.1778564m); 123 | bool4x4 r2 = bool4x4(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false); 124 | TestUtils.AreEqual(a2 == b2, r2); 125 | 126 | fp a3 = (477.03656m); 127 | fp4x4 b3 = fp4x4(-411.318146m, 122.397095m, -401.49884m, -230.5611m, -214.954041m, 464.6731m, -186.327m, -99.4873352m, 214.232483m, -387.3675m, -448.7962m, 427.889526m, -43.6960449m, 182.698669m, 298.880127m, 246.436829m); 128 | bool4x4 r3 = bool4x4(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false); 129 | TestUtils.AreEqual(a3 == b3, r3); 130 | } 131 | 132 | [Test] 133 | public static void fp4x4_operator_not_equal_wide_wide() 134 | { 135 | fp4x4 a0 = fp4x4(279.994141m, -43.34201m, -465.724731m, 317.466553m, 85.7149658m, 360.8905m, 366.081543m, 154.542847m, 332.4262m, 397.11322m, -431.374969m, 489.0108m, 398.4336m, -489.817932m, 171.4049m, -67.82968m); 136 | fp4x4 b0 = fp4x4(-460.9121m, -476.009033m, 468.1364m, -341.012543m, -62.65805m, -458.801666m, -457.730225m, -59.5232544m, 3.024231m, 155.812744m, -19.8399048m, -6.01693726m, -406.207916m, -102.420715m, -40.362915m, 452.6754m); 137 | bool4x4 r0 = bool4x4(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true); 138 | TestUtils.AreEqual(a0 != b0, r0); 139 | 140 | fp4x4 a1 = fp4x4(-192.278717m, 227.84082m, 62.1381836m, 262.186462m, -404.0531m, 34.449585m, -204.795776m, -285.4118m, -72.20682m, 444.749268m, 238.81781m, 365.1801m, -437.9229m, -362.442627m, 445.954346m, -0.417480469m); 141 | fp4x4 b1 = fp4x4(93.25757m, -258.378052m, -184.0498m, -379.2353m, -370.687317m, -255.947235m, 29.0557861m, 322.407654m, 415.071716m, -467.726135m, -433.784668m, -212.165924m, 474.674927m, 452.483215m, -92.11273m, -385.9221m); 142 | bool4x4 r1 = bool4x4(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true); 143 | TestUtils.AreEqual(a1 != b1, r1); 144 | 145 | fp4x4 a2 = fp4x4(-506.828369m, 245.477051m, -173.571045m, 390.338562m, 252.837769m, 47.8658447m, 457.7105m, -313.22113m, 391.203857m, 481.786133m, 26.8878174m, -298.1424m, 240.077454m, -332.455139m, -333.607178m, -313.1897m); 146 | fp4x4 b2 = fp4x4(420.2151m, -239.176056m, -99.0791m, 4.476013m, 264.348572m, 451.312317m, 232.958008m, -142.6222m, -300.2256m, 268.333252m, -112.103546m, -270.494019m, -71.9932251m, 99.46326m, 321.7033m, 200.059631m); 147 | bool4x4 r2 = bool4x4(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true); 148 | TestUtils.AreEqual(a2 != b2, r2); 149 | 150 | fp4x4 a3 = fp4x4(141.730164m, -261.118866m, 295.578735m, -16.0213013m, -487.266846m, -208.563873m, 30.3494873m, -157.876465m, 275.896057m, -450.7207m, -61.8988647m, 99.19006m, 206.357483m, 32.74652m, -278.623962m, -173.916809m); 151 | fp4x4 b3 = fp4x4(-91.62833m, -113.010864m, 465.764221m, -485.127716m, -71.7267761m, 486.469238m, 425.8678m, -158.880951m, 292.179565m, 234.179932m, 243.249329m, 117.275146m, 3.97106934m, 410.42218m, -221.124725m, 443.13446m); 152 | bool4x4 r3 = bool4x4(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true); 153 | TestUtils.AreEqual(a3 != b3, r3); 154 | } 155 | 156 | [Test] 157 | public static void fp4x4_operator_not_equal_wide_scalar() 158 | { 159 | fp4x4 a0 = fp4x4(-155.4411m, -19.4266052m, 174.633057m, 507.920715m, 59.177063m, 171.151489m, -58.92328m, -398.176849m, 492.20105m, -165.241516m, 270.341m, -380.243256m, 501.899048m, -134.345459m, 458.400452m, 46.7709961m); 160 | fp b0 = (-393.413544m); 161 | bool4x4 r0 = bool4x4(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true); 162 | TestUtils.AreEqual(a0 != b0, r0); 163 | 164 | fp4x4 a1 = fp4x4(161.459961m, -145.6124m, -0.449920654m, 350.461426m, 202.221008m, 242.664m, 382.677063m, -468.967957m, -497.459473m, -80.93225m, -328.587769m, -506.490326m, 449.348145m, 210.771m, 249.181824m, -338.468536m); 165 | fp b1 = (261.514221m); 166 | bool4x4 r1 = bool4x4(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true); 167 | TestUtils.AreEqual(a1 != b1, r1); 168 | 169 | fp4x4 a2 = fp4x4(229.670654m, 317.286072m, 401.939575m, 210.984863m, -147.096313m, -193.399048m, 207.731384m, 284.3921m, -509.0853m, 414.307617m, -52.2944641m, -140.437927m, -316.787781m, -358.696838m, 312.31897m, 270.629456m); 170 | fp b2 = (-76.5433044m); 171 | bool4x4 r2 = bool4x4(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true); 172 | TestUtils.AreEqual(a2 != b2, r2); 173 | 174 | fp4x4 a3 = fp4x4(-140.016724m, 113.137207m, 479.6996m, 6.097473m, -83.63458m, 249.909363m, 303.956m, 464.888672m, 44.6365356m, -259.91626m, -242.33551m, -403.686523m, -469.1471m, 135.987488m, -490.840759m, 470.225281m); 175 | fp b3 = (108.910645m); 176 | bool4x4 r3 = bool4x4(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true); 177 | TestUtils.AreEqual(a3 != b3, r3); 178 | } 179 | 180 | [Test] 181 | public static void fp4x4_operator_not_equal_scalar_wide() 182 | { 183 | fp a0 = (478.353149m); 184 | fp4x4 b0 = fp4x4(459.553223m, 436.453247m, -488.714172m, 392.767944m, -266.736633m, 338.557861m, -338.100128m, -152.314545m, -452.820679m, 209.439331m, 50.10797m, 372.4344m, -488.0213m, 489.740784m, 270.4001m, -472.846771m); 185 | bool4x4 r0 = bool4x4(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true); 186 | TestUtils.AreEqual(a0 != b0, r0); 187 | 188 | fp a1 = (-286.850464m); 189 | fp4x4 b1 = fp4x4(-384.691864m, 443.423523m, 358.7472m, -15.4140625m, -342.179169m, 468.967529m, -130.568085m, 401.785828m, -268.352264m, -239.231018m, 411.386536m, 139.769348m, 334.522034m, -223.629242m, -12.4884644m, 113.468872m); 190 | bool4x4 r1 = bool4x4(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true); 191 | TestUtils.AreEqual(a1 != b1, r1); 192 | 193 | fp a2 = (-189.652252m); 194 | fp4x4 b2 = fp4x4(-212.846558m, 306.1256m, -178.330383m, 382.141968m, -340.8656m, -17.58023m, -409.874847m, -349.70166m, 275.8543m, -229.371948m, -127.505737m, 90.75342m, -422.087128m, -2.44754028m, -280.5517m, -484.374359m); 195 | bool4x4 r2 = bool4x4(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true); 196 | TestUtils.AreEqual(a2 != b2, r2); 197 | 198 | fp a3 = (-33.7634277m); 199 | fp4x4 b3 = fp4x4(374.593872m, 437.092346m, 286.22583m, -18.2327881m, 289.732361m, 479.485718m, 153.853943m, 502.982117m, -510.3844m, 65.78888m, -237.4867m, 219.916138m, -275.342743m, -78.93146m, -449.403564m, -253.034515m); 200 | bool4x4 r3 = bool4x4(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true); 201 | TestUtils.AreEqual(a3 != b3, r3); 202 | } 203 | 204 | 205 | } 206 | } 207 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestFp4x4.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 15ffc674315838942a9971649b068400 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestMath.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6b75f3885079afb40adaaa644e468130 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Tests/Tests/Shared/TestUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b1dde2d1185f01a448125db38711578f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Tests/Unity.Mathematics.Tests.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Unity.Mathematics.FixedPoint.Tests", 3 | "optionalUnityReferences": [ 4 | "TestAssemblies" 5 | ], 6 | "references": [ 7 | "Unity.Mathematics.FixedPoint", 8 | "Unity.Mathematics.Tests", 9 | "Unity.Mathematics" 10 | ], 11 | "includePlatforms": [ 12 | "Editor" 13 | ], 14 | "allowUnsafeCode": true 15 | } 16 | -------------------------------------------------------------------------------- /Tests/Unity.Mathematics.Tests.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ebafb4712378c574f98704b974ee4588 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Tests/packages.config.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aa251660f2c5f154e93f1c89c0eaf284 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 1 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 0 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | Windows Store Apps: WindowsStoreApps 27 | second: 28 | enabled: 1 29 | settings: {} 30 | userData: 31 | assetBundleName: 32 | assetBundleVariant: 33 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint.CodeGen.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2f771937a4125e342b5a8732cc807324 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint.CodeGen/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.IO; 4 | using System.Threading; 5 | 6 | namespace Unity.Mathematics.Mathematics.CodeGen 7 | { 8 | class MainClass 9 | { 10 | public static void Main (string[] args) 11 | { 12 | Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); 13 | 14 | var thisExeDir = Path.GetDirectoryName(typeof(MainClass).Assembly.Location); 15 | if (thisExeDir == null) 16 | { 17 | throw new InvalidOperationException($"Unable to get path of current assembly from `{typeof(MainClass).Assembly.Location}`"); 18 | } 19 | var directory = new DirectoryInfo(thisExeDir); 20 | 21 | // go from `src/Unity.Mathematics.CodeGen/bin/Debug` 22 | 23 | // to `src/`, so 3 directories 24 | 25 | var parent = directory.Parent?.Parent?.Parent; 26 | if (parent == null) 27 | { 28 | throw new InvalidOperationException($"Unable to get path of current assembly from `{typeof(MainClass).Assembly.Location}`"); 29 | } 30 | 31 | var implementationDirectory = new DirectoryInfo(Path.Combine(parent.FullName, "Unity.Mathematics.FixedPoint")); 32 | if (!implementationDirectory.Exists) 33 | { 34 | throw new InvalidOperationException($"The directory `{implementationDirectory.FullName}` must exist"); 35 | } 36 | 37 | var testDirectory = new DirectoryInfo(Path.Combine(parent.FullName, "Tests/Tests/Shared")); 38 | if (!implementationDirectory.Exists) 39 | { 40 | throw new InvalidOperationException($"The directory `{testDirectory.FullName}` must exist"); 41 | } 42 | 43 | Console.WriteLine("Generating swizzle and operators: " + directory); 44 | VectorGenerator.Write(implementationDirectory.FullName, testDirectory.FullName); 45 | Console.WriteLine("Done"); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint.CodeGen/Program.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cbd8eb17d2c8b4c4cae2a97e433aed6b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint.CodeGen/Properties.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b2742947c04eb9e4a82ab6db83d0dc4f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint.CodeGen/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | 9 | [assembly: AssemblyTitle("Unity.Mathematics.FixedPoint.CodeGen")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("Unity.Mathematics.FixedPoint.CodeGen")] 14 | [assembly: AssemblyCopyright("Copyright © 2019")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | 22 | [assembly: ComVisible(false)] 23 | 24 | // The following GUID is for the ID of the typelib if this project is exposed to COM 25 | 26 | [assembly: Guid("293EBCD6-CACD-4DA8-A518-FFF629268C0F")] 27 | 28 | // Version information for an assembly consists of the following four values: 29 | // 30 | // Major Version 31 | // Minor Version 32 | // Build Number 33 | // Revision 34 | // 35 | // You can specify all the values or you can default the Build and Revision Numbers 36 | // by using the '*' as shown below: 37 | // [assembly: AssemblyVersion("1.0.*")] 38 | 39 | [assembly: AssemblyVersion("1.0.0.0")] 40 | [assembly: AssemblyFileVersion("1.0.0.0")] 41 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint.CodeGen/Properties/AssemblyInfo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fa8513dbc8db2d941bf0bf9e63595318 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint.CodeGen/Unity.Mathematics.CodeGen.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {293EBCD6-CACD-4DA8-A518-FFF629268C0F} 8 | {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 9 | Exe 10 | Properties 11 | UnityEngine.Mathematics.CodeGen 12 | UnityEngine.Mathematics.CodeGen 13 | v4.7.1 14 | 512 15 | 16 | 17 | x64 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | x64 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 56 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint.CodeGen/Unity.Mathematics.CodeGen.csproj.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f07aa78780335f844b6364b03f521a45 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint.CodeGen/VectorGenerator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: adb4997b63fc83446b7005dedfc18795 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a5ff52ae83a0dec4fbbabbf58dc46948 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint/Unity.Mathematics.FixedPoint.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Unity.Mathematics.FixedPoint", 3 | "allowUnsafeCode": true, 4 | "references": [ 5 | "Unity.Mathematics" 6 | ] 7 | } -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint/Unity.Mathematics.FixedPoint.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0efc075be62ff074592f9ad36fcc4058 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint/fp.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 911f02e68ffcbd445a2a657cb0beaed3 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint/fp/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2019 Daniel Månsson 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | 9 | This project uses code from the FixedMath.Net library, which is under the following license: 10 | 11 | Copyright 2012 André Slupik 12 | 13 | Licensed under the Apache License, Version 2.0 (the "License"); 14 | you may not use this file except in compliance with the License. 15 | You may obtain a copy of the License at 16 | 17 | http://www.apache.org/licenses/LICENSE-2.0 18 | 19 | Unless required by applicable law or agreed to in writing, software 20 | distributed under the License is distributed on an "AS IS" BASIS, 21 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | See the License for the specific language governing permissions and 23 | limitations under the License. 24 | 25 | This project uses code from the libfixmath library, which is under the following license: 26 | 27 | Copyright (C) 2012 Petteri Aimonen 28 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 29 | 30 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 31 | 32 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 33 | 34 | This project uses code from the log2fix library, which is under the following license: 35 | 36 | The MIT License (MIT) 37 | 38 | Copyright (c) 2015 Dan Moulding 39 | 40 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 41 | 42 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 43 | 44 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint/fp/LICENSE.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3fb362915a90ed34f9c6afb693c92c24 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint/fp/README.txt: -------------------------------------------------------------------------------- 1 | This library implements "Fix64", a 64 bit fixed point 31.32 numeric type and transcendent operations on it (square root, trig, etc). It is well covered by unit tests. However, it is still missing some operations; in particular, Tangent is not well tested yet. 2 | 3 | In the unit tests you'll find implementations for Int32-based (Q15.16) and Byte-based (Q3.4) numeric types. These were used for exploration of boundary conditions etc., but I'm keeping the code there only for reference. 4 | 5 | This project started as a port of libfixmath (http://code.google.com/p/libfixmath/). 6 | 7 | Note that the type requires explicit casts to convert to floating point and this is intentional, the difference between fixed point and floating point math is as important as the one between floating point and integral math. 8 | 9 | === 10 | 11 | (2019/12/31) Naming was changed to align with Unity.Mathematics naming conventions. -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint/fp/README.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bd3b8c155bed4bd468886314e8208e99 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint/fp/fp.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5968f92bf4084764eb41681c5005d22b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint/fp/fp_sin_lut.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 995b56ceec52d9042bf11998044a6351 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint/fp/fp_tan_lut.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9921801a62c0dea4f9fdbe1eb70ffbfc 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint/fp2.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 63251509eec5a0d43a78a7fa02fb9289 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint/fp2x2.gen.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | using System; 10 | using System.Runtime.CompilerServices; 11 | using static Unity.Mathematics.math; 12 | 13 | #pragma warning disable 0660, 0661 14 | 15 | namespace Unity.Mathematics.FixedPoint 16 | { 17 | [System.Serializable] 18 | public partial struct fp2x2 : System.IEquatable, IFormattable 19 | { 20 | public fp2 c0; 21 | public fp2 c1; 22 | 23 | /// fp2x2 identity transform. 24 | public static readonly fp2x2 identity = new fp2x2((fp)1, (fp)0, (fp)0, (fp)1); 25 | 26 | /// fp2x2 zero value. 27 | public static readonly fp2x2 zero; 28 | 29 | /// Constructs a fp2x2 matrix from two fp2 vectors. 30 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 31 | public fp2x2(fp2 c0, fp2 c1) 32 | { 33 | this.c0 = c0; 34 | this.c1 = c1; 35 | } 36 | 37 | /// Constructs a fp2x2 matrix from 4 fp values given in row-major order. 38 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 39 | public fp2x2(fp m00, fp m01, 40 | fp m10, fp m11) 41 | { 42 | this.c0 = new fp2(m00, m10); 43 | this.c1 = new fp2(m01, m11); 44 | } 45 | 46 | /// Constructs a fp2x2 matrix from a single fp value by assigning it to every component. 47 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 48 | public fp2x2(fp v) 49 | { 50 | this.c0 = v; 51 | this.c1 = v; 52 | } 53 | 54 | /// Constructs a fp2x2 matrix from a single int value by converting it to fp and assigning it to every component. 55 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 56 | public fp2x2(int v) 57 | { 58 | this.c0 = (fp2)v; 59 | this.c1 = (fp2)v; 60 | } 61 | 62 | /// Constructs a fp2x2 matrix from a int2x2 matrix by componentwise conversion. 63 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 64 | public fp2x2(int2x2 v) 65 | { 66 | this.c0 = (fp2)v.c0; 67 | this.c1 = (fp2)v.c1; 68 | } 69 | 70 | /// Constructs a fp2x2 matrix from a single uint value by converting it to fp and assigning it to every component. 71 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 72 | public fp2x2(uint v) 73 | { 74 | this.c0 = (fp2)v; 75 | this.c1 = (fp2)v; 76 | } 77 | 78 | /// Constructs a fp2x2 matrix from a uint2x2 matrix by componentwise conversion. 79 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 80 | public fp2x2(uint2x2 v) 81 | { 82 | this.c0 = (fp2)v.c0; 83 | this.c1 = (fp2)v.c1; 84 | } 85 | 86 | 87 | /// Implicitly converts a single fp value to a fp2x2 matrix by assigning it to every component. 88 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 89 | public static implicit operator fp2x2(fp v) { return new fp2x2(v); } 90 | 91 | /// Explicitly converts a single int value to a fp2x2 matrix by converting it to fp and assigning it to every component. 92 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 93 | public static explicit operator fp2x2(int v) { return new fp2x2(v); } 94 | 95 | /// Explicitly converts a int2x2 matrix to a fp2x2 matrix by componentwise conversion. 96 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 97 | public static explicit operator fp2x2(int2x2 v) { return new fp2x2(v); } 98 | 99 | /// Explicitly converts a single uint value to a fp2x2 matrix by converting it to fp and assigning it to every component. 100 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 101 | public static explicit operator fp2x2(uint v) { return new fp2x2(v); } 102 | 103 | /// Explicitly converts a uint2x2 matrix to a fp2x2 matrix by componentwise conversion. 104 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 105 | public static explicit operator fp2x2(uint2x2 v) { return new fp2x2(v); } 106 | 107 | 108 | /// Returns the result of a componentwise multiplication operation on two fp2x2 matrices. 109 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 110 | public static fp2x2 operator * (fp2x2 lhs, fp2x2 rhs) { return new fp2x2 (lhs.c0 * rhs.c0, lhs.c1 * rhs.c1); } 111 | 112 | /// Returns the result of a componentwise multiplication operation on a fp2x2 matrix and a fp value. 113 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 114 | public static fp2x2 operator * (fp2x2 lhs, fp rhs) { return new fp2x2 (lhs.c0 * rhs, lhs.c1 * rhs); } 115 | 116 | /// Returns the result of a componentwise multiplication operation on a fp value and a fp2x2 matrix. 117 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 118 | public static fp2x2 operator * (fp lhs, fp2x2 rhs) { return new fp2x2 (lhs * rhs.c0, lhs * rhs.c1); } 119 | 120 | 121 | /// Returns the result of a componentwise addition operation on two fp2x2 matrices. 122 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 123 | public static fp2x2 operator + (fp2x2 lhs, fp2x2 rhs) { return new fp2x2 (lhs.c0 + rhs.c0, lhs.c1 + rhs.c1); } 124 | 125 | /// Returns the result of a componentwise addition operation on a fp2x2 matrix and a fp value. 126 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 127 | public static fp2x2 operator + (fp2x2 lhs, fp rhs) { return new fp2x2 (lhs.c0 + rhs, lhs.c1 + rhs); } 128 | 129 | /// Returns the result of a componentwise addition operation on a fp value and a fp2x2 matrix. 130 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 131 | public static fp2x2 operator + (fp lhs, fp2x2 rhs) { return new fp2x2 (lhs + rhs.c0, lhs + rhs.c1); } 132 | 133 | 134 | /// Returns the result of a componentwise subtraction operation on two fp2x2 matrices. 135 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 136 | public static fp2x2 operator - (fp2x2 lhs, fp2x2 rhs) { return new fp2x2 (lhs.c0 - rhs.c0, lhs.c1 - rhs.c1); } 137 | 138 | /// Returns the result of a componentwise subtraction operation on a fp2x2 matrix and a fp value. 139 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 140 | public static fp2x2 operator - (fp2x2 lhs, fp rhs) { return new fp2x2 (lhs.c0 - rhs, lhs.c1 - rhs); } 141 | 142 | /// Returns the result of a componentwise subtraction operation on a fp value and a fp2x2 matrix. 143 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 144 | public static fp2x2 operator - (fp lhs, fp2x2 rhs) { return new fp2x2 (lhs - rhs.c0, lhs - rhs.c1); } 145 | 146 | 147 | /// Returns the result of a componentwise division operation on two fp2x2 matrices. 148 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 149 | public static fp2x2 operator / (fp2x2 lhs, fp2x2 rhs) { return new fp2x2 (lhs.c0 / rhs.c0, lhs.c1 / rhs.c1); } 150 | 151 | /// Returns the result of a componentwise division operation on a fp2x2 matrix and a fp value. 152 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 153 | public static fp2x2 operator / (fp2x2 lhs, fp rhs) { return new fp2x2 (lhs.c0 / rhs, lhs.c1 / rhs); } 154 | 155 | /// Returns the result of a componentwise division operation on a fp value and a fp2x2 matrix. 156 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 157 | public static fp2x2 operator / (fp lhs, fp2x2 rhs) { return new fp2x2 (lhs / rhs.c0, lhs / rhs.c1); } 158 | 159 | 160 | /// Returns the result of a componentwise modulus operation on two fp2x2 matrices. 161 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 162 | public static fp2x2 operator % (fp2x2 lhs, fp2x2 rhs) { return new fp2x2 (lhs.c0 % rhs.c0, lhs.c1 % rhs.c1); } 163 | 164 | /// Returns the result of a componentwise modulus operation on a fp2x2 matrix and a fp value. 165 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 166 | public static fp2x2 operator % (fp2x2 lhs, fp rhs) { return new fp2x2 (lhs.c0 % rhs, lhs.c1 % rhs); } 167 | 168 | /// Returns the result of a componentwise modulus operation on a fp value and a fp2x2 matrix. 169 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 170 | public static fp2x2 operator % (fp lhs, fp2x2 rhs) { return new fp2x2 (lhs % rhs.c0, lhs % rhs.c1); } 171 | 172 | 173 | /// Returns the result of a componentwise increment operation on a fp2x2 matrix. 174 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 175 | public static fp2x2 operator ++ (fp2x2 val) { return new fp2x2 (++val.c0, ++val.c1); } 176 | 177 | 178 | /// Returns the result of a componentwise decrement operation on a fp2x2 matrix. 179 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 180 | public static fp2x2 operator -- (fp2x2 val) { return new fp2x2 (--val.c0, --val.c1); } 181 | 182 | 183 | /// Returns the result of a componentwise less than operation on two fp2x2 matrices. 184 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 185 | public static bool2x2 operator < (fp2x2 lhs, fp2x2 rhs) { return new bool2x2 (lhs.c0 < rhs.c0, lhs.c1 < rhs.c1); } 186 | 187 | /// Returns the result of a componentwise less than operation on a fp2x2 matrix and a fp value. 188 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 189 | public static bool2x2 operator < (fp2x2 lhs, fp rhs) { return new bool2x2 (lhs.c0 < rhs, lhs.c1 < rhs); } 190 | 191 | /// Returns the result of a componentwise less than operation on a fp value and a fp2x2 matrix. 192 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 193 | public static bool2x2 operator < (fp lhs, fp2x2 rhs) { return new bool2x2 (lhs < rhs.c0, lhs < rhs.c1); } 194 | 195 | 196 | /// Returns the result of a componentwise less or equal operation on two fp2x2 matrices. 197 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 198 | public static bool2x2 operator <= (fp2x2 lhs, fp2x2 rhs) { return new bool2x2 (lhs.c0 <= rhs.c0, lhs.c1 <= rhs.c1); } 199 | 200 | /// Returns the result of a componentwise less or equal operation on a fp2x2 matrix and a fp value. 201 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 202 | public static bool2x2 operator <= (fp2x2 lhs, fp rhs) { return new bool2x2 (lhs.c0 <= rhs, lhs.c1 <= rhs); } 203 | 204 | /// Returns the result of a componentwise less or equal operation on a fp value and a fp2x2 matrix. 205 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 206 | public static bool2x2 operator <= (fp lhs, fp2x2 rhs) { return new bool2x2 (lhs <= rhs.c0, lhs <= rhs.c1); } 207 | 208 | 209 | /// Returns the result of a componentwise greater than operation on two fp2x2 matrices. 210 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 211 | public static bool2x2 operator > (fp2x2 lhs, fp2x2 rhs) { return new bool2x2 (lhs.c0 > rhs.c0, lhs.c1 > rhs.c1); } 212 | 213 | /// Returns the result of a componentwise greater than operation on a fp2x2 matrix and a fp value. 214 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 215 | public static bool2x2 operator > (fp2x2 lhs, fp rhs) { return new bool2x2 (lhs.c0 > rhs, lhs.c1 > rhs); } 216 | 217 | /// Returns the result of a componentwise greater than operation on a fp value and a fp2x2 matrix. 218 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 219 | public static bool2x2 operator > (fp lhs, fp2x2 rhs) { return new bool2x2 (lhs > rhs.c0, lhs > rhs.c1); } 220 | 221 | 222 | /// Returns the result of a componentwise greater or equal operation on two fp2x2 matrices. 223 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 224 | public static bool2x2 operator >= (fp2x2 lhs, fp2x2 rhs) { return new bool2x2 (lhs.c0 >= rhs.c0, lhs.c1 >= rhs.c1); } 225 | 226 | /// Returns the result of a componentwise greater or equal operation on a fp2x2 matrix and a fp value. 227 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 228 | public static bool2x2 operator >= (fp2x2 lhs, fp rhs) { return new bool2x2 (lhs.c0 >= rhs, lhs.c1 >= rhs); } 229 | 230 | /// Returns the result of a componentwise greater or equal operation on a fp value and a fp2x2 matrix. 231 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 232 | public static bool2x2 operator >= (fp lhs, fp2x2 rhs) { return new bool2x2 (lhs >= rhs.c0, lhs >= rhs.c1); } 233 | 234 | 235 | /// Returns the result of a componentwise unary minus operation on a fp2x2 matrix. 236 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 237 | public static fp2x2 operator - (fp2x2 val) { return new fp2x2 (-val.c0, -val.c1); } 238 | 239 | 240 | /// Returns the result of a componentwise unary plus operation on a fp2x2 matrix. 241 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 242 | public static fp2x2 operator + (fp2x2 val) { return new fp2x2 (+val.c0, +val.c1); } 243 | 244 | 245 | /// Returns the result of a componentwise equality operation on two fp2x2 matrices. 246 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 247 | public static bool2x2 operator == (fp2x2 lhs, fp2x2 rhs) { return new bool2x2 (lhs.c0 == rhs.c0, lhs.c1 == rhs.c1); } 248 | 249 | /// Returns the result of a componentwise equality operation on a fp2x2 matrix and a fp value. 250 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 251 | public static bool2x2 operator == (fp2x2 lhs, fp rhs) { return new bool2x2 (lhs.c0 == rhs, lhs.c1 == rhs); } 252 | 253 | /// Returns the result of a componentwise equality operation on a fp value and a fp2x2 matrix. 254 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 255 | public static bool2x2 operator == (fp lhs, fp2x2 rhs) { return new bool2x2 (lhs == rhs.c0, lhs == rhs.c1); } 256 | 257 | 258 | /// Returns the result of a componentwise not equal operation on two fp2x2 matrices. 259 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 260 | public static bool2x2 operator != (fp2x2 lhs, fp2x2 rhs) { return new bool2x2 (lhs.c0 != rhs.c0, lhs.c1 != rhs.c1); } 261 | 262 | /// Returns the result of a componentwise not equal operation on a fp2x2 matrix and a fp value. 263 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 264 | public static bool2x2 operator != (fp2x2 lhs, fp rhs) { return new bool2x2 (lhs.c0 != rhs, lhs.c1 != rhs); } 265 | 266 | /// Returns the result of a componentwise not equal operation on a fp value and a fp2x2 matrix. 267 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 268 | public static bool2x2 operator != (fp lhs, fp2x2 rhs) { return new bool2x2 (lhs != rhs.c0, lhs != rhs.c1); } 269 | 270 | 271 | 272 | /// Returns the fp2 element at a specified index. 273 | unsafe public ref fp2 this[int index] 274 | { 275 | get 276 | { 277 | #if ENABLE_UNITY_COLLECTIONS_CHECKS 278 | if ((uint)index >= 2) 279 | throw new System.ArgumentException("index must be between[0...1]"); 280 | #endif 281 | fixed (fp2x2* array = &this) { return ref ((fp2*)array)[index]; } 282 | } 283 | } 284 | 285 | /// Returns true if the fp2x2 is equal to a given fp2x2, false otherwise. 286 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 287 | public bool Equals(fp2x2 rhs) { return c0.Equals(rhs.c0) && c1.Equals(rhs.c1); } 288 | 289 | /// Returns true if the fp2x2 is equal to a given fp2x2, false otherwise. 290 | public override bool Equals(object o) { return Equals((fp2x2)o); } 291 | 292 | 293 | /// Returns a hash code for the fp2x2. 294 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 295 | public override int GetHashCode() { return (int)fpmath.hash(this); } 296 | 297 | 298 | /// Returns a string representation of the fp2x2. 299 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 300 | public override string ToString() 301 | { 302 | return string.Format("fp2x2({0}, {1}, {2}, {3})", c0.x, c1.x, c0.y, c1.y); 303 | } 304 | 305 | /// Returns a string representation of the fp2x2 using a specified format and culture-specific format information. 306 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 307 | public string ToString(string format, IFormatProvider formatProvider) 308 | { 309 | return string.Format("fp2x2({0}, {1}, {2}, {3})", c0.x.ToString(format, formatProvider), c1.x.ToString(format, formatProvider), c0.y.ToString(format, formatProvider), c1.y.ToString(format, formatProvider)); 310 | } 311 | 312 | } 313 | 314 | public static partial class fpmath 315 | { 316 | /// Returns a fp2x2 matrix constructed from two fp2 vectors. 317 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 318 | public static fp2x2 fp2x2(fp2 c0, fp2 c1) { return new fp2x2(c0, c1); } 319 | 320 | /// Returns a fp2x2 matrix constructed from from 4 fp values given in row-major order. 321 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 322 | public static fp2x2 fp2x2(fp m00, fp m01, 323 | fp m10, fp m11) 324 | { 325 | return new fp2x2(m00, m01, 326 | m10, m11); 327 | } 328 | 329 | /// Returns a fp2x2 matrix constructed from a single fp value by assigning it to every component. 330 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 331 | public static fp2x2 fp2x2(fp v) { return new fp2x2(v); } 332 | 333 | /// Returns a fp2x2 matrix constructed from a single int value by converting it to fp and assigning it to every component. 334 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 335 | public static fp2x2 fp2x2(int v) { return new fp2x2(v); } 336 | 337 | /// Return a fp2x2 matrix constructed from a int2x2 matrix by componentwise conversion. 338 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 339 | public static fp2x2 fp2x2(int2x2 v) { return new fp2x2(v); } 340 | 341 | /// Returns a fp2x2 matrix constructed from a single uint value by converting it to fp and assigning it to every component. 342 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 343 | public static fp2x2 fp2x2(uint v) { return new fp2x2(v); } 344 | 345 | /// Return a fp2x2 matrix constructed from a uint2x2 matrix by componentwise conversion. 346 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 347 | public static fp2x2 fp2x2(uint2x2 v) { return new fp2x2(v); } 348 | 349 | /// Return the fp2x2 transpose of a fp2x2 matrix. 350 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 351 | public static fp2x2 transpose(fp2x2 v) 352 | { 353 | return fp2x2( 354 | v.c0.x, v.c0.y, 355 | v.c1.x, v.c1.y); 356 | } 357 | 358 | /// Returns a uint hash code of a fp2x2 vector. 359 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 360 | public static uint hash(fp2x2 v) 361 | { 362 | return math.csum(fpmath.asuint(v.c0) * uint2(0x90A285BBu, 0x5D19E1D5u) + 363 | fpmath.asuint(v.c1) * uint2(0xFAAF07DDu, 0x625C45BDu)) + 0xC9F27FCBu; 364 | } 365 | 366 | /// 367 | /// Returns a uint2 vector hash code of a fp2x2 vector. 368 | /// When multiple elements are to be hashes together, it can more efficient to calculate and combine wide hash 369 | /// that are only reduced to a narrow uint hash at the very end instead of at every step. 370 | /// 371 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 372 | public static uint2 hashwide(fp2x2 v) 373 | { 374 | return (fpmath.asuint(v.c0) * uint2(0x6D2523B1u, 0x6E2BF6A9u) + 375 | fpmath.asuint(v.c1) * uint2(0xCC74B3B7u, 0x83B58237u)) + 0x833E3E29u; 376 | } 377 | 378 | } 379 | } 380 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint/fp2x2.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 262ceb2ff3dfc0e4191d35dd242f024a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint/fp2x3.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 791057f9671b4704cb3e40b204cf528c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint/fp2x4.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7435e5a80cd74b3488110c613a78c651 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint/fp3.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9740a4c321cc7be4e9b1d6383d68e611 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint/fp3x2.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a642216444d593f43a59854b8faa7883 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint/fp3x3.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e66dda6068a22294eb55752d24404ea0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint/fp3x4.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 25cff10cf9a650e49bb2b34ed85f7a77 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint/fp4.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f739cfc93caf41646809ea9ee9dc21dc 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint/fp4x2.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 909478bba29fffb458a02af7f2b0ea17 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint/fp4x3.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 43e57056758cbfa45a3cb42bf93912b8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint/fp4x4.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5e9ee19267dcae8468f466dd279ef9b4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint/fpmath.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 28c7af74c1b1817419d0f52bbcfde3b8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Unity.Mathematics.FixedPoint/matrix.gen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c72c3edf812883a43ad53ec006604212 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.danielmansson.mathematics.fixedpoint", 3 | "displayName": "Mathematics.FixedPoint", 4 | "version": "0.1.0", 5 | "unity": "2019.3", 6 | "description": "Fixed-point extension of Unity's C# math library based on FixedMath.Net and Unity.Mathematics.", 7 | "keywords": [ 8 | "fixedpoint", 9 | "math" 10 | ], 11 | "dependencies": { 12 | "com.unity.mathematics": "1.1.0" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "https://github.com/danielmansson/Unity.Mathematics.FixedPoint", 17 | "revision": "" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 59dba78eda4dc3147836c301f2c5f660 3 | PackageManifestImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Unity.Mathematics.FixedPoint 2 | 3 | A Fixed-point extension of Unity's C# math library based on [FixedMath.Net](https://github.com/asik/FixedMath.Net) and [Unity.Mathematics](https://github.com/Unity-Technologies/Unity.Mathematics). One of the main reasons for using this library instead of the built-in one is support for cross-platform determinism, until Unity officially supports it with Burst/DOTS. 4 | 5 | The intention is to keep the API as close as possible to Unity.Mathematics. This should make it easy to convert your project to use floating point math if needed. 6 | 7 | ## Usage 8 | 9 | You can use this library in your Unity game by adding this repository to the package manifest file in your Unity project. `PROJECT_ROOT/Packages/manifest.json`: 10 | 11 | ```json 12 | { 13 | "dependencies": { 14 | "com.danielmansson.mathematics.fixedpoint": "https://github.com/danielmansson/Unity.Mathematics.FixedPoint.git" 15 | } 16 | } 17 | ``` 18 | 19 | ## Testing and developing 20 | 21 | The easiest way to iterate on this package is to clone this repository and [the test project](https://github.com/danielmansson/Unity.Mathematics.FixedPoint.TestProject) side-by-side and open the test project in Unity. This resolves the required dependencies (Unity.Mathematics) and makes the test runner available. 22 | 23 | ## Example project 24 | 25 | A simple example project can be found [here](https://github.com/danielmansson/Unity.Mathematics.FixedPoint.Example). It contains two side-by-side simulations, one using a floating point implementation and the other using fixed point. 26 | 27 | ## Missing features 28 | 29 | Unity.Mathematics.FixedPoint is not feature complete yet. This is missing: 30 | 31 | - quaternion 32 | - fpmath.tanh 33 | - fpmath.cosh 34 | - fpmath.sinh 35 | - fpmath.exp 36 | - fpmath.log10 37 | 38 | Method stubs are added to match the API, but they are marked as obsolete with a compile error. 39 | 40 | ## Maintaining changes from Unity.Mathematics 41 | 42 | Unity.Mathematics is using code generation to create their vector and matrix types. Most of the changes in this repository from Unity.Mathematics has been in `VectorGenerator.cs` and `fpmath.cs`. 43 | 44 | The plan is to keep this repository almost up to date with Unity.Mathematics, so changes has been isolated as much as possible. However, `VectorGenerator.cs` was not made with external extensibility in mind. When there are internal changes to Unity.Mathematics in upcoming versions, this will require manual patching. 45 | 46 | `fpmath.cs` contains the common fixed point math operations. The implementations are based on the floating point methods in Unity.Mathematics `math.cs`. 47 | 48 | ## Precision 49 | 50 | More tests are needed to verify the precision of all fixed point operations. There might be intermediate calculations unsuitable for fixed point in the current implementation. 51 | 52 | ## Licensing 53 | 54 | This project is licensed under the MIT License ([LICENSE.md](LICENSE.md)) 55 | 56 | Unity.Mathematics ([Unity Companion License](https://github.com/Unity-Technologies/Unity.Mathematics/blob/master/LICENSE.md)) 57 | 58 | FixedMath.Net ([Apache License, Version 2.0](Unity.Mathematics.FixedPoint/fp/LICENSE.txt)) 59 | 60 | -------------------------------------------------------------------------------- /readme.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3b01e2d84dcf86b45a8a758ddbd96d05 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | --------------------------------------------------------------------------------