diff python/ppci/codegen/registerallocator.py @ 366:39bf68bf1891

Fix sample tests and deterministic build
author Windel Bouwman
date Fri, 21 Mar 2014 09:43:01 +0100
parents b00219172a42
children
line wrap: on
line diff
--- a/python/ppci/codegen/registerallocator.py	Wed Mar 19 22:32:04 2014 +0100
+++ b/python/ppci/codegen/registerallocator.py	Fri Mar 21 09:43:01 2014 +0100
@@ -3,7 +3,11 @@
 from .interferencegraph import InterferenceGraph
 
 # Nifty first function:
-first = lambda x: next(iter(x))
+def first(x):
+    """ Take the first element of a collection after sorting the things """
+    x = list(x)
+    x.sort()
+    return next(iter(x))
 
 
 class RegisterAllocator: