Index: rx.c
===================================================================
RCS file: /cvs/public/parrot/rx.c,v
retrieving revision 1.6
diff -u -r1.6 rx.c
--- rx.c	15 Jan 2002 16:54:06 -0000	1.6
+++ rx.c	15 Jan 2002 19:52:04 -0000
@@ -131,7 +131,7 @@
 		return 0;
 	}
 	
-	return bmp->bmp[ch>>3] & (1<<(ch & 7));
+	return TO_BOOLVAL(bmp->bmp[ch>>3] & (1<<(ch & 7)));
 }
 
 void bitmap_destroy(Bitmap bmp) {
Index: chartypes/unicode.c
===================================================================
RCS file: /cvs/public/parrot/chartypes/unicode.c,v
retrieving revision 1.7
diff -u -r1.7 unicode.c
--- chartypes/unicode.c	15 Jan 2002 16:10:48 -0000	1.7
+++ chartypes/unicode.c	15 Jan 2002 19:52:04 -0000
@@ -24,7 +24,7 @@
 
 static BOOLVAL
 unicode_is_digit(INTVAL c) {
-    return (BOOLVAL)(isdigit(c) ? 1 : 0); /* FIXME - Other code points are also digits */
+    return TO_BOOLVAL(isdigit(c)); /* FIXME - Other code points are also digits */
 }
 
 static INTVAL
Index: chartypes/usascii.c
===================================================================
RCS file: /cvs/public/parrot/chartypes/usascii.c,v
retrieving revision 1.5
diff -u -r1.5 usascii.c
--- chartypes/usascii.c	15 Jan 2002 16:10:48 -0000	1.5
+++ chartypes/usascii.c	15 Jan 2002 19:52:04 -0000
@@ -47,7 +47,7 @@
 
 static BOOLVAL
 usascii_is_digit(INTVAL c) {
-    return (BOOLVAL)(isdigit(c) ? 1 : 0);
+    return TO_BOOLVAL(isdigit(c));
 }
 
 static INTVAL
Index: classes/parrotpointer.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/parrotpointer.pmc,v
retrieving revision 1.5
diff -u -r1.5 parrotpointer.pmc
--- classes/parrotpointer.pmc	14 Jan 2002 20:04:21 -0000	1.5
+++ classes/parrotpointer.pmc	15 Jan 2002 19:52:05 -0000
@@ -72,7 +72,7 @@
    }
 
    BOOLVAL get_bool () {
-      return (BOOLVAL)(SELF->data != NULL);
+      return TO_BOOLVAL(SELF->data);
    }
 
    void* get_value () {
@@ -80,7 +80,7 @@
    }
 
    BOOLVAL is_same (PMC* pmc2) {
-      return (BOOLVAL)(SELF->vtable == pmc2->vtable && SELF->data == pmc2->data);
+      return TO_BOOLVAL(SELF->vtable == pmc2->vtable && SELF->data == pmc2->data);
    }
 
    void set_integer (PMC * value) {
Index: classes/perlarray.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/perlarray.pmc,v
retrieving revision 1.7
diff -u -r1.7 perlarray.pmc
--- classes/perlarray.pmc	14 Jan 2002 20:04:21 -0000	1.7
+++ classes/perlarray.pmc	15 Jan 2002 19:52:05 -0000
@@ -89,7 +89,7 @@
     BOOLVAL get_bool () {
 	KEY* key = SELF->cache.struct_val;
 	INTVAL size = key_size(INTERP,key);
-	return (BOOLVAL)(size != 0);
+	return TO_BOOLVAL(size);
     }
 
     void* get_value () {
@@ -99,7 +99,7 @@
     BOOLVAL is_same (PMC* other) {
 	STRING* s1 = (STRING*)SELF->cache.struct_val;
 	STRING* s2 = (STRING*)other->cache.struct_val;
-        return (BOOLVAL)( other->vtable == SELF->vtable
+        return TO_BOOLVAL( other->vtable == SELF->vtable
 	    && (strcmp(s1->bufstart,s2->bufstart)==0) );
     }
 
Index: classes/perlhash.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/perlhash.pmc,v
retrieving revision 1.5
diff -u -r1.5 perlhash.pmc
--- classes/perlhash.pmc	14 Jan 2002 20:04:21 -0000	1.5
+++ classes/perlhash.pmc	15 Jan 2002 19:52:05 -0000
@@ -107,7 +107,7 @@
     BOOLVAL is_same (PMC* other) {
 	STRING* s1 = (STRING*)SELF->cache.struct_val;
 	STRING* s2 = (STRING*)other->cache.struct_val;
-        return (BOOLVAL)( other->vtable == SELF->vtable
+        return TO_BOOLVAL( other->vtable == SELF->vtable
 	    && (strcmp(s1->bufstart,s2->bufstart)==0) );
     }
 
Index: classes/perlint.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/perlint.pmc,v
retrieving revision 1.14
diff -u -r1.14 perlint.pmc
--- classes/perlint.pmc	14 Jan 2002 20:04:21 -0000	1.14
+++ classes/perlint.pmc	15 Jan 2002 19:52:05 -0000
@@ -77,7 +77,7 @@
     }
 
     BOOLVAL get_bool () {
-        return (BOOLVAL)(pmc->cache.int_val != 0);
+        return TO_BOOLVAL(pmc->cache.int_val);
     }
 
     void* get_value () {
@@ -86,7 +86,7 @@
 
     BOOLVAL is_same (PMC* other) {
         /* Do you refer to exactly the same data that I do? */
-        return (BOOLVAL)( other->vtable == SELF->vtable /* You never know if you've been inherited...*/
+        return TO_BOOLVAL( other->vtable == SELF->vtable /* You never know if you've been inherited...*/
             && SELF->cache.int_val == other->cache.int_val );
     }
 
@@ -479,7 +479,7 @@
 
     /* == operation */
     BOOLVAL is_equal (PMC* value) {
-        return (BOOLVAL)(SELF->cache.int_val == value->vtable->get_integer(INTERP, value));
+        return TO_BOOLVAL(SELF->cache.int_val == value->vtable->get_integer(INTERP, value));
     }
 
     void logical_or (PMC* value, PMC* dest) {
Index: classes/perlnum.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/perlnum.pmc,v
retrieving revision 1.16
diff -u -r1.16 perlnum.pmc
--- classes/perlnum.pmc	14 Jan 2002 20:04:21 -0000	1.16
+++ classes/perlnum.pmc	15 Jan 2002 19:52:05 -0000
@@ -77,7 +77,7 @@
     }
 
     BOOLVAL get_bool () {
-        return (BOOLVAL)(pmc->cache.num_val != 0.0);
+        return TO_BOOLVAL(pmc->cache.num_val);
     }
 
     void* get_value () {
@@ -86,7 +86,7 @@
 
     BOOLVAL is_same (PMC* other) {
         /* Do you refer to exactly the same data that I do? */
-        return (BOOLVAL)( other->vtable == SELF->vtable /* You never know if you've been inherited...*/
+        return TO_BOOLVAL( other->vtable == SELF->vtable /* You never know if you've been inherited...*/
             && SELF->cache.num_val == other->cache.num_val );
     }
 
@@ -410,7 +410,7 @@
 
     /* == operation */
     BOOLVAL is_equal (PMC* value) {
-        return (BOOLVAL)(SELF->cache.num_val == value->vtable->get_number(INTERP, value));
+        return TO_BOOLVAL(SELF->cache.num_val == value->vtable->get_number(INTERP, value));
     }
 
     void logical_or (PMC* value, PMC* dest) = default;
Index: classes/perlstring.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/perlstring.pmc,v
retrieving revision 1.14
diff -u -r1.14 perlstring.pmc
--- classes/perlstring.pmc	14 Jan 2002 20:04:21 -0000	1.14
+++ classes/perlstring.pmc	15 Jan 2002 19:52:06 -0000
@@ -80,7 +80,7 @@
     BOOLVAL is_same (PMC* other) {
 	STRING* s1 = (STRING*)SELF->cache.struct_val;
 	STRING* s2 = (STRING*)other->cache.struct_val;
-        return (BOOLVAL)( other->vtable == SELF->vtable
+        return TO_BOOLVAL( other->vtable == SELF->vtable
 	    && (strcmp(s1->bufstart,s2->bufstart)==0) );
     }
 
@@ -418,7 +418,7 @@
 
     /* == operation */
     BOOLVAL is_equal (PMC* value) {
-        return (BOOLVAL)( 0 == string_compare(INTERP,
+        return TO_BOOLVAL( 0 == string_compare(INTERP,
 				                     SELF->cache.struct_val,
 				                     value->vtable->get_string(INTERP, value)
 				                    ));
Index: classes/perlundef.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/perlundef.pmc,v
retrieving revision 1.5
diff -u -r1.5 perlundef.pmc
--- classes/perlundef.pmc	14 Jan 2002 20:04:21 -0000	1.5
+++ classes/perlundef.pmc	15 Jan 2002 19:52:06 -0000
@@ -76,7 +76,7 @@
    }
 
    BOOLVAL is_same (PMC* pmc2) {
-      return (BOOLVAL)(pmc2->vtable == pmc->vtable);
+      return TO_BOOLVAL(pmc2->vtable == pmc->vtable);
    }
 
    void set_integer (PMC * value) {
Index: include/parrot/parrot.h
===================================================================
RCS file: /cvs/public/parrot/include/parrot/parrot.h,v
retrieving revision 1.18
diff -u -r1.18 parrot.h
--- include/parrot/parrot.h	14 Jan 2002 20:04:29 -0000	1.18
+++ include/parrot/parrot.h	15 Jan 2002 19:52:06 -0000
@@ -73,6 +73,9 @@
    used to make an empty block.  */
 #define UNUSED(a) if (a) {}
 
+/* The correct way to convert to a BOOLVAL. Plain casting will lose higher-order bits */
+#define TO_BOOLVAL(X) (BOOLVAL)((X)?1:0)
+
 #include "parrot/global_setup.h"
 #include "parrot/interpreter.h"
 #include "parrot/encoding.h"
