Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed negation issue #17

Merged
merged 2 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ disabled_rules:
- type_name

opt_in_rules:
- anyobject_protocol
- array_init
- closure_end_indentation
- closure_spacing
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Half.podspec
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2022 Joe Newton <somerandomiosdev@gmail.com>
Copyright (c) 2023 Joe Newton <somerandomiosdev@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion Sources/CHalf/include/half.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// half.h
// Half
//
// Copyright © 2022 SomeRandomiOSDev. All rights reserved.
// Copyright © 2023 SomeRandomiOSDev. All rights reserved.
//

#ifndef half_h
Expand Down
4 changes: 2 additions & 2 deletions Sources/CHalf/src/half.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// half.c
// Half
//
// Copyright © 2022 SomeRandomiOSDev. All rights reserved.
// Copyright © 2023 SomeRandomiOSDev. All rights reserved.
//

#include "half.h"
Expand Down Expand Up @@ -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))); }

Expand Down
2 changes: 1 addition & 1 deletion Sources/Half/Functions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Functions.swift
// Half
//
// Copyright © 2022 SomeRandomiOSDev. All rights reserved.
// Copyright © 2023 SomeRandomiOSDev. All rights reserved.
//

#if os(Linux)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Half/Half+Coding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Half+Coding.swift
// Half
//
// Copyright © 2022 SomeRandomiOSDev. All rights reserved.
// Copyright © 2023 SomeRandomiOSDev. All rights reserved.
//

// MARK: - Codable Protocol Conformance
Expand Down
40 changes: 20 additions & 20 deletions Sources/Half/Half.docc/Floating-Point-Operators-for-Half.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/*(_:_:)``
- <doc://com.somerandomiosdev.half/documentation/Half/Half//(_:_:)>

### Arithmetic with Assignment

- ``Half/Half/+=(_:_:)-75r0k``
- ``Half/Half/-=(_:_:)-9q37z``
- ``Half/Half/*=(_:_:)``
- ``Half/Half//=(_:_:)``
- ``Half-swift.struct/+=(_:_:)-75r0k``
- ``Half-swift.struct/-=(_:_:)``
- ``Half-swift.struct/*=(_:_:)``
- <doc://com.somerandomiosdev.half/documentation/Half/Half//=(_:_:)>

### 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``

<!-- Copyright (c) 2022 SomeRandomiOSDev. All Rights Reserved. -->
<!-- Copyright (c) 2023 SomeRandomiOSDev. All Rights Reserved. -->
4 changes: 2 additions & 2 deletions Sources/Half/Half.docc/Half-swift.struct.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ These initializers result in `nil` if the value passed can't be represented with

### Creating a Range

- ``.._(_:_:)``
- ``..<(_:_:)``
- ``...(_:_:)``

### Describing a Half
Expand All @@ -147,4 +147,4 @@ These initializers result in `nil` if the value passed can't be represented with
- ``write(to:)``
- ``hashValue``

<!-- Copyright (c) 2022 SomeRandomiOSDev. All Rights Reserved. -->
<!-- Copyright (c) 2023 SomeRandomiOSDev. All Rights Reserved. -->
2 changes: 1 addition & 1 deletion Sources/Half/Half.docc/Half.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ Swift Half-Precision Floating Point

- <doc:Standard-Library-Functions>

<!-- Copyright (c) 2022 SomeRandomiOSDev. All Rights Reserved. -->
<!-- Copyright (c) 2023 SomeRandomiOSDev. All Rights Reserved. -->
2 changes: 1 addition & 1 deletion Sources/Half/Half.docc/Standard-Library-Functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ Functions provided by this library with custom implementations for the ``Half/Ha
- ``tanh(_:)``
- ``tgamma(_:)``

<!-- Copyright (c) 2022 SomeRandomiOSDev. All Rights Reserved. -->
<!-- Copyright (c) 2023 SomeRandomiOSDev. All Rights Reserved. -->
2 changes: 1 addition & 1 deletion Sources/Half/Half.docc/half_t.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

A C structure for representing the low-level structure used for a half-precision floating-point value.

<!-- Copyright (c) 2022 SomeRandomiOSDev. All Rights Reserved. -->
<!-- Copyright (c) 2023 SomeRandomiOSDev. All Rights Reserved. -->
2 changes: 1 addition & 1 deletion Sources/Half/Half.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Half.swift
// Half
//
// Copyright © 2022 SomeRandomiOSDev. All rights reserved.
// Copyright © 2023 SomeRandomiOSDev. All rights reserved.
//

#if SWIFT_PACKAGE
Expand Down
2 changes: 1 addition & 1 deletion Tests/CHalfTests/CHalfTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// CHalfTests.swift
// Half
//
// Copyright © 2022 SomeRandomiOSDev. All rights reserved.
// Copyright © 2023 SomeRandomiOSDev. All rights reserved.
//

#if SWIFT_PACKAGE
Expand Down
2 changes: 1 addition & 1 deletion Tests/HalfTests/FunctionsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// FunctionsTests.swift
// Half
//
// Copyright © 2022 SomeRandomiOSDev. All rights reserved.
// Copyright © 2023 SomeRandomiOSDev. All rights reserved.
//

@testable import Half
Expand Down
4 changes: 3 additions & 1 deletion Tests/HalfTests/Half+CodingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Half+CodingTests.swift
// Half
//
// Copyright © 2022 SomeRandomiOSDev. All rights reserved.
// Copyright © 2023 SomeRandomiOSDev. All rights reserved.
//

@testable import Half
Expand Down Expand Up @@ -153,3 +153,5 @@ class HalfCodingTests: XCTestCase {
}
}
}

// swiftlint:enable function_body_length
4 changes: 3 additions & 1 deletion Tests/HalfTests/HalfTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// HalfTests.swift
// HalfTests
//
// Copyright © 2022 SomeRandomiOSDev. All rights reserved.
// Copyright © 2023 SomeRandomiOSDev. All rights reserved.
//

@testable import Half
Expand Down Expand Up @@ -503,3 +503,5 @@ extension HalfTests: TextOutputStream {
XCTAssertEqual(string, "2.5")
}
}

// swiftlint:enable function_body_length
2 changes: 1 addition & 1 deletion scripts/carthage.sh
Original file line number Diff line number Diff line change
@@ -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
#
Expand Down
2 changes: 1 addition & 1 deletion scripts/findproject.sh
Original file line number Diff line number Diff line change
@@ -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 <project_name>

Expand Down
2 changes: 1 addition & 1 deletion scripts/printformat.sh
Original file line number Diff line number Diff line change
@@ -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"
#
Expand Down
2 changes: 1 addition & 1 deletion scripts/resolvepath.sh
Original file line number Diff line number Diff line change
@@ -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/../../"

Expand Down
2 changes: 1 addition & 1 deletion scripts/versions.sh
Original file line number Diff line number Diff line change
@@ -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"

Expand Down
2 changes: 1 addition & 1 deletion scripts/workflowtests.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion scripts/xcframework.sh
Original file line number Diff line number Diff line change
@@ -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 <some_path>/<name>.xcframework

Expand Down