shithub: riscv

Download patch

ref: 3ba1197aeb382e1750cbb0f2567794bd4482e1e2
parent: b47c096c8ceb7b96820ec886146a674eb9ad2c7b
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Apr 9 22:35:01 EDT 2016

libmp: make includes consistent, make test program compile under ape (work in progress)

--- a/sys/src/libmp/mkfile
+++ b/sys/src/libmp/mkfile
@@ -26,12 +26,12 @@
 	for(objtype in $CPUS) mk $MKFLAGS install
 
 everything:V:
-	rm -f */*.[012456789kvx]
+	rm -f */*.[$OS]
 	for(objtype in 386)@{
 		echo $objtype
 		mk $MKFLAGS install
 	}
-	rm -f */*.[012456789kvx]
+	rm -f */*.[$OS]
 
 test.$O: test.c /$objtype/include/u.h /sys/include/mp.h port/dat.h
 	$CC -Iport test.c
@@ -46,9 +46,9 @@
 	$LD -o $O.bigtest bigtest.$O
 
 allout:
+	objtype=arm; mk; mk 5.test 5.bigtest
+	objtype=amd64; mk; mk 6.test 6.bigtest
 	objtype=386; mk; mk 8.test 8.bigtest
-	objtype=power; mk; mk q.test q.bigtest
-	objtype=mips; mk; mk v.test v.bigtest
 
 cleanout:
-	rm -f [qv8].* *.[qv8]
+	rm -f [568].* *.[568]
--- a/sys/src/libmp/port/mpmodop.c
+++ b/sys/src/libmp/port/mpmodop.c
@@ -1,5 +1,4 @@
-#include <u.h>
-#include <libc.h>
+#include "os.h"
 #include <mp.h>
 
 /* operands need to have m->top+1 digits of space and satisfy 0 ≤ a ≤ m-1 */
--- a/sys/src/libmp/test.c
+++ b/sys/src/libmp/test.c
@@ -5,26 +5,11 @@
 
 int loops = 1;
 
-long randomreg;
-
 void
-srand(long seed)
-{
-	randomreg = seed;
-}
-
-long
-lrand(void)
-{
-	randomreg = randomreg*104381 + 81761;
-	return randomreg;
-}
-
-void
 prng(uchar *p, int n)
 {
 	while(n-- > 0)
-		*p++ = lrand();
+		*p++ = rand();
 }
 
 void