Skip to content

Commit 7e95512

Browse files
committed
Optimize calculation of max_t and max_tau
Previously, 'max_t' and 'max_tau' were computed before verifying if the measurement was sufficient. This change moves their calculation to a later stage, reducing unnecessary computations when the measurement is insufficient. Change-Id: Ifa3afbe308e5a1c40c87ec1b4d9b3362c4c20f04
1 parent f0574a3 commit 7e95512

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: dudect/fixture.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,7 @@ static t_context_t *max_test()
139139
static bool report(void)
140140
{
141141
t_context_t *t = max_test();
142-
double max_t = fabs(t_compute(t));
143142
double number_traces_max_t = t->n[0] + t->n[1];
144-
double max_tau = max_t / sqrt(number_traces_max_t);
145143

146144
printf("\033[A\033[2K");
147145
printf("measure: %7.2lf M, ", (number_traces_max_t / 1e6));
@@ -151,6 +149,9 @@ static bool report(void)
151149
return false;
152150
}
153151

152+
double max_t = fabs(t_compute(t));
153+
double max_tau = max_t / sqrt(number_traces_max_t);
154+
154155
/* max_t: the t statistic value
155156
* max_tau: a t value normalized by sqrt(number of measurements).
156157
* this way we can compare max_tau taken with different

0 commit comments

Comments
 (0)