shithub: mc

Download patch

ref: 14346a4d8913a81c2c62e18ba150f6b770d5731d
parent: 3abec38baad46bc1317fc8a8b9c1fdd38494aef4
parent: ba8dedb8ae3549451ae889495b6c9102dfbbcf74
author: Ori Bernstein <[email protected]>
date: Mon Dec 30 18:04:49 EST 2013

Merge branch 'master' of git+ssh://mimir.eigenstate.org/git/ori/mc

--- a/6/isel.c
+++ b/6/isel.c
@@ -2,6 +2,7 @@
 #include <stdio.h>
 #include <stdint.h>
 #include <stdarg.h>
+#include <inttypes.h>
 #include <ctype.h>
 #include <string.h>
 #include <assert.h>
@@ -1011,10 +1012,10 @@
         case Lflt:
                 if (tybase(v->lit.type)->type == Tyfloat32) {
                     u.fv = v->lit.fltval;
-                    fprintf(fd, "\t.long 0x%x\n", u.lv);
+                    fprintf(fd, "\t.long 0x%"PRIx32"\n", u.lv);
                 } else if (tybase(v->lit.type)->type == Tyfloat64) {
                     u.dv = v->lit.fltval;
-                    fprintf(fd, "\t.quad 0x%lx\n", u.qv);
+                    fprintf(fd, "\t.quad 0x%"PRIx64"\n", u.qv);
                 }
                 break;
         case Lstr:
--- a/libstd/env.myr
+++ b/libstd/env.myr
@@ -9,13 +9,11 @@
 ;;
 
 const getenv = {name
-	var i
-
 	var n
-	for i = 0; i < _environment.len; i++
-		n = min(name.len, _environment[i].len)
-		if sleq(name, _environment[i][:n]) && sleq(_environment[i][n:n+1], "=")
-			-> `Some _environment[i][n+1:]
+	for env in _environment
+		n = min(name.len, env.len)
+		if sleq(name, env[:n]) && sleq(env[n:n+1], "=")
+			-> `Some env[n+1:]
 		;;
 	;;
 	-> `None
--- a/libstd/hashfuncs.myr
+++ b/libstd/hashfuncs.myr
@@ -15,11 +15,10 @@
 /* Supremely simple djb hash. */
 const strhash = {s
 	var h
-	var i
 	
 	h = 5381
-	for i = 0; i < s.len; i++
-		h = (h << 5) + h + (s[i] castto(uint32))
+	for b in s
+		h = (h << 5) + h + (b castto(uint32))
 	;;
 	-> h
 }
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -1,6 +1,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <stdint.h>
+#include <inttypes.h>
 #include <ctype.h>
 #include <string.h>
 #include <assert.h>
@@ -1259,11 +1260,9 @@
 
 static void infernode(Inferstate *st, Node *n, Type *ret, int *sawret)
 {
-    size_t i;
-    Node *d;
-    Node *s;
-    size_t nbound;
+    size_t i, nbound;
     Node **bound;
+    Node *d, *s;
     Type *t;
 
     if (!n)