shithub: mc

Download patch

ref: de3c5391d9dd343d5ba75046582780c081493f67
parent: 6b36dc7cbdc29cf8cf03a815518948fa7599f3df
author: Ori Bernstein <[email protected]>
date: Thu Oct 10 09:51:39 EDT 2013

Allow casting bools back and forth to ints

--- a/6/simp.c
+++ b/6/simp.c
@@ -780,6 +780,7 @@
     r = NULL;
     /* do the type conversion */
     switch (tybase(to)->type) {
+        case Tybool:
         case Tyint8: case Tyint16: case Tyint32: case Tyint64:
         case Tyuint8: case Tyuint16: case Tyuint32: case Tyuint64:
         case Tyint: case Tyuint: case Tylong: case Tyulong:
@@ -800,6 +801,7 @@
                     r = intconvert(s, val, to, 1);
                     break;
                 /* unsigned conversions */
+                case Tybool:
                 case Tyuint8: case Tyuint16: case Tyuint32: case Tyuint64:
                 case Tyuint: case Tyulong: case Tychar: case Tybyte:
                 case Typtr: