Skip to content

Commit 9e05e11

Browse files
authored
precondition -> assert in Scalar (#245)
1 parent ccb167e commit 9e05e11

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Sources/HomomorphicEncryption/Modulus.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Apple Inc. and the Swift Homomorphic Encryption project authors
1+
// Copyright 2024-2025 Apple Inc. and the Swift Homomorphic Encryption project authors
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -96,8 +96,8 @@ public struct Modulus<T: ScalarType>: Equatable, Sendable {
9696
/// - Returns: `x * y mod p`.
9797
@inlinable
9898
public func multiplyMod(_ x: T, _ y: T) -> T {
99-
precondition(x < modulus)
100-
precondition(y < modulus)
99+
assert(x < modulus)
100+
assert(y < modulus)
101101
let product = x.multipliedFullWidth(by: y)
102102
return reduceProduct(T.DoubleWidth(product))
103103
}
@@ -383,8 +383,8 @@ struct ReduceModulus<T: ScalarType>: Equatable, Sendable {
383383
/// - Returns: `x * y mod p`.
384384
@inlinable
385385
func multiplyMod(_ x: T, _ y: T) -> T {
386-
precondition(x < modulus)
387-
precondition(y < modulus)
386+
assert(x < modulus)
387+
assert(y < modulus)
388388
let product = x.multipliedFullWidth(by: y)
389389
return reduceProduct(T.DoubleWidth(product))
390390
}

0 commit comments

Comments
 (0)