aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYannick Gicquel <yannick.gicquel@iot.bzh>2016-04-27 12:47:26 +0200
committerYannick Gicquel <yannick.gicquel@iot.bzh>2016-04-27 12:55:38 +0200
commit920cae73a918d1f516113b0ae967be3ecaba86ef (patch)
tree71b478a9bb631e600d2d833c23bfcc5ac7491554
parentd625629d178cf7b7d816f562add740731cd88fdd (diff)
linpack: JTA patches
Signed-off-by: Yannick Gicquel <yannick.gicquel@iot.bzh>
-rw-r--r--linpack/linpack.c47
1 files changed, 30 insertions, 17 deletions
diff --git a/linpack/linpack.c b/linpack/linpack.c
index 17b2824..2c4807e 100644
--- a/linpack/linpack.c
+++ b/linpack/linpack.c
@@ -64,32 +64,43 @@ static REAL second (void);
static void *mempool;
-void main(void)
+int main(int argc, char *argv[]) {
- {
char buf[80];
int arsize;
long arsize2d,memreq,nreps;
size_t malloc_arg;
- while (1)
+ int count = 1;
+
+ while (count > 0)
{
- printf("Enter array size (q to quit) [200]: ");
- fgets(buf,79,stdin);
- if (buf[0]=='q' || buf[0]=='Q')
- break;
- if (buf[0]=='\0' || buf[0]=='\n')
- arsize=200;
- else
- arsize=atoi(buf);
- arsize/=2;
+ /* printf("Enter array size (q to quit) [200]: ");
+ * fgets(buf,79,stdin);
+ */
+ if (argc == 2) {
+ arsize = atoi(argv[1]);
+ printf("Size: %d\n", arsize);
+ }
+
+ /*if (buf[0]=='q' || buf[0]=='Q')
+ * break;
+ *
+ *if (buf[0]=='\0' || buf[0]=='\n')
+ * arsize=200;
+ */
+ else
+ // arsize=atoi(buf);
+ arsize=200;
+
+ arsize/=2;
arsize*=2;
- if (arsize<10)
- {
+ if (arsize<10) {
printf("Too small.\n");
- continue;
- }
- arsize2d = (long)arsize*(long)arsize;
+ //continue;
+ break;
+ }
+ arsize2d = (long)arsize*(long)arsize;
memreq=arsize2d*sizeof(REAL)+(long)arsize*sizeof(REAL)+(long)arsize*sizeof(int);
printf("Memory required: %ldK.\n",(memreq+512L)>>10);
malloc_arg=(size_t)memreq;
@@ -109,7 +120,9 @@ void main(void)
nreps*=2;
free(mempool);
printf("\n");
+ count--;
}
+ return 0;
}