Commit Graph

592 Commits

Author SHA1 Message Date
Oliver Booth 8a4e053c85
fix: expose internals to X10D.Tests project 2023-04-01 22:12:16 +01:00
Oliver Booth d29663f081
style: cleanup DictionaryExtensions
* Explicit type is used where type is not evident.
* Conditions are inlined with a ternary and the return value is used directly.
* System.Runtime.InteropServices is only imported for .NET >= 6.0
2023-04-01 22:05:10 +01:00
Oliver Booth b79435211a
style: remove redundant else branches 2023-04-01 22:01:07 +01:00
Oliver Booth 87b6dbdd56
test: bring coverage to 100% for integer Unpack (#70) 2023-04-01 21:56:45 +01:00
Oliver Booth 5f21a2102d
feat: pack README.md in nupkg 2023-04-01 21:16:57 +01:00
Oliver Booth e52e9096e0
feat: expose ComplexSqrt to all frameworks 2023-04-01 18:54:04 +01:00
Oliver Booth 5714ef73c1
test: 100% coverage on stream Read/Write methods 2023-04-01 18:17:50 +01:00
Oliver Booth fa2236e72a
fix: write float, not double, in Stream.WriteSingle
This was a side effect of 2815c505c3 since I had copy/pasted the blocks. Oops.
2023-04-01 17:14:46 +01:00
Oliver Booth 990f860b39
perf: accept ReadOnlySpan<byte> in WriteInternal
This method does not mutate the input span in any way, and so its input can be read-only.
2023-04-01 17:11:47 +01:00
Oliver Booth 2815c505c3
fix: fix incorrect float/double being written for netstandard2.1
The call to _To_Bits yields the result containing the same bytes, but not the same value. This value was then stored as-is into the parameter, which causes a conversion on how the value is stored, ultimately causing the wrong value to be written to the stream.
2023-04-01 17:11:05 +01:00
Oliver Booth 677259b91c
fix: fixed Stream.ReadSingle returning wrong type
ReadSingle previously returned a double, and this never failed unit tests since float -> double is a widening conversion, with values being comparable.
2023-04-01 17:08:34 +01:00
Oliver Booth 39c8c7defb
style: cluster throw helpers together to reduce branch repetition 2023-04-01 14:37:37 +01:00
Oliver Booth 431e72a4c1
fix: use ArgumentNullException throw helper for .NET >=6
Some of these directives were incorrectly written as #if NET6_0, when ThrowIfNull is available in all future versions too. The macro has been fixed to #if NET6_0_OR_GREATER.

For other methods, the branch has been introduced where it didn't exist before.
2023-04-01 14:35:00 +01:00
Oliver Booth 78f2c13a1b
style: update branding
The icon is now exported from vector artboards rather than a raster.
2023-03-31 22:22:52 +01:00
Oliver Booth ec266063f9
fix(DoS): specify timeout in Regex ctor
This isn't actually a "fix", the method may be slow by design if the source is lazily enumerated. SonarCloud, however, did not like this method not having an explicit timeout. If SonarCloud continues to complain, we'll just shut its mouth masking tape and throw it in the broom closet.
2023-03-31 21:29:29 +01:00
Oliver Booth e70781ef0f
perf: remove redundant 6k ± 1 check in IsPrime
No integers >3 satisfy the condition of being odd AND not being a multiple of 3 (as checked above) AND not being in the form 6k ± 1. This condition never evaluates to true, and so the return is never reached and was preventing this method from hitting 100% code coverage.
2023-03-31 21:25:17 +01:00
Oliver Booth c8ccb1deb8
perf: remove redundant 0 check in Sqrt
This check was a defensive manoeuvrer in the event that the input is 0, but this condition has already been verified to be false with the switch guard clause.

This changes bumps coverage to 100% for Sqrt.
2023-03-31 20:40:06 +01:00
Oliver Booth 626f1e931c
style: use explicit type for Vector128<byte> 2023-03-31 20:18:22 +01:00
Oliver Booth f293f247e7
[ci skip] style: remove unused using directives 2023-03-31 20:18:01 +01:00
Oliver Booth 09d3c311d9
test: exclude "packing magic" properties from coverage 2023-03-31 20:17:27 +01:00
Oliver Booth 4152c289e3
[ci skip] style: restrict scope of pragma suppression 2023-03-31 20:16:57 +01:00
Oliver Booth 3734965757
test: bring coverage to 94% for RuneExtensions 2023-03-31 20:11:03 +01:00
Oliver Booth 275d98fbf8
feat: add LowestCommonMultiple for built-in integer types
This was previously incorrectly documented in CHANGELOG.md. The method now exists. Sorry about that
2023-03-31 18:07:50 +01:00
Oliver Booth 9ee99d72d3
[ci skip] style: upgrade projects to C# 11
NB: While using a higher C# version with lower framework version is possible, it's generally advised against because C# syntax may map to .NET types not available in older versions such as .NET Standard 2.1.

This change does not invite the codebase to upgrade to newer types, but rather take advantage of syntax sugar (such as file-scoped namespaces, when this project was updated to C# 10) that does not effect the compiled result.

However, this change does open up the possibilities to add extension methods for the "generic math" interfaces (made possible by static interface members), and these upcoming methods will be targeted to .NET 7 or greater **ONLY**.
2023-03-31 17:30:30 +01:00
Oliver Booth 38112f07ac
[ci skip] style: remove trailing whitespace 2023-03-31 15:10:51 +01:00
Oliver Booth d56d12ca23
perf: lazily yield additional value
This prevents an allocation of the array, saving approximately half. Initial benchmarks also show this implementation to be ~100ns faster
2023-03-31 15:07:08 +01:00
Oliver Booth 14e638e6d9
feat: add IEnumerable<T>.ConcatOne 2023-03-31 14:53:02 +01:00
Oliver Booth 33c5361c0b
fix/perf: return zero vector for identity quaternion 2023-03-31 01:33:38 +01:00
Oliver Booth cd4c3542f7
fix: use intrinsic convention for ToVector3 2023-03-31 01:31:19 +01:00
Oliver Booth 02947944cd
fix: accept ReadOnlySpan not Span for search needle 2023-03-30 21:23:46 +01:00
Oliver Booth f360311d9c
perf: exit early if TryGetNonEnumeratedCount is 0 2023-03-30 20:56:34 +01:00
Oliver Booth 006523d342
[ci skip] perf: convert Count to for loop with index access 2023-03-30 20:21:29 +01:00
Oliver Booth 3ce8d281b7
feat: add TextReader.EnumerateLines/Async 2023-03-30 17:55:41 +01:00
Oliver Booth 12d2e10be4
[ci skip] docs: mention ArgumentNullException for Grep 2023-03-30 17:43:56 +01:00
Oliver Booth d0f94a6493
feat: add IEnumerable<string>.Grep() 2023-03-30 17:29:54 +01:00
Oliver Booth f49188b428
feat: add string.EnsureEndsWith and string.EnsureStartsWith 2023-03-30 02:09:04 +01:00
Oliver Booth 4dd31ec1b6
[ci skip] style: reformat & cleanup solution 2023-03-29 17:46:56 +01:00
Oliver Booth 436f56d912
feat: add Saturate for floating point types (#60) 2023-03-29 16:21:16 +01:00
Oliver Booth e0bdaaddce
style/perf: reduce complexity of MinMax and MinMaxBy 2023-03-28 16:28:59 +01:00
Oliver Booth 3bc2ae45c7
style: remove unused using directive 2023-03-28 15:44:48 +01:00
Oliver Booth e3dcad5690
build(nupkg): use MSBuildProjectDirectory and go up 1 level
SolutionDir macro is returning empty/null in workflow, causing a job failure since CHANGELOG.md is not in root.

this may or may not fix the workflow. tba
2023-03-28 15:11:09 +01:00
Oliver Booth 2cb6567410
build(nupkg): add PackageReleaseNotes to csproj 2023-03-28 14:27:15 +01:00
Oliver Booth 3b85419da3
Add MinMax and MinMaxBy (resolves #72) 2023-03-26 17:03:40 +01:00
Oliver Booth e00a673a04
i is for I will scream at these changes 2023-03-23 15:11:44 +00:00
Oliver Booth ea26b5a7e1
Use explicit type where non-evident in SpanExtensions 2023-03-23 15:11:15 +00:00
Oliver Booth 136382a2a3
[ci skip] Revert 167a55e2db
Code analysis can suck an egg. We needed this actually
2023-03-23 15:07:09 +00:00
Oliver Booth 167a55e2db
[ci skip] Remove redundant unsafe method modifiers 2023-03-23 15:06:01 +00:00
Oliver Booth cb80d19451
[ci skip] Fix xmldoc for SpanExtensions.Contains 2023-03-23 15:02:57 +00:00
RealityProgrammer 44165b310d Move exception message to the right resource resx 2023-03-14 22:03:21 +07:00
RealityProgrammer 0bf4d7ba77 Again, fix source validator reports 2023-03-14 21:41:35 +07:00