-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…/power(_:).
- Loading branch information
Showing
3 changed files
with
482 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
//=----------------------------------------------------------------------------= | ||
// This source file is part of the Ultimathnum 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 CoreKit | ||
import DoubleIntKit | ||
import InfiniIntKit | ||
import TestKit | ||
|
||
//*============================================================================* | ||
// MARK: * Exponentiation | ||
//*============================================================================* | ||
|
||
/// - Important: Please disable code coverage because it is always on by default. | ||
final class ExponentiationBenchmarks: XCTestCase { | ||
|
||
//=------------------------------------------------------------------------= | ||
// MARK: Tests | ||
//=------------------------------------------------------------------------= | ||
|
||
func testExponentiationAsUX() throws { | ||
typealias T = UX | ||
|
||
for base: UX in 0..<128 { | ||
for exponent: UX in 0..<1000 { | ||
blackHole(T(load: base).power(T(load: exponent))) | ||
} | ||
} | ||
} | ||
|
||
func testExponentiationAsU256() throws { | ||
typealias T = U256 | ||
|
||
for base: UX in 0..<128 { | ||
for exponent: UX in 0..<1000 { | ||
blackHole(T(load: base).power(T(load: exponent))) | ||
} | ||
} | ||
} | ||
|
||
func testExponentiationAsUXL() throws { | ||
typealias T = UXL | ||
|
||
for base: UX in 0..<128 { | ||
for exponent: UX in 0..<1000 { | ||
blackHole(T(load: base).power(T(load: exponent))) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.