diff --git a/.swiftlint.yml b/.swiftlint.yml index 69154fe..b6ff137 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -6,7 +6,6 @@ disabled_rules: - type_name opt_in_rules: - - anyobject_protocol - array_init - closure_end_indentation - closure_spacing @@ -21,7 +20,6 @@ opt_in_rules: - first_where - force_unwrapping - function_default_parameter_at_end - - inert_defer - no_extension_access_modifier - overridden_super_call - prohibited_super_call diff --git a/Half.podspec b/Half.podspec index 530e1c5..2ef36a5 100644 --- a/Half.podspec +++ b/Half.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "Half" - s.version = "1.4.0" + s.version = "1.4.1" s.summary = "Swift Half-Precision Floating Point" s.description = <<-DESC A lightweight framework containing a Swift implementation for a half-precision floating point type for iOS, macOS, tvOS, and watchOS. diff --git a/LICENSE b/LICENSE index 3210ca0..2b07f29 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2022 Joe Newton +Copyright (c) 2023 Joe Newton Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Sources/CHalf/include/half.h b/Sources/CHalf/include/half.h index db3d641..1bfcb01 100644 --- a/Sources/CHalf/include/half.h +++ b/Sources/CHalf/include/half.h @@ -2,7 +2,7 @@ // half.h // Half // -// Copyright © 2022 SomeRandomiOSDev. All rights reserved. +// Copyright © 2023 SomeRandomiOSDev. All rights reserved. // #ifndef half_h diff --git a/Sources/CHalf/src/half.c b/Sources/CHalf/src/half.c index 12d752a..def8ac4 100644 --- a/Sources/CHalf/src/half.c +++ b/Sources/CHalf/src/half.c @@ -2,7 +2,7 @@ // half.c // Half // -// Copyright © 2022 SomeRandomiOSDev. All rights reserved. +// Copyright © 2023 SomeRandomiOSDev. All rights reserved. // #include "half.h" @@ -63,7 +63,7 @@ HALF_FUNC half_t _half_mul(const half_t lhs, const half_t rhs) { return HALF_FRO HALF_FUNC half_t _half_div(const half_t lhs, const half_t rhs) { return HALF_FROM_FP16(FP16_FROM_HALF(lhs) / FP16_FROM_HALF(rhs)); } HALF_FUNC half_t _half_fma(const half_t val, const half_t lhs, const half_t rhs) { return HALF_FROM_FP16(FP16_FROM_HALF(val) + (FP16_FROM_HALF(lhs) * FP16_FROM_HALF(rhs))); } -HALF_FUNC half_t _half_neg(const half_t val) { return HALF_FROM_FP16(0.0 - FP16_FROM_HALF(val)); } +HALF_FUNC half_t _half_neg(const half_t val) { return HALF_FROM_RAW(RAW_FROM_HALF(val) ^ 0x8000); } // flip the sign bit HALF_FUNC half_t _half_abs(const half_t val) { return HALF_FROM_RAW(RAW_FROM_HALF(val) & 0x7FFF); } // clear sign bit HALF_FUNC half_t _half_sqrt(const half_t val) { return _half_from(sqrt((float)FP16_FROM_HALF(val))); } diff --git a/Sources/Half/Functions.swift b/Sources/Half/Functions.swift index a073c4d..70250f4 100644 --- a/Sources/Half/Functions.swift +++ b/Sources/Half/Functions.swift @@ -2,7 +2,7 @@ // Functions.swift // Half // -// Copyright © 2022 SomeRandomiOSDev. All rights reserved. +// Copyright © 2023 SomeRandomiOSDev. All rights reserved. // #if os(Linux) diff --git a/Sources/Half/Half+Coding.swift b/Sources/Half/Half+Coding.swift index 8d8e260..9eaff51 100644 --- a/Sources/Half/Half+Coding.swift +++ b/Sources/Half/Half+Coding.swift @@ -2,7 +2,7 @@ // Half+Coding.swift // Half // -// Copyright © 2022 SomeRandomiOSDev. All rights reserved. +// Copyright © 2023 SomeRandomiOSDev. All rights reserved. // // MARK: - Codable Protocol Conformance diff --git a/Sources/Half/Half.docc/Floating-Point-Operators-for-Half.md b/Sources/Half/Half.docc/Floating-Point-Operators-for-Half.md index c80bc8c..fb523c2 100644 --- a/Sources/Half/Half.docc/Floating-Point-Operators-for-Half.md +++ b/Sources/Half/Half.docc/Floating-Point-Operators-for-Half.md @@ -6,36 +6,36 @@ Perform arithmetic and bitwise operations or compare values. ### Arithmetic -- ``Half/Half/+(_:_:)`` -- ``Half/Half/-(_:_:)`` -- ``Half/Half/*(_:_:)`` -- ``Half/Half//(_:_:)`` +- ``Half-swift.struct/+(_:_:)`` +- ``Half-swift.struct/-(_:_:)`` +- ``Half-swift.struct/*(_:_:)`` +- ### Arithmetic with Assignment -- ``Half/Half/+=(_:_:)-75r0k`` -- ``Half/Half/-=(_:_:)-9q37z`` -- ``Half/Half/*=(_:_:)`` -- ``Half/Half//=(_:_:)`` +- ``Half-swift.struct/+=(_:_:)-75r0k`` +- ``Half-swift.struct/-=(_:_:)`` +- ``Half-swift.struct/*=(_:_:)`` +- ### Comparison -- ``Half/Half/==(_:_:)-5s308`` -- ``Half/Half/!=(_:_:)`` -- ``Half/Half/_(_:_:)-6mxe4`` -- ``Half/Half/_=(_:_:)-8rfdq`` -- ``Half/Half/_(_:_:)-6lwhi`` -- ``Half/Half/_=(_:_:)-6vpuz`` +- ``Half-swift.struct/==(_:_:)-5s308`` +- ``Half-swift.struct/!=(_:_:)`` +- ``Half-swift.struct/<(_:_:)-6mxe4`` +- ``Half-swift.struct/<=(_:_:)-8rfdq`` +- ``Half-swift.struct/>(_:_:)-6lwhi`` +- ``Half-swift.struct/>=(_:_:)-6vpuz`` ### Negation -- ``Half/Half/-(_:)-7binx`` -- ``Half/Half/+(_:)`` +- ``Half-swift.struct/-(_:)`` +- ``Half-swift.struct/+(_:)`` ### Range Expressions -- ``Half/Half/.._(_:)`` -- ``Half/Half/...(_:)-1tjn1`` -- ``Half/Half/...(_:)-4kfvw`` +- ``Half-swift.struct/..<(_:)`` +- ``Half-swift.struct/...(_:)-1tjn1`` +- ``Half-swift.struct/...(_:)-4kfvw`` - + diff --git a/Sources/Half/Half.docc/Half-swift.struct.md b/Sources/Half/Half.docc/Half-swift.struct.md index eea9185..3031343 100644 --- a/Sources/Half/Half.docc/Half-swift.struct.md +++ b/Sources/Half/Half.docc/Half-swift.struct.md @@ -127,7 +127,7 @@ These initializers result in `nil` if the value passed can't be represented with ### Creating a Range -- ``.._(_:_:)`` +- ``..<(_:_:)`` - ``...(_:_:)`` ### Describing a Half @@ -147,4 +147,4 @@ These initializers result in `nil` if the value passed can't be represented with - ``write(to:)`` - ``hashValue`` - + diff --git a/Sources/Half/Half.docc/Half.md b/Sources/Half/Half.docc/Half.md index bbde8dc..b56c132 100644 --- a/Sources/Half/Half.docc/Half.md +++ b/Sources/Half/Half.docc/Half.md @@ -12,4 +12,4 @@ Swift Half-Precision Floating Point - - + diff --git a/Sources/Half/Half.docc/Standard-Library-Functions.md b/Sources/Half/Half.docc/Standard-Library-Functions.md index c3c649e..c16609f 100644 --- a/Sources/Half/Half.docc/Standard-Library-Functions.md +++ b/Sources/Half/Half.docc/Standard-Library-Functions.md @@ -43,4 +43,4 @@ Functions provided by this library with custom implementations for the ``Half/Ha - ``tanh(_:)`` - ``tgamma(_:)`` - + diff --git a/Sources/Half/Half.docc/half_t.md b/Sources/Half/Half.docc/half_t.md index fa6b131..5f710df 100644 --- a/Sources/Half/Half.docc/half_t.md +++ b/Sources/Half/Half.docc/half_t.md @@ -2,4 +2,4 @@ A C structure for representing the low-level structure used for a half-precision floating-point value. - + diff --git a/Sources/Half/Half.swift b/Sources/Half/Half.swift index 7ffe63c..948ce82 100644 --- a/Sources/Half/Half.swift +++ b/Sources/Half/Half.swift @@ -2,7 +2,7 @@ // Half.swift // Half // -// Copyright © 2022 SomeRandomiOSDev. All rights reserved. +// Copyright © 2023 SomeRandomiOSDev. All rights reserved. // #if SWIFT_PACKAGE diff --git a/Tests/CHalfTests/CHalfTests.swift b/Tests/CHalfTests/CHalfTests.swift index 2282416..d6496e6 100644 --- a/Tests/CHalfTests/CHalfTests.swift +++ b/Tests/CHalfTests/CHalfTests.swift @@ -2,7 +2,7 @@ // CHalfTests.swift // Half // -// Copyright © 2022 SomeRandomiOSDev. All rights reserved. +// Copyright © 2023 SomeRandomiOSDev. All rights reserved. // #if SWIFT_PACKAGE diff --git a/Tests/HalfTests/FunctionsTests.swift b/Tests/HalfTests/FunctionsTests.swift index db7fb1f..abd50d3 100644 --- a/Tests/HalfTests/FunctionsTests.swift +++ b/Tests/HalfTests/FunctionsTests.swift @@ -2,7 +2,7 @@ // FunctionsTests.swift // Half // -// Copyright © 2022 SomeRandomiOSDev. All rights reserved. +// Copyright © 2023 SomeRandomiOSDev. All rights reserved. // @testable import Half diff --git a/Tests/HalfTests/Half+CodingTests.swift b/Tests/HalfTests/Half+CodingTests.swift index fe9ad36..d597931 100644 --- a/Tests/HalfTests/Half+CodingTests.swift +++ b/Tests/HalfTests/Half+CodingTests.swift @@ -2,7 +2,7 @@ // Half+CodingTests.swift // Half // -// Copyright © 2022 SomeRandomiOSDev. All rights reserved. +// Copyright © 2023 SomeRandomiOSDev. All rights reserved. // @testable import Half @@ -153,3 +153,5 @@ class HalfCodingTests: XCTestCase { } } } + +// swiftlint:enable function_body_length diff --git a/Tests/HalfTests/HalfTests.swift b/Tests/HalfTests/HalfTests.swift index dd8cca9..13c6d78 100644 --- a/Tests/HalfTests/HalfTests.swift +++ b/Tests/HalfTests/HalfTests.swift @@ -2,7 +2,7 @@ // HalfTests.swift // HalfTests // -// Copyright © 2022 SomeRandomiOSDev. All rights reserved. +// Copyright © 2023 SomeRandomiOSDev. All rights reserved. // @testable import Half @@ -503,3 +503,5 @@ extension HalfTests: TextOutputStream { XCTAssertEqual(string, "2.5") } } + +// swiftlint:enable function_body_length diff --git a/scripts/carthage.sh b/scripts/carthage.sh index 9e9811c..2063ec0 100755 --- a/scripts/carthage.sh +++ b/scripts/carthage.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # # carthage.sh -# Copyright © 2022 SomeRandomiOSDev. All rights reserved. +# Copyright © 2023 SomeRandomiOSDev. All rights reserved. # # Usage example: ./carthage.sh build --platform iOS # diff --git a/scripts/findproject.sh b/scripts/findproject.sh index 782a48c..0cc4df4 100755 --- a/scripts/findproject.sh +++ b/scripts/findproject.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # # findproject.sh -# Copyright © 2022 SomeRandomiOSDev. All rights reserved. +# Copyright © 2023 SomeRandomiOSDev. All rights reserved. # # Usage example: ./findproject.sh --project-name diff --git a/scripts/printformat.sh b/scripts/printformat.sh index f8c201e..445c99f 100755 --- a/scripts/printformat.sh +++ b/scripts/printformat.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # # printformat.sh -# Copyright © 2022 SomeRandomiOSDev. All rights reserved. +# Copyright © 2023 SomeRandomiOSDev. All rights reserved. # # Usage example: ./formatstring.sh "forground:red;bold" "Hello, World" # diff --git a/scripts/resolvepath.sh b/scripts/resolvepath.sh index 36630fc..ce33477 100755 --- a/scripts/resolvepath.sh +++ b/scripts/resolvepath.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # # resolvepath.sh -# Copyright © 2022 SomeRandomiOSDev. All rights reserved. +# Copyright © 2023 SomeRandomiOSDev. All rights reserved. # # Usage example: ./resolvepath.sh "./some/random/path/../../" diff --git a/scripts/versions.sh b/scripts/versions.sh index 8892134..94ab473 100755 --- a/scripts/versions.sh +++ b/scripts/versions.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # # versions.sh -# Copyright © 2022 SomeRandomiOSDev. All rights reserved. +# Copyright © 2023 SomeRandomiOSDev. All rights reserved. # # Usage example: ./versions.sh "1.4.15" "1.7.0" diff --git a/scripts/workflowtests.sh b/scripts/workflowtests.sh index 4892f57..9321762 100755 --- a/scripts/workflowtests.sh +++ b/scripts/workflowtests.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # # workflowtests.sh -# Copyright © 2022 SomeRandomiOSDev. All rights reserved. +# Copyright © 2023 SomeRandomiOSDev. All rights reserved. # # Usage example: ./workflowtests.sh --no-clean diff --git a/scripts/xcframework.sh b/scripts/xcframework.sh index 921d08d..1a037b1 100755 --- a/scripts/xcframework.sh +++ b/scripts/xcframework.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # # xcframework.sh -# Copyright © 2022 SomeRandomiOSDev. All rights reserved. +# Copyright © 2023 SomeRandomiOSDev. All rights reserved. # # Usage example: ./xcframework.sh --output /.xcframework