Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

32 lines (26 sloc) 0.912 kb
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace IronJS.Runtime
{
public static class TaggedBools
{
private const long TrueBitPattern = -1095216660479L;
public static readonly double True = BitConverter.Int64BitsToDouble(TrueBitPattern);
private const long FalseBitPattern = -1095216660480L;
public static readonly double False = BitConverter.Int64BitsToDouble(FalseBitPattern);
public static double ToTagged(bool value)
{
return value ? True : False;
}
internal static bool IsTrue(double d)
{
return double.IsNaN(d) && (BitConverter.DoubleToInt64Bits(d) == TrueBitPattern);
}
internal static bool IsFalse(double d)
{
return double.IsNaN(d) && (BitConverter.DoubleToInt64Bits(d) == TrueBitPattern);
}
}
}
Jump to Line
Something went wrong with that request. Please try again.