-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathNBKDoubleWidth+Logic.swift
40 lines (32 loc) · 1.32 KB
/
NBKDoubleWidth+Logic.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//=----------------------------------------------------------------------------=
// This source file is part of the Numberick open source project.
//
// Copyright (c) 2023 Oscar Byström Ericsson
// Licensed under Apache License, Version 2.0
//
// See http://www.apache.org/licenses/LICENSE-2.0 for license information.
//=----------------------------------------------------------------------------=
import NBKCoreKit
//*============================================================================*
// MARK: * NBK x Double Width x Logic
//*============================================================================*
extension NBKDoubleWidth {
//=------------------------------------------------------------------------=
// MARK: Transformations
//=------------------------------------------------------------------------=
@inlinable public static prefix func ~(x: Self) -> Self {
x.onesComplement()
}
@inlinable public static func &=(lhs: inout Self, rhs: Self) {
lhs.low &= rhs.low
lhs.high &= rhs.high
}
@inlinable public static func |=(lhs: inout Self, rhs: Self) {
lhs.low |= rhs.low
lhs.high |= rhs.high
}
@inlinable public static func ^=(lhs: inout Self, rhs: Self) {
lhs.low ^= rhs.low
lhs.high ^= rhs.high
}
}