shithub: mc

Download patch

ref: f7fc1cd4e2b36f2ae8d124c4654eac7f48aadff8
parent: ec17d9295920ba33dee1fa5348bf35fca2b88665
author: Ori Bernstein <ori@eigenstate.org>
date: Mon Sep 25 08:10:41 EDT 2017

Minor cleanups on bio geti.

--- a/lib/bio/geti.myr
+++ b/lib/bio/geti.myr
@@ -21,14 +21,11 @@
   little endian format
 */
 generic getle = {f, n -> std.result(@a::(numeric,integral), err)
-	var v, i
-
-	v = 0
 	match ensureread(f, n)
-	| `std.Err e:
-		-> `std.Err e
+	| `std.Err e :	-> `std.Err e
 	| `std.Ok _:
-		for i = 0; i < n; i++
+		var v = 0
+		for var i = 0; i < n; i++
 			v |= (f.rbuf[f.rstart++] : uint64) << (8*(i : uint64))
 		;;
 		-> `std.Ok (v : @a::(numeric,integral))
@@ -40,14 +37,11 @@
   big endian format
 */
 generic getbe = {f, n -> std.result(@a::(numeric,integral), err)
-	var v, i
-
-	v = 0
 	match ensureread(f, n)
-	| `std.Err e:
-		-> `std.Err e
+	| `std.Err e :	-> `std.Err e
 	| `std.Ok _:
-		for i = 0; i < n; i++
+		var v = 0
+		for var i = 0; i < n; i++
 			v <<= 8
 			v |= (f.rbuf[f.rstart++] : uint64)
 		;;