Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use preallocated Bool objects
  • Loading branch information
sorear committed Nov 24, 2010
1 parent 6a9add7 commit b77fc74
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/Kernel.cs
Expand Up @@ -880,6 +880,8 @@ public class Kernel {
public static Variable BoxAny(object v, IP6 proto) {
if (v == null)
return NewROScalar(proto);
if (proto == BoolMO.typeObject)
return ((bool) v) ? TrueV : FalseV;
DynObject n = new DynObject(((DynObject)proto).mo);
n.slots[0] = v;
return NewROScalar(n);
Expand All @@ -888,6 +890,8 @@ public class Kernel {
public static Variable BoxAnyMO(object v, DynMetaObject proto) {
if (v == null)
return NewROScalar(proto.typeObject);
if (proto == BoolMO)
return ((bool) v) ? TrueV : FalseV;
DynObject n = new DynObject(proto);
n.slots[0] = v;
return NewROScalar(n);
Expand Down

0 comments on commit b77fc74

Please sign in to comment.