summary refs log tree commit diff
path: root/util.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-04-18 14:03:06 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-04-18 14:03:06 -0400
commitc43a07086bdeefe029c5b6da4ec1c8020126d5ca (patch)
treed497b43234d5d59ca40ceb22154d24e15fdeb395 /util.c
parentc6f3adc52d375d434e3dfd2d23056f0bfdbcdc67 (diff)
downloadroux-c43a07086bdeefe029c5b6da4ec1c8020126d5ca.tar.gz
factor some subtyping logic in clsmerge()
Diffstat (limited to 'util.c')
-rw-r--r--util.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/util.c b/util.c
index 96efdfd..527f214 100644
--- a/util.c
+++ b/util.c
@@ -189,6 +189,23 @@ vgrow(void *vp, ulong len)
 }
 
 int
+clsmerge(short *pk, short k)
+{
+	short k1;
+
+	k1 = *pk;
+	if (k1 == Kx) {
+		*pk = k;
+		return 0;
+	}
+	if ((k1 == Kw && k == Kl) || (k1 == Kl && k == Kw)) {
+		*pk = Kw;
+		return 0;
+	}
+	return k1 != k;
+}
+
+int
 phicls(int t, Tmp *tmp /*, int c*/)
 {
 	if (tmp[t].phi)