[clang] 5c9a849 - [clang][Interp][NFC] Use const references to Floating
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Thu May 4 01:03:59 PDT 2023
Author: Timm Bäder
Date: 2023-05-04T10:03:40+02:00
New Revision: 5c9a84960de2260f149ee15313998593255a78df
URL: https://github.com/llvm/llvm-project/commit/5c9a84960de2260f149ee15313998593255a78df
DIFF: https://github.com/llvm/llvm-project/commit/5c9a84960de2260f149ee15313998593255a78df.diff
LOG: [clang][Interp][NFC] Use const references to Floating
in the static functions. Since a Floating is backed by an APFloat, we
don't want to copy that around if it's not necessary.
Added:
Modified:
clang/lib/AST/Interp/Floating.h
Removed:
################################################################################
diff --git a/clang/lib/AST/Interp/Floating.h b/clang/lib/AST/Interp/Floating.h
index 90f8c1f8d4ad..85876236a999 100644
--- a/clang/lib/AST/Interp/Floating.h
+++ b/clang/lib/AST/Interp/Floating.h
@@ -105,8 +105,8 @@ class Floating final {
// -------
- static APFloat::opStatus add(Floating A, Floating B, llvm::RoundingMode RM,
- Floating *R) {
+ static APFloat::opStatus add(const Floating &A, const Floating &B,
+ llvm::RoundingMode RM, Floating *R) {
*R = Floating(A.F);
return R->F.add(B.F, RM);
}
@@ -118,8 +118,8 @@ class Floating final {
return R->F.add(One, RM);
}
- static APFloat::opStatus sub(Floating A, Floating B, llvm::RoundingMode RM,
- Floating *R) {
+ static APFloat::opStatus sub(const Floating &A, const Floating &B,
+ llvm::RoundingMode RM, Floating *R) {
*R = Floating(A.F);
return R->F.subtract(B.F, RM);
}
@@ -131,19 +131,19 @@ class Floating final {
return R->F.subtract(One, RM);
}
- static APFloat::opStatus mul(Floating A, Floating B, llvm::RoundingMode RM,
- Floating *R) {
+ static APFloat::opStatus mul(const Floating &A, const Floating &B,
+ llvm::RoundingMode RM, Floating *R) {
*R = Floating(A.F);
return R->F.multiply(B.F, RM);
}
- static APFloat::opStatus div(Floating A, Floating B, llvm::RoundingMode RM,
- Floating *R) {
+ static APFloat::opStatus div(const Floating &A, const Floating &B,
+ llvm::RoundingMode RM, Floating *R) {
*R = Floating(A.F);
return R->F.divide(B.F, RM);
}
- static bool neg(Floating A, Floating *R) {
+ static bool neg(const Floating &A, Floating *R) {
*R = -A;
return false;
}
More information about the cfe-commits
mailing list