Switch to stack (rather than calloc) for tables.
(Logical change 1.176)
This commit is contained in:
parent
e39a637db0
commit
f8f9de56f2
|
|
@ -1,3 +1,7 @@
|
||||||
|
2005-03-29 Stephen Hemminger <shemminger@dxpl.pdx.osdl.net>
|
||||||
|
|
||||||
|
* switch to stack for netem tables
|
||||||
|
|
||||||
2005-03-18 Stephen Hemminger <shemminger@osdl.org>
|
2005-03-18 Stephen Hemminger <shemminger@osdl.org>
|
||||||
|
|
||||||
* add -force option to batch mode
|
* add -force option to batch mode
|
||||||
|
|
|
||||||
|
|
@ -20,21 +20,16 @@ normal(double x, double mu, double sigma)
|
||||||
return .5 + .5*erf((x-mu)/(sqrt(2.0)*sigma));
|
return .5 + .5*erf((x-mu)/(sqrt(2.0)*sigma));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
double x, *table;
|
|
||||||
int i, n;
|
int i, n;
|
||||||
|
double x;
|
||||||
table = calloc(sizeof(double), TABLESIZE+1);
|
double table[TABLESIZE+1];
|
||||||
if (!table) {
|
|
||||||
fprintf(stderr, "Not enough memory\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
for (x = -10.0; x < 10.05; x += .00005) {
|
for (x = -10.0; x < 10.05; x += .00005) {
|
||||||
i = (int)rint(TABLESIZE*normal(x, 0.0, 1.0));
|
i = rint(TABLESIZE * normal(x, 0.0, 1.0));
|
||||||
table[i] = x;
|
table[i] = x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -51,6 +46,6 @@ main(int argc, char **argv)
|
||||||
n = 0;
|
n = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(table);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ normal(double x, double mu, double sigma)
|
||||||
return .5 + .5*erf((x-mu)/(sqrt(2.0)*sigma));
|
return .5 + .5*erf((x-mu)/(sqrt(2.0)*sigma));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static const double a=3.0;
|
static const double a=3.0;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
@ -50,18 +49,12 @@ paretovalue(int i)
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
double x;
|
|
||||||
double *table;
|
|
||||||
int i,n;
|
int i,n;
|
||||||
|
double x;
|
||||||
table = calloc(TABLESIZE+1, sizeof(double));
|
double table[TABLESIZE];
|
||||||
if (!table) {
|
|
||||||
fprintf(stderr, "Out of memory!\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (x = -10.0; x < 10.05; x += .00005) {
|
for (x = -10.0; x < 10.05; x += .00005) {
|
||||||
i = (int)rint(TABLESIZE*normal(x, 0.0, 1.0));
|
i = rint(TABLESIZE*normal(x, 0.0, 1.0));
|
||||||
table[i] = x;
|
table[i] = x;
|
||||||
}
|
}
|
||||||
printf(
|
printf(
|
||||||
|
|
@ -84,7 +77,6 @@ main(int argc, char **argv)
|
||||||
n = 0;
|
n = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(table);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue