From: benjamin.poirier@polymtl.ca (Benjamin Poirier)
Subject: [ltt-dev] [PATCH 2/2] Clean up style and redundancy
Date: Sun, 19 Sep 2010 21:01:44 -0400 [thread overview]
Message-ID: <1284944504-11875-2-git-send-email-benjamin.poirier@polymtl.ca> (raw)
In-Reply-To: <1284497565-4842-1-git-send-email-masoume.jabbarifar@polymtl.ca>
As the previous patch oultined, there was some repetition in getFactors() we
can do away with. While we're in the neighborhood, also wrap a > 80 col line.
Signed-off-by: Benjamin Poirier <benjamin.poirier at polymtl.ca>
---
lttv/lttv/sync/factor_reduction_accuracy.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/lttv/lttv/sync/factor_reduction_accuracy.c b/lttv/lttv/sync/factor_reduction_accuracy.c
index 885c52c..ccb0d03 100644
--- a/lttv/lttv/sync/factor_reduction_accuracy.c
+++ b/lttv/lttv/sync/factor_reduction_accuracy.c
@@ -244,8 +244,8 @@ static GArray* finalizeReductionAccuracy(SyncState* const syncState,
g_array_set_size(factors, syncState->traceNb);
for (i= 0; i < syncState->traceNb; i++)
{
- getFactors(allFactors, predecessors, references, i, &g_array_index(factors,
- Factors, i));
+ getFactors(allFactors, predecessors, references, i,
+ &g_array_index(factors, Factors, i));
}
if (syncState->stats)
@@ -426,6 +426,8 @@ static void getFactors(AllFactors* const allFactors, unsigned int** const
{
Factors previousVertexFactors;
unsigned int previousVertex= predecessors[reference][traceNum];
+ PairFactors* factorsPT= &pairFactors[previousVertex][traceNum],
+ *factorsTP= &pairFactors[traceNum][previousVertex];
getFactors(allFactors, predecessors, references, previousVertex,
&previousVertexFactors);
@@ -434,22 +436,20 @@ static void getFactors(AllFactors* const allFactors, unsigned int** const
* pairFactors[row][col] converts the time from col to row, invert the
* factors as necessary */
- if (pairFactors[previousVertex][traceNum].approx != NULL)
+ if (factorsPT->approx != NULL)
{
factors->offset= previousVertexFactors.drift *
- pairFactors[previousVertex][traceNum].approx->offset +
- previousVertexFactors.offset;
+ factorsPT->approx->offset + previousVertexFactors.offset;
factors->drift= previousVertexFactors.drift *
- pairFactors[previousVertex][traceNum].approx->drift;
+ factorsPT->approx->drift;
}
- else if (pairFactors[traceNum][previousVertex].approx != NULL)
+ else if (factorsTP->approx != NULL)
{
factors->offset= previousVertexFactors.drift * (-1. *
- pairFactors[traceNum][previousVertex].approx->offset /
- pairFactors[traceNum][previousVertex].approx->drift) +
+ factorsTP->approx->offset / factorsTP->approx->drift) +
previousVertexFactors.offset;
factors->drift= previousVertexFactors.drift * (1. /
- pairFactors[traceNum][previousVertex].approx->drift);
+ factorsTP->approx->drift);
}
else
{
--
1.7.1
prev parent reply other threads:[~2010-09-20 1:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-14 20:52 [ltt-dev] [PATCH] Fix passing factors in recursive function Masoume Jabbarifar
2010-09-20 1:01 ` [ltt-dev] [PATCH 1/2] Use appropriate factor-pair when reducing Benjamin Poirier
2010-09-20 1:01 ` Benjamin Poirier [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1284944504-11875-2-git-send-email-benjamin.poirier@polymtl.ca \
--to=benjamin.poirier@polymtl.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox