lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Thu, 23 Sep 2021 00:46:06 -0700 From: Ian Rogers <irogers@...gle.com> To: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>, Arnaldo Carvalho de Melo <acme@...nel.org>, Mark Rutland <mark.rutland@....com>, Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...hat.com>, Namhyung Kim <namhyung@...nel.org>, linux-kernel@...r.kernel.org, Andi Kleen <ak@...ux.intel.com>, Jin Yao <yao.jin@...ux.intel.com>, John Garry <john.garry@...wei.com>, Paul Clarke <pc@...ibm.com>, kajoljain <kjain@...ux.ibm.com>, linux-perf-users@...r.kernel.org Cc: Stephane Eranian <eranian@...gle.com>, Sandeep Dasgupta <sdasgup@...gle.com>, Ian Rogers <irogers@...gle.com> Subject: [PATCH v9 03/13] perf expr: Remove unused headers and inline d_ratio No functional change. Inlining d_ratio makes it easier to special case for constants in a later patch. Signed-off-by: Ian Rogers <irogers@...gle.com> --- tools/perf/util/expr.y | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/tools/perf/util/expr.y b/tools/perf/util/expr.y index 41c9cd4efadd..e6005450feae 100644 --- a/tools/perf/util/expr.y +++ b/tools/perf/util/expr.y @@ -2,23 +2,10 @@ %{ #define YYDEBUG 1 #include <math.h> -#include <stdio.h> -#include "util.h" #include "util/debug.h" -#include <stdlib.h> // strtod() +#include "smt.h" #define IN_EXPR_Y 1 #include "expr.h" -#include "smt.h" -#include <string.h> - -static double d_ratio(double val0, double val1) -{ - if (val1 == 0) { - return 0; - } - return val0 / val1; -} - %} %define api.pure full @@ -120,7 +107,12 @@ expr: NUMBER | MIN '(' expr ',' expr ')' { $$ = $3 < $5 ? $3 : $5; } | MAX '(' expr ',' expr ')' { $$ = $3 > $5 ? $3 : $5; } | SMT_ON { $$ = smt_on() > 0; } - | D_RATIO '(' expr ',' expr ')' { $$ = d_ratio($3,$5); } + | D_RATIO '(' expr ',' expr ')' { if ($5 == 0) { + $$ = 0; + } else { + $$ = $3 / $5; + } + } ; %% -- 2.33.0.464.g1972c5931b-goog
Powered by blists - more mailing lists