[svn:parrot] r49116 - branches/gc_massacre/src/pmc

bacek at svn.parrot.org bacek at svn.parrot.org
Fri Sep 17 23:50:13 UTC 2010


Author: bacek
Date: Fri Sep 17 23:50:13 2010
New Revision: 49116
URL: https://trac.parrot.org/parrot/changeset/49116

Log:
implement Boolean init_int vtable and use it in FixedBooleanArray

Modified:
   branches/gc_massacre/src/pmc/boolean.pmc
   branches/gc_massacre/src/pmc/fixedbooleanarray.pmc

Modified: branches/gc_massacre/src/pmc/boolean.pmc
==============================================================================
--- branches/gc_massacre/src/pmc/boolean.pmc	Fri Sep 17 23:49:57 2010	(r49115)
+++ branches/gc_massacre/src/pmc/boolean.pmc	Fri Sep 17 23:50:13 2010	(r49116)
@@ -58,11 +58,16 @@
 Create a new C<Boolean> with the given initial value interpreted
 as a Boolean.
 
+=item C<void init_int(INTVAL value)>
+
+Create a new C<Boolean> with the given initial value interpreted
+as a Boolean.
+
 =cut
 
 */
 
-    /* These two init functions set the boolean flag directly. */
+    /* These init functions set the boolean flag directly. */
 
     VTABLE void init() {
         set_boolean_FLAG(SELF, 0);
@@ -73,6 +78,10 @@
         set_boolean_FLAG(SELF, v);
     }
 
+    VTABLE void init_int(INTVAL value) {
+        set_boolean_FLAG(SELF, value);
+    }
+
 /*
 
 =item C<INTVAL get_bool()>

Modified: branches/gc_massacre/src/pmc/fixedbooleanarray.pmc
==============================================================================
--- branches/gc_massacre/src/pmc/fixedbooleanarray.pmc	Fri Sep 17 23:49:57 2010	(r49115)
+++ branches/gc_massacre/src/pmc/fixedbooleanarray.pmc	Fri Sep 17 23:50:13 2010	(r49116)
@@ -334,10 +334,8 @@
 */
 
     VTABLE PMC *get_pmc_keyed_int(INTVAL key) {
-        PMC  * const ret = Parrot_pmc_new(INTERP, enum_class_Boolean);
-        const INTVAL val = SELF.get_integer_keyed_int(key);
-        VTABLE_set_integer_native(INTERP, ret, val);
-        return ret;
+        return Parrot_pmc_new_init_int(INTERP, enum_class_Boolean,
+                SELF.get_integer_keyed_int(key));
     }
 
 /*


More information about the parrot-commits mailing list