From f2b057a33b9c1c943e73ec007e2f59429b94090a Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 19 Dec 2021 13:46:44 -0800 Subject: [PATCH] make 'solve1' and 'solve2' static functions As of 9550d5dae1a487617a8910b1b496ffd12c78a546, these functions are no longer exported or needed outside of solvers.c. `solve3` has occasionally been a hotspot for performance-constrained Graphviz use cases. So making it more obvious to the compiler that it can inline and/or specialize `solve1` and `solve2` may provide some speed up. --- lib/pathplan/solvers.c | 7 +++++-- lib/pathplan/solvers.h | 2 -- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/pathplan/solvers.c b/lib/pathplan/solvers.c index 4fd9337a9..a94be07a0 100644 --- a/lib/pathplan/solvers.c +++ b/lib/pathplan/solvers.c @@ -12,6 +12,9 @@ #include #include +static int solve1(double *coeff, double *roots); +static int solve2(double *coeff, double *roots); + #ifndef M_PI #define M_PI 3.14159265358979323846 #endif @@ -62,7 +65,7 @@ int solve3(double *coeff, double *roots) return rootn; } -int solve2(double *coeff, double *roots) +static int solve2(double *coeff, double *roots) { double a, b, c; double disc, b_over_2a, c_over_a; @@ -85,7 +88,7 @@ int solve2(double *coeff, double *roots) return 1; } -int solve1(double *coeff, double *roots) +static int solve1(double *coeff, double *roots) { double a, b; diff --git a/lib/pathplan/solvers.h b/lib/pathplan/solvers.h index 010f44c8c..9011914d0 100644 --- a/lib/pathplan/solvers.h +++ b/lib/pathplan/solvers.h @@ -15,8 +15,6 @@ extern "C" { #endif extern int solve3(double *, double *); - extern int solve2(double *, double *); - extern int solve1(double *, double *); #ifdef __cplusplus } -- 2.40.0