UInt64Ops
Namespace:
IronPython
We found 10 examples in language CSharp for this search.
You will see 50 fragments of code.
Other methods
Other methods
Project:codeplex
File:UInt64Ops.Generated.cs
Examples:1
public static DynamicType MakeDynamicType() {
if (UInt64Type == null) {
OpsReflectedType ort = new OpsReflectedType("UInt64", typeof(UInt64), typeof(UInt64Ops), null);
if (Interlocked.CompareExchange<ReflectedType>(ref UInt64Type, ort, null) == null) {
return ort;
}
}
return UInt64Type;
}
Project:DICommander
File:UInt64Ops.Generated.cs
Examples:1
public static DynamicType MakeDynamicType() {
if (UInt64Type == null) {
OpsReflectedType ort = new OpsReflectedType("UInt64", typeof(UInt64), typeof(UInt64Ops), null);
if (Interlocked.CompareExchange<ReflectedType>(ref UInt64Type, ort, null) == null) {
return ort;
}
}
return UInt64Type;
}
Project:DICommander
File:Int16Ops.Generated.cs
Examples:6
public static DynamicType MakeDynamicType() {
if (Int16Type == null) {
OpsReflectedType ort = new OpsReflectedType("Int16", typeof(Int16), typeof(Int16Ops), null);
if (Interlocked.CompareExchange<ReflectedType>(ref Int16Type, ort, null) == null) {
return ort;
}
}
return Int16Type;
}
[PythonName("__new__")]
public static object Make(DynamicType cls) {
return Make(cls, default(Int16));
}
[PythonName("__new__")]
public static object Make(DynamicType cls, object value) {
if (cls != Int16Type) {
throw Ops.TypeError("Int16.__new__: first argument must be Int16 type.");
}
IConvertible valueConvertible;
if ((valueConvertible = value as IConvertible) != null) {
switch (valueConvertible.GetTypeCode()) {
case TypeCode.Byte: return (Int16)(Byte)value;
case TypeCode.SByte: return (Int16)(SByte)value;
case TypeCode.Int16: return (Int16)(Int16)value;
case TypeCode.UInt16: return (Int16)(UInt16)value;
case TypeCode.Int32: return (Int16)(Int32)value;
case TypeCode.UInt32: return (Int16)(UInt32)value;
case TypeCode.Int64: return (Int16)(Int64)value;
case TypeCode.UInt64: return (Int16)(UInt64)value;
case TypeCode.Single: return (Int16)(Single)value;
case TypeCode.Double: return (Int16)(Double)value;
}
}
if (value is String) {
return Int16.Parse((String)value);
} else if (value is BigInteger) {
return (Int16)(BigInteger)value;
} else if (value is ExtensibleInt) {
return (Int16)((ExtensibleInt)value).value;
} else if (value is ExtensibleLong) {
return (Int16)((ExtensibleLong)value).Value;
} else if (value is ExtensibleFloat) {
return (Int16)((ExtensibleFloat)value).value;
} else if (value is Enum) {
return Converter.CastEnumToInt16(value);
}
throw Ops.ValueError("invalid value for Int16.__new__");
}
[PythonName("__add__")]
public static object Add(object left, object right) {
if (!(left is Int16)) {
throw Ops.TypeError("'__add__' requires Int16, but received {0}", Ops.GetDynamicType(left).__name__);
}
Int16 leftInt16 = (Int16)left;
IConvertible rightConvertible;
if ((rightConvertible = right as IConvertible) != null) {
switch (rightConvertible.GetTypeCode()) {
case TypeCode.Boolean: {
Int32 result = (Int32)(((Int32)leftInt16) + ((Int32)((Boolean)right ? (Int16)1 : (Int16)0)));
if (Int16.MinValue <= result && result <= Int16.MaxValue) {
return (Int16)result;
} else return result;
}
case TypeCode.Byte: {
Int32 result = (Int32)(((Int32)leftInt16) + ((Int32)(Byte)right));
if (Int16.MinValue <= result && result <= Int16.MaxValue) {
return (Int16)result;
} else return result;
}
case TypeCode.SByte: {
Int32 result = (Int32)(((Int32)leftInt16) + ((Int32)(SByte)right));
if (Int16.MinValue <= result && result <= Int16.MaxValue) {
return (Int16)result;
} else return result;
}
case TypeCode.Int16: {
Int32 result = (Int32)(((Int32)leftInt16) + ((Int32)(Int16)right));
if (Int16.MinValue <= result && result <= Int16.MaxValue) {
return (Int16)result;
} else return result;
}
case TypeCode.UInt16: {
Int32 result = (Int32)(((Int32)leftInt16) + ((Int32)(UInt16)right));
if (Int16.MinValue <= result && result <= Int16.MaxValue) {
return (Int16)result;
} else return result;
}
case TypeCode.Int32: {
Int64 result = (Int64)(((Int64)leftInt16) + ((Int64)(Int32)right));
if (Int32.MinValue <= result && result <= Int32.MaxValue) {
return (Int32)result;
} else return result;
}
case TypeCode.UInt32: {
Int64 result = (Int64)(((Int64)leftInt16) + ((Int64)(UInt32)right));
if (Int16.MinValue <= result && result <= Int16.MaxValue) {
return (Int16)result;
} else return result;
}
case TypeCode.Int64: {
return Int64Ops.Add(leftInt16, (Int64)right);
}
case TypeCode.UInt64: {
return UInt64Ops.AddImpl(leftInt16, (UInt64)right);
}
case TypeCode.Single: {
return SingleOps.AddImpl((Single)leftInt16, (Single)(Single)right);
}
case TypeCode.Double: {
return FloatOps.Add((Double)leftInt16, (Double)(Double)right);
}
}
}
if (right is BigInteger) {
return LongOps.Add(leftInt16, (BigInteger)right);
} else if (right is Complex64) {
return ComplexOps.Add(leftInt16, (Complex64)right);
} else if (right is ExtensibleInt) {
Int64 result = (Int64)(((Int64)leftInt16) + ((Int64)((ExtensibleInt)right).value));
if (Int32.MinValue <= result && result <= Int32.MaxValue) {
return (Int32)result;
} else return result;
} else if (right is ExtensibleLong) {
return LongOps.Add(leftInt16, ((ExtensibleLong)right).Value);
} else if (right is ExtensibleFloat) {
return FloatOps.Add((Double)leftInt16, (Double)((ExtensibleFloat)right).value);
} else if (right is ExtensibleComplex) {
return ComplexOps.Add(leftInt16, ((ExtensibleComplex)right).value);
}
return Ops.NotImplemented;
}
[PythonName("__div__")]
public static object Divide(object left, object right) {
if (!(left is Int16)) {
throw Ops.TypeError("'__div__' requires Int16, but received {0}", Ops.GetDynamicType(left).__name__);
}
Int16 leftInt16 = (Int16)left;
IConvertible rightConvertible;
if ((rightConvertible = right as IConvertible) != null) {
switch (rightConvertible.GetTypeCode()) {
case TypeCode.Boolean: {
return Int16Ops.DivideImpl((Int16)leftInt16, (Int16)((Boolean)right ? (Int16)1 : (Int16)0));
}
case TypeCode.Byte: {
return Int16Ops.DivideImpl((Int16)leftInt16, (Int16)(Byte)right);
}
case TypeCode.SByte: {
return Int16Ops.DivideImpl((Int16)leftInt16, (Int16)(SByte)right);
}
case TypeCode.Int16: {
return Int16Ops.DivideImpl((Int16)leftInt16, (Int16)(Int16)right);
}
case TypeCode.UInt16: {
return IntOps.Divide((Int32)leftInt16, (Int32)(UInt16)right);
}
case TypeCode.Int32: {
return IntOps.Divide((Int32)leftInt16, (Int32)(Int32)right);
}
case TypeCode.UInt32: {
return Int64Ops.Divide((Int64)leftInt16, (Int64)(UInt32)right);
}
case TypeCode.Int64: {
return Int64Ops.Divide((Int64)leftInt16, (Int64)(Int64)right);
}
case TypeCode.UInt64: {
return UInt64Ops.DivideImpl(leftInt16, (UInt64)right);
}
case TypeCode.Single: {
return SingleOps.DivideImpl((Single)leftInt16, (Single)(Single)right);
}
case TypeCode.Double: {
return FloatOps.Divide((Double)leftInt16, (Double)(Double)right);
}
}
}
if (right is BigInteger) {
return LongOps.Divide(leftInt16, (BigInteger)right);
} else if (right is Complex64) {
return ComplexOps.Divide(leftInt16, (Complex64)right);
} else if (right is ExtensibleInt) {
return IntOps.Divide((Int32)leftInt16, (Int32)((ExtensibleInt)right).value);
} else if (right is ExtensibleLong) {
return LongOps.Divide(leftInt16, ((ExtensibleLong)right).Value);
} else if (right is ExtensibleFloat) {
return FloatOps.Divide((Double)leftInt16, (Double)((ExtensibleFloat)right).value);
} else if (right is ExtensibleComplex) {
return ComplexOps.Divide(leftInt16, ((ExtensibleComplex)right).value);
}
return Ops.NotImplemented;
}
[PythonName("__floordiv__")]
public static object FloorDivide(object left, object right) {
if (!(left is Int16)) {
throw Ops.TypeError("'__floordiv__' requires Int16, but received {0}", Ops.GetDynamicType(left).__name__);
}
Int16 leftInt16 = (Int16)left;
IConvertible rightConvertible;
if ((rightConvertible = right as IConvertible) != null) {
switch (rightConvertible.GetTypeCode()) {
case TypeCode.Boolean: {
return Int16Ops.FloorDivideImpl((Int16)leftInt16, (Int16)((Boolean)right ? (Int16)1 : (Int16)0));
}
case TypeCode.Byte: {
return Int16Ops.FloorDivideImpl((Int16)leftInt16, (Int16)(Byte)right);
}
case TypeCode.SByte: {
return Int16Ops.FloorDivideImpl((Int16)leftInt16, (Int16)(SByte)right);
}
case TypeCode.Int16: {
return Int16Ops.FloorDivideImpl((Int16)leftInt16, (Int16)(Int16)right);
}
case TypeCode.UInt16: {
return IntOps.FloorDivide((Int32)leftInt16, (Int32)(UInt16)right);
}
case TypeCode.Int32: {
return IntOps.FloorDivide((Int32)leftInt16, (Int32)(Int32)right);
}
case TypeCode.UInt32: {
return Int64Ops.FloorDivide((Int64)leftInt16, (Int64)(UInt32)right);
}
case TypeCode.Int64: {
return Int64Ops.FloorDivide((Int64)leftInt16, (Int64)(Int64)right);
}
case TypeCode.UInt64: {
return UInt64Ops.FloorDivideImpl(leftInt16, (UInt64)right);
}
case TypeCode.Single: {
return SingleOps.FloorDivideImpl((Single)leftInt16, (Single)(Single)right);
}
case TypeCode.Double: {
return FloatOps.FloorDivide((Double)leftInt16, (Double)(Double)right);
}
}
}
if (right is BigInteger) {
return LongOps.FloorDivide(leftInt16, (BigInteger)right);
} else if (right is Complex64) {
return ComplexOps.FloorDivide(leftInt16, (Complex64)right);
} else if (right is ExtensibleInt) {
return IntOps.FloorDivide((Int32)leftInt16, (Int32)((ExtensibleInt)right).value);
} else if (right is ExtensibleLong) {
return LongOps.FloorDivide(leftInt16, ((ExtensibleLong)right).Value);
} else if (right is ExtensibleFloat) {
return FloatOps.FloorDivide((Double)leftInt16, (Double)((ExtensibleFloat)right).value);
} else if (right is ExtensibleComplex) {
return ComplexOps.FloorDivide(leftInt16, ((ExtensibleComplex)right).value);
}
return Ops.NotImplemented;
}
Project:DICommander
File:SByteOps.Generated.cs
Examples:6
public static DynamicType MakeDynamicType() {
if (SByteType == null) {
OpsReflectedType ort = new OpsReflectedType("SByte", typeof(SByte), typeof(SByteOps), null);
if (Interlocked.CompareExchange<ReflectedType>(ref SByteType, ort, null) == null) {
return ort;
}
}
return SByteType;
}
[PythonName("__new__")]
public static object Make(DynamicType cls) {
return Make(cls, default(SByte));
}
[PythonName("__new__")]
public static object Make(DynamicType cls, object value) {
if (cls != SByteType) {
throw Ops.TypeError("SByte.__new__: first argument must be SByte type.");
}
IConvertible valueConvertible;
if ((valueConvertible = value as IConvertible) != null) {
switch (valueConvertible.GetTypeCode()) {
case TypeCode.Byte: return (SByte)(Byte)value;
case TypeCode.SByte: return (SByte)(SByte)value;
case TypeCode.Int16: return (SByte)(Int16)value;
case TypeCode.UInt16: return (SByte)(UInt16)value;
case TypeCode.Int32: return (SByte)(Int32)value;
case TypeCode.UInt32: return (SByte)(UInt32)value;
case TypeCode.Int64: return (SByte)(Int64)value;
case TypeCode.UInt64: return (SByte)(UInt64)value;
case TypeCode.Single: return (SByte)(Single)value;
case TypeCode.Double: return (SByte)(Double)value;
}
}
if (value is String) {
return SByte.Parse((String)value);
} else if (value is BigInteger) {
return (SByte)(BigInteger)value;
} else if (value is ExtensibleInt) {
return (SByte)((ExtensibleInt)value).value;
} else if (value is ExtensibleLong) {
return (SByte)((ExtensibleLong)value).Value;
} else if (value is ExtensibleFloat) {
return (SByte)((ExtensibleFloat)value).value;
} else if (value is Enum) {
return Converter.CastEnumToSByte(value);
}
throw Ops.ValueError("invalid value for SByte.__new__");
}
[PythonName("__add__")]
public static object Add(object left, object right) {
if (!(left is SByte)) {
throw Ops.TypeError("'__add__' requires SByte, but received {0}", Ops.GetDynamicType(left).__name__);
}
SByte leftSByte = (SByte)left;
IConvertible rightConvertible;
if ((rightConvertible = right as IConvertible) != null) {
switch (rightConvertible.GetTypeCode()) {
case TypeCode.Boolean: {
Int16 result = (Int16)(((Int16)leftSByte) + ((Int16)((Boolean)right ? (SByte)1 : (SByte)0)));
if (SByte.MinValue <= result && result <= SByte.MaxValue) {
return (SByte)result;
} else return result;
}
case TypeCode.Byte: {
Int16 result = (Int16)(((Int16)leftSByte) + ((Int16)(Byte)right));
if (SByte.MinValue <= result && result <= SByte.MaxValue) {
return (SByte)result;
} else return result;
}
case TypeCode.SByte: {
Int16 result = (Int16)(((Int16)leftSByte) + ((Int16)(SByte)right));
if (SByte.MinValue <= result && result <= SByte.MaxValue) {
return (SByte)result;
} else return result;
}
case TypeCode.Int16: {
Int32 result = (Int32)(((Int32)leftSByte) + ((Int32)(Int16)right));
if (Int16.MinValue <= result && result <= Int16.MaxValue) {
return (Int16)result;
} else return result;
}
case TypeCode.UInt16: {
Int32 result = (Int32)(((Int32)leftSByte) + ((Int32)(UInt16)right));
if (SByte.MinValue <= result && result <= SByte.MaxValue) {
return (SByte)result;
} else return result;
}
case TypeCode.Int32: {
Int64 result = (Int64)(((Int64)leftSByte) + ((Int64)(Int32)right));
if (Int32.MinValue <= result && result <= Int32.MaxValue) {
return (Int32)result;
} else return result;
}
case TypeCode.UInt32: {
Int64 result = (Int64)(((Int64)leftSByte) + ((Int64)(UInt32)right));
if (SByte.MinValue <= result && result <= SByte.MaxValue) {
return (SByte)result;
} else return result;
}
case TypeCode.Int64: {
return Int64Ops.Add(leftSByte, (Int64)right);
}
case TypeCode.UInt64: {
return UInt64Ops.AddImpl(leftSByte, (UInt64)right);
}
case TypeCode.Single: {
return SingleOps.AddImpl((Single)leftSByte, (Single)(Single)right);
}
case TypeCode.Double: {
return FloatOps.Add((Double)leftSByte, (Double)(Double)right);
}
}
}
if (right is BigInteger) {
return LongOps.Add(leftSByte, (BigInteger)right);
} else if (right is Complex64) {
return ComplexOps.Add(leftSByte, (Complex64)right);
} else if (right is ExtensibleInt) {
Int64 result = (Int64)(((Int64)leftSByte) + ((Int64)((ExtensibleInt)right).value));
if (Int32.MinValue <= result && result <= Int32.MaxValue) {
return (Int32)result;
} else return result;
} else if (right is ExtensibleLong) {
return LongOps.Add(leftSByte, ((ExtensibleLong)right).Value);
} else if (right is ExtensibleFloat) {
return FloatOps.Add((Double)leftSByte, (Double)((ExtensibleFloat)right).value);
} else if (right is ExtensibleComplex) {
return ComplexOps.Add(leftSByte, ((ExtensibleComplex)right).value);
}
return Ops.NotImplemented;
}
[PythonName("__div__")]
public static object Divide(object left, object right) {
if (!(left is SByte)) {
throw Ops.TypeError("'__div__' requires SByte, but received {0}", Ops.GetDynamicType(left).__name__);
}
SByte leftSByte = (SByte)left;
IConvertible rightConvertible;
if ((rightConvertible = right as IConvertible) != null) {
switch (rightConvertible.GetTypeCode()) {
case TypeCode.Boolean: {
return SByteOps.DivideImpl((SByte)leftSByte, (SByte)((Boolean)right ? (SByte)1 : (SByte)0));
}
case TypeCode.Byte: {
return Int16Ops.DivideImpl((Int16)leftSByte, (Int16)(Byte)right);
}
case TypeCode.SByte: {
return SByteOps.DivideImpl((SByte)leftSByte, (SByte)(SByte)right);
}
case TypeCode.Int16: {
return Int16Ops.DivideImpl((Int16)leftSByte, (Int16)(Int16)right);
}
case TypeCode.UInt16: {
return IntOps.Divide((Int32)leftSByte, (Int32)(UInt16)right);
}
case TypeCode.Int32: {
return IntOps.Divide((Int32)leftSByte, (Int32)(Int32)right);
}
case TypeCode.UInt32: {
return Int64Ops.Divide((Int64)leftSByte, (Int64)(UInt32)right);
}
case TypeCode.Int64: {
return Int64Ops.Divide((Int64)leftSByte, (Int64)(Int64)right);
}
case TypeCode.UInt64: {
return UInt64Ops.DivideImpl(leftSByte, (UInt64)right);
}
case TypeCode.Single: {
return SingleOps.DivideImpl((Single)leftSByte, (Single)(Single)right);
}
case TypeCode.Double: {
return FloatOps.Divide((Double)leftSByte, (Double)(Double)right);
}
}
}
if (right is BigInteger) {
return LongOps.Divide(leftSByte, (BigInteger)right);
} else if (right is Complex64) {
return ComplexOps.Divide(leftSByte, (Complex64)right);
} else if (right is ExtensibleInt) {
return IntOps.Divide((Int32)leftSByte, (Int32)((ExtensibleInt)right).value);
} else if (right is ExtensibleLong) {
return LongOps.Divide(leftSByte, ((ExtensibleLong)right).Value);
} else if (right is ExtensibleFloat) {
return FloatOps.Divide((Double)leftSByte, (Double)((ExtensibleFloat)right).value);
} else if (right is ExtensibleComplex) {
return ComplexOps.Divide(leftSByte, ((ExtensibleComplex)right).value);
}
return Ops.NotImplemented;
}
[PythonName("__floordiv__")]
public static object FloorDivide(object left, object right) {
if (!(left is SByte)) {
throw Ops.TypeError("'__floordiv__' requires SByte, but received {0}", Ops.GetDynamicType(left).__name__);
}
SByte leftSByte = (SByte)left;
IConvertible rightConvertible;
if ((rightConvertible = right as IConvertible) != null) {
switch (rightConvertible.GetTypeCode()) {
case TypeCode.Boolean: {
return SByteOps.FloorDivideImpl((SByte)leftSByte, (SByte)((Boolean)right ? (SByte)1 : (SByte)0));
}
case TypeCode.Byte: {
return Int16Ops.FloorDivideImpl((Int16)leftSByte, (Int16)(Byte)right);
}
case TypeCode.SByte: {
return SByteOps.FloorDivideImpl((SByte)leftSByte, (SByte)(SByte)right);
}
case TypeCode.Int16: {
return Int16Ops.FloorDivideImpl((Int16)leftSByte, (Int16)(Int16)right);
}
case TypeCode.UInt16: {
return IntOps.FloorDivide((Int32)leftSByte, (Int32)(UInt16)right);
}
case TypeCode.Int32: {
return IntOps.FloorDivide((Int32)leftSByte, (Int32)(Int32)right);
}
case TypeCode.UInt32: {
return Int64Ops.FloorDivide((Int64)leftSByte, (Int64)(UInt32)right);
}
case TypeCode.Int64: {
return Int64Ops.FloorDivide((Int64)leftSByte, (Int64)(Int64)right);
}
case TypeCode.UInt64: {
return UInt64Ops.FloorDivideImpl(leftSByte, (UInt64)right);
}
case TypeCode.Single: {
return SingleOps.FloorDivideImpl((Single)leftSByte, (Single)(Single)right);
}
case TypeCode.Double: {
return FloatOps.FloorDivide((Double)leftSByte, (Double)(Double)right);
}
}
}
if (right is BigInteger) {
return LongOps.FloorDivide(leftSByte, (BigInteger)right);
} else if (right is Complex64) {
return ComplexOps.FloorDivide(leftSByte, (Complex64)right);
} else if (right is ExtensibleInt) {
return IntOps.FloorDivide((Int32)leftSByte, (Int32)((ExtensibleInt)right).value);
} else if (right is ExtensibleLong) {
return LongOps.FloorDivide(leftSByte, ((ExtensibleLong)right).Value);
} else if (right is ExtensibleFloat) {
return FloatOps.FloorDivide((Double)leftSByte, (Double)((ExtensibleFloat)right).value);
} else if (right is ExtensibleComplex) {
return ComplexOps.FloorDivide(leftSByte, ((ExtensibleComplex)right).value);
}
return Ops.NotImplemented;
}
Project:DICommander
File:ByteOps.Generated.cs
Examples:6
public static DynamicType MakeDynamicType() {
if (ByteType == null) {
OpsReflectedType ort = new OpsReflectedType("Byte", typeof(Byte), typeof(ByteOps), null);
if (Interlocked.CompareExchange<ReflectedType>(ref ByteType, ort, null) == null) {
return ort;
}
}
return ByteType;
}
[PythonName("__new__")]
public static object Make(DynamicType cls) {
return Make(cls, default(Byte));
}
[PythonName("__new__")]
public static object Make(DynamicType cls, object value) {
if (cls != ByteType) {
throw Ops.TypeError("Byte.__new__: first argument must be Byte type.");
}
IConvertible valueConvertible;
if ((valueConvertible = value as IConvertible) != null) {
switch (valueConvertible.GetTypeCode()) {
case TypeCode.Byte: return (Byte)(Byte)value;
case TypeCode.SByte: return (Byte)(SByte)value;
case TypeCode.Int16: return (Byte)(Int16)value;
case TypeCode.UInt16: return (Byte)(UInt16)value;
case TypeCode.Int32: return (Byte)(Int32)value;
case TypeCode.UInt32: return (Byte)(UInt32)value;
case TypeCode.Int64: return (Byte)(Int64)value;
case TypeCode.UInt64: return (Byte)(UInt64)value;
case TypeCode.Single: return (Byte)(Single)value;
case TypeCode.Double: return (Byte)(Double)value;
}
}
if (value is String) {
return Byte.Parse((String)value);
} else if (value is BigInteger) {
return (Byte)(BigInteger)value;
} else if (value is ExtensibleInt) {
return (Byte)((ExtensibleInt)value).value;
} else if (value is ExtensibleLong) {
return (Byte)((ExtensibleLong)value).Value;
} else if (value is ExtensibleFloat) {
return (Byte)((ExtensibleFloat)value).value;
} else if (value is Enum) {
return Converter.CastEnumToByte(value);
}
throw Ops.ValueError("invalid value for Byte.__new__");
}
[PythonName("__add__")]
public static object Add(object left, object right) {
if (!(left is Byte)) {
throw Ops.TypeError("'__add__' requires Byte, but received {0}", Ops.GetDynamicType(left).__name__);
}
Byte leftByte = (Byte)left;
IConvertible rightConvertible;
if ((rightConvertible = right as IConvertible) != null) {
switch (rightConvertible.GetTypeCode()) {
case TypeCode.Boolean: {
Int16 result = (Int16)(((Int16)leftByte) + ((Int16)((Boolean)right ? (Byte)1 : (Byte)0)));
if (Byte.MinValue <= result && result <= Byte.MaxValue) {
return (Byte)result;
} else return result;
}
case TypeCode.Byte: {
Int16 result = (Int16)(((Int16)leftByte) + ((Int16)(Byte)right));
if (Byte.MinValue <= result && result <= Byte.MaxValue) {
return (Byte)result;
} else return result;
}
case TypeCode.SByte: {
Int16 result = (Int16)(((Int16)leftByte) + ((Int16)(SByte)right));
if (Byte.MinValue <= result && result <= Byte.MaxValue) {
return (Byte)result;
} else return result;
}
case TypeCode.Int16: {
Int32 result = (Int32)(((Int32)leftByte) + ((Int32)(Int16)right));
if (Int16.MinValue <= result && result <= Int16.MaxValue) {
return (Int16)result;
} else return result;
}
case TypeCode.UInt16: {
Int32 result = (Int32)(((Int32)leftByte) + ((Int32)(UInt16)right));
if (UInt16.MinValue <= result && result <= UInt16.MaxValue) {
return (UInt16)result;
} else return result;
}
case TypeCode.Int32: {
Int64 result = (Int64)(((Int64)leftByte) + ((Int64)(Int32)right));
if (Int32.MinValue <= result && result <= Int32.MaxValue) {
return (Int32)result;
} else return result;
}
case TypeCode.UInt32: {
Int64 result = (Int64)(((Int64)leftByte) + ((Int64)(UInt32)right));
if (UInt32.MinValue <= result && result <= UInt32.MaxValue) {
return (UInt32)result;
} else return result;
}
case TypeCode.Int64: {
return Int64Ops.Add(leftByte, (Int64)right);
}
case TypeCode.UInt64: {
return UInt64Ops.AddImpl(leftByte, (UInt64)right);
}
case TypeCode.Single: {
return SingleOps.AddImpl((Single)leftByte, (Single)(Single)right);
}
case TypeCode.Double: {
return FloatOps.Add((Double)leftByte, (Double)(Double)right);
}
}
}
if (right is BigInteger) {
return LongOps.Add(leftByte, (BigInteger)right);
} else if (right is Complex64) {
return ComplexOps.Add(leftByte, (Complex64)right);
} else if (right is ExtensibleInt) {
Int64 result = (Int64)(((Int64)leftByte) + ((Int64)((ExtensibleInt)right).value));
if (Int32.MinValue <= result && result <= Int32.MaxValue) {
return (Int32)result;
} else return result;
} else if (right is ExtensibleLong) {
return LongOps.Add(leftByte, ((ExtensibleLong)right).Value);
} else if (right is ExtensibleFloat) {
return FloatOps.Add((Double)leftByte, (Double)((ExtensibleFloat)right).value);
} else if (right is ExtensibleComplex) {
return ComplexOps.Add(leftByte, ((ExtensibleComplex)right).value);
}
return Ops.NotImplemented;
}
[PythonName("__div__")]
public static object Divide(object left, object right) {
if (!(left is Byte)) {
throw Ops.TypeError("'__div__' requires Byte, but received {0}", Ops.GetDynamicType(left).__name__);
}
Byte leftByte = (Byte)left;
IConvertible rightConvertible;
if ((rightConvertible = right as IConvertible) != null) {
switch (rightConvertible.GetTypeCode()) {
case TypeCode.Boolean: {
return ByteOps.DivideImpl((Byte)leftByte, (Byte)((Boolean)right ? (Byte)1 : (Byte)0));
}
case TypeCode.Byte: {
return ByteOps.DivideImpl((Byte)leftByte, (Byte)(Byte)right);
}
case TypeCode.SByte: {
return Int16Ops.DivideImpl((Int16)leftByte, (Int16)(SByte)right);
}
case TypeCode.Int16: {
return Int16Ops.DivideImpl((Int16)leftByte, (Int16)(Int16)right);
}
case TypeCode.UInt16: {
return UInt16Ops.DivideImpl((UInt16)leftByte, (UInt16)(UInt16)right);
}
case TypeCode.Int32: {
return IntOps.Divide((Int32)leftByte, (Int32)(Int32)right);
}
case TypeCode.UInt32: {
return UInt32Ops.DivideImpl((UInt32)leftByte, (UInt32)(UInt32)right);
}
case TypeCode.Int64: {
return Int64Ops.Divide((Int64)leftByte, (Int64)(Int64)right);
}
case TypeCode.UInt64: {
return UInt64Ops.DivideImpl((UInt64)leftByte, (UInt64)(UInt64)right);
}
case TypeCode.Single: {
return SingleOps.DivideImpl((Single)leftByte, (Single)(Single)right);
}
case TypeCode.Double: {
return FloatOps.Divide((Double)leftByte, (Double)(Double)right);
}
}
}
if (right is BigInteger) {
return LongOps.Divide(leftByte, (BigInteger)right);
} else if (right is Complex64) {
return ComplexOps.Divide(leftByte, (Complex64)right);
} else if (right is ExtensibleInt) {
return IntOps.Divide((Int32)leftByte, (Int32)((ExtensibleInt)right).value);
} else if (right is ExtensibleLong) {
return LongOps.Divide(leftByte, ((ExtensibleLong)right).Value);
} else if (right is ExtensibleFloat) {
return FloatOps.Divide((Double)leftByte, (Double)((ExtensibleFloat)right).value);
} else if (right is ExtensibleComplex) {
return ComplexOps.Divide(leftByte, ((ExtensibleComplex)right).value);
}
return Ops.NotImplemented;
}
[PythonName("__floordiv__")]
public static object FloorDivide(object left, object right) {
if (!(left is Byte)) {
throw Ops.TypeError("'__floordiv__' requires Byte, but received {0}", Ops.GetDynamicType(left).__name__);
}
Byte leftByte = (Byte)left;
IConvertible rightConvertible;
if ((rightConvertible = right as IConvertible) != null) {
switch (rightConvertible.GetTypeCode()) {
case TypeCode.Boolean: {
return ByteOps.FloorDivideImpl((Byte)leftByte, (Byte)((Boolean)right ? (Byte)1 : (Byte)0));
}
case TypeCode.Byte: {
return ByteOps.FloorDivideImpl((Byte)leftByte, (Byte)(Byte)right);
}
case TypeCode.SByte: {
return Int16Ops.FloorDivideImpl((Int16)leftByte, (Int16)(SByte)right);
}
case TypeCode.Int16: {
return Int16Ops.FloorDivideImpl((Int16)leftByte, (Int16)(Int16)right);
}
case TypeCode.UInt16: {
return UInt16Ops.FloorDivideImpl((UInt16)leftByte, (UInt16)(UInt16)right);
}
case TypeCode.Int32: {
return IntOps.FloorDivide((Int32)leftByte, (Int32)(Int32)right);
}
case TypeCode.UInt32: {
return UInt32Ops.FloorDivideImpl((UInt32)leftByte, (UInt32)(UInt32)right);
}
case TypeCode.Int64: {
return Int64Ops.FloorDivide((Int64)leftByte, (Int64)(Int64)right);
}
case TypeCode.UInt64: {
return UInt64Ops.FloorDivideImpl((UInt64)leftByte, (UInt64)(UInt64)right);
}
case TypeCode.Single: {
return SingleOps.FloorDivideImpl((Single)leftByte, (Single)(Single)right);
}
case TypeCode.Double: {
return FloatOps.FloorDivide((Double)leftByte, (Double)(Double)right);
}
}
}
if (right is BigInteger) {
return LongOps.FloorDivide(leftByte, (BigInteger)right);
} else if (right is Complex64) {
return ComplexOps.FloorDivide(leftByte, (Complex64)right);
} else if (right is ExtensibleInt) {
return IntOps.FloorDivide((Int32)leftByte, (Int32)((ExtensibleInt)right).value);
} else if (right is ExtensibleLong) {
return LongOps.FloorDivide(leftByte, ((ExtensibleLong)right).Value);
} else if (right is ExtensibleFloat) {
return FloatOps.FloorDivide((Double)leftByte, (Double)((ExtensibleFloat)right).value);
} else if (right is ExtensibleComplex) {
return ComplexOps.FloorDivide(leftByte, ((ExtensibleComplex)right).value);
}
return Ops.NotImplemented;
}
Project:DICommander
File:UInt32Ops.Generated.cs
Examples:6
public static DynamicType MakeDynamicType() {
if (UInt32Type == null) {
OpsReflectedType ort = new OpsReflectedType("UInt32", typeof(UInt32), typeof(UInt32Ops), null);
if (Interlocked.CompareExchange<ReflectedType>(ref UInt32Type, ort, null) == null) {
return ort;
}
}
return UInt32Type;
}
[PythonName("__new__")]
public static object Make(DynamicType cls) {
return Make(cls, default(UInt32));
}
[PythonName("__new__")]
public static object Make(DynamicType cls, object value) {
if (cls != UInt32Type) {
throw Ops.TypeError("UInt32.__new__: first argument must be UInt32 type.");
}
IConvertible valueConvertible;
if ((valueConvertible = value as IConvertible) != null) {
switch (valueConvertible.GetTypeCode()) {
case TypeCode.Byte: return (UInt32)(Byte)value;
case TypeCode.SByte: return (UInt32)(SByte)value;
case TypeCode.Int16: return (UInt32)(Int16)value;
case TypeCode.UInt16: return (UInt32)(UInt16)value;
case TypeCode.Int32: return (UInt32)(Int32)value;
case TypeCode.UInt32: return (UInt32)(UInt32)value;
case TypeCode.Int64: return (UInt32)(Int64)value;
case TypeCode.UInt64: return (UInt32)(UInt64)value;
case TypeCode.Single: return (UInt32)(Single)value;
case TypeCode.Double: return (UInt32)(Double)value;
}
}
if (value is String) {
return UInt32.Parse((String)value);
} else if (value is BigInteger) {
return (UInt32)(BigInteger)value;
} else if (value is ExtensibleInt) {
return (UInt32)((ExtensibleInt)value).value;
} else if (value is ExtensibleLong) {
return (UInt32)((ExtensibleLong)value).Value;
} else if (value is ExtensibleFloat) {
return (UInt32)((ExtensibleFloat)value).value;
} else if (value is Enum) {
return Converter.CastEnumToUInt32(value);
}
throw Ops.ValueError("invalid value for UInt32.__new__");
}
[PythonName("__add__")]
public static object Add(object left, object right) {
if (!(left is UInt32)) {
throw Ops.TypeError("'__add__' requires UInt32, but received {0}", Ops.GetDynamicType(left).__name__);
}
UInt32 leftUInt32 = (UInt32)left;
IConvertible rightConvertible;
if ((rightConvertible = right as IConvertible) != null) {
switch (rightConvertible.GetTypeCode()) {
case TypeCode.Boolean: {
Int64 result = (Int64)(((Int64)leftUInt32) + ((Int64)((Boolean)right ? (UInt32)1 : (UInt32)0)));
if (UInt32.MinValue <= result && result <= UInt32.MaxValue) {
return (UInt32)result;
} else return result;
}
case TypeCode.Byte: {
Int64 result = (Int64)(((Int64)leftUInt32) + ((Int64)(Byte)right));
if (UInt32.MinValue <= result && result <= UInt32.MaxValue) {
return (UInt32)result;
} else return result;
}
case TypeCode.SByte: {
Int64 result = (Int64)(((Int64)leftUInt32) + ((Int64)(SByte)right));
if (UInt32.MinValue <= result && result <= UInt32.MaxValue) {
return (UInt32)result;
} else return result;
}
case TypeCode.Int16: {
Int64 result = (Int64)(((Int64)leftUInt32) + ((Int64)(Int16)right));
if (UInt32.MinValue <= result && result <= UInt32.MaxValue) {
return (UInt32)result;
} else return result;
}
case TypeCode.UInt16: {
Int64 result = (Int64)(((Int64)leftUInt32) + ((Int64)(UInt16)right));
if (UInt32.MinValue <= result && result <= UInt32.MaxValue) {
return (UInt32)result;
} else return result;
}
case TypeCode.Int32: {
Int64 result = (Int64)(((Int64)leftUInt32) + ((Int64)(Int32)right));
if (UInt32.MinValue <= result && result <= UInt32.MaxValue) {
return (UInt32)result;
} else return result;
}
case TypeCode.UInt32: {
Int64 result = (Int64)(((Int64)leftUInt32) + ((Int64)(UInt32)right));
if (UInt32.MinValue <= result && result <= UInt32.MaxValue) {
return (UInt32)result;
} else return result;
}
case TypeCode.Int64: {
return Int64Ops.Add(leftUInt32, (Int64)right);
}
case TypeCode.UInt64: {
return UInt64Ops.AddImpl(leftUInt32, (UInt64)right);
}
case TypeCode.Single: {
return SingleOps.AddImpl((Single)leftUInt32, (Single)(Single)right);
}
case TypeCode.Double: {
return FloatOps.Add((Double)leftUInt32, (Double)(Double)right);
}
}
}
if (right is BigInteger) {
return LongOps.Add(leftUInt32, (BigInteger)right);
} else if (right is Complex64) {
return ComplexOps.Add(leftUInt32, (Complex64)right);
} else if (right is ExtensibleInt) {
Int64 result = (Int64)(((Int64)leftUInt32) + ((Int64)((ExtensibleInt)right).value));
if (UInt32.MinValue <= result && result <= UInt32.MaxValue) {
return (UInt32)result;
} else return result;
} else if (right is ExtensibleLong) {
return LongOps.Add(leftUInt32, ((ExtensibleLong)right).Value);
} else if (right is ExtensibleFloat) {
return FloatOps.Add((Double)leftUInt32, (Double)((ExtensibleFloat)right).value);
} else if (right is ExtensibleComplex) {
return ComplexOps.Add(leftUInt32, ((ExtensibleComplex)right).value);
}
return Ops.NotImplemented;
}
[PythonName("__div__")]
public static object Divide(object left, object right) {
if (!(left is UInt32)) {
throw Ops.TypeError("'__div__' requires UInt32, but received {0}", Ops.GetDynamicType(left).__name__);
}
UInt32 leftUInt32 = (UInt32)left;
IConvertible rightConvertible;
if ((rightConvertible = right as IConvertible) != null) {
switch (rightConvertible.GetTypeCode()) {
case TypeCode.Boolean: {
return UInt32Ops.DivideImpl((UInt32)leftUInt32, (UInt32)((Boolean)right ? (UInt32)1 : (UInt32)0));
}
case TypeCode.Byte: {
return UInt32Ops.DivideImpl((UInt32)leftUInt32, (UInt32)(Byte)right);
}
case TypeCode.SByte: {
return Int64Ops.Divide((Int64)leftUInt32, (Int64)(SByte)right);
}
case TypeCode.Int16: {
return Int64Ops.Divide((Int64)leftUInt32, (Int64)(Int16)right);
}
case TypeCode.UInt16: {
return UInt32Ops.DivideImpl((UInt32)leftUInt32, (UInt32)(UInt16)right);
}
case TypeCode.Int32: {
return Int64Ops.Divide((Int64)leftUInt32, (Int64)(Int32)right);
}
case TypeCode.UInt32: {
return UInt32Ops.DivideImpl((UInt32)leftUInt32, (UInt32)(UInt32)right);
}
case TypeCode.Int64: {
return Int64Ops.Divide((Int64)leftUInt32, (Int64)(Int64)right);
}
case TypeCode.UInt64: {
return UInt64Ops.DivideImpl((UInt64)leftUInt32, (UInt64)(UInt64)right);
}
case TypeCode.Single: {
return SingleOps.DivideImpl((Single)leftUInt32, (Single)(Single)right);
}
case TypeCode.Double: {
return FloatOps.Divide((Double)leftUInt32, (Double)(Double)right);
}
}
}
if (right is BigInteger) {
return LongOps.Divide(leftUInt32, (BigInteger)right);
} else if (right is Complex64) {
return ComplexOps.Divide(leftUInt32, (Complex64)right);
} else if (right is ExtensibleInt) {
return Int64Ops.Divide((Int64)leftUInt32, (Int64)((ExtensibleInt)right).value);
} else if (right is ExtensibleLong) {
return LongOps.Divide(leftUInt32, ((ExtensibleLong)right).Value);
} else if (right is ExtensibleFloat) {
return FloatOps.Divide((Double)leftUInt32, (Double)((ExtensibleFloat)right).value);
} else if (right is ExtensibleComplex) {
return ComplexOps.Divide(leftUInt32, ((ExtensibleComplex)right).value);
}
return Ops.NotImplemented;
}
[PythonName("__floordiv__")]
public static object FloorDivide(object left, object right) {
if (!(left is UInt32)) {
throw Ops.TypeError("'__floordiv__' requires UInt32, but received {0}", Ops.GetDynamicType(left).__name__);
}
UInt32 leftUInt32 = (UInt32)left;
IConvertible rightConvertible;
if ((rightConvertible = right as IConvertible) != null) {
switch (rightConvertible.GetTypeCode()) {
case TypeCode.Boolean: {
return UInt32Ops.FloorDivideImpl((UInt32)leftUInt32, (UInt32)((Boolean)right ? (UInt32)1 : (UInt32)0));
}
case TypeCode.Byte: {
return UInt32Ops.FloorDivideImpl((UInt32)leftUInt32, (UInt32)(Byte)right);
}
case TypeCode.SByte: {
return Int64Ops.FloorDivide((Int64)leftUInt32, (Int64)(SByte)right);
}
case TypeCode.Int16: {
return Int64Ops.FloorDivide((Int64)leftUInt32, (Int64)(Int16)right);
}
case TypeCode.UInt16: {
return UInt32Ops.FloorDivideImpl((UInt32)leftUInt32, (UInt32)(UInt16)right);
}
case TypeCode.Int32: {
return Int64Ops.FloorDivide((Int64)leftUInt32, (Int64)(Int32)right);
}
case TypeCode.UInt32: {
return UInt32Ops.FloorDivideImpl((UInt32)leftUInt32, (UInt32)(UInt32)right);
}
case TypeCode.Int64: {
return Int64Ops.FloorDivide((Int64)leftUInt32, (Int64)(Int64)right);
}
case TypeCode.UInt64: {
return UInt64Ops.FloorDivideImpl((UInt64)leftUInt32, (UInt64)(UInt64)right);
}
case TypeCode.Single: {
return SingleOps.FloorDivideImpl((Single)leftUInt32, (Single)(Single)right);
}
case TypeCode.Double: {
return FloatOps.FloorDivide((Double)leftUInt32, (Double)(Double)right);
}
}
}
if (right is BigInteger) {
return LongOps.FloorDivide(leftUInt32, (BigInteger)right);
} else if (right is Complex64) {
return ComplexOps.FloorDivide(leftUInt32, (Complex64)right);
} else if (right is ExtensibleInt) {
return Int64Ops.FloorDivide((Int64)leftUInt32, (Int64)((ExtensibleInt)right).value);
} else if (right is ExtensibleLong) {
return LongOps.FloorDivide(leftUInt32, ((ExtensibleLong)right).Value);
} else if (right is ExtensibleFloat) {
return FloatOps.FloorDivide((Double)leftUInt32, (Double)((ExtensibleFloat)right).value);
} else if (right is ExtensibleComplex) {
return ComplexOps.FloorDivide(leftUInt32, ((ExtensibleComplex)right).value);
}
return Ops.NotImplemented;
}
Project:ironruby
File:ClrInteger.Generated.cs
Examples:6
[RubyMethod("size")]
public static int Size(Byte self) {
return sizeof(Byte);
}
[RubyConstructor]
[RubyMethod("induced_from", RubyMethodAttributes.PublicSingleton)]
public static Byte InducedFrom(RubyClass/*!*/ self, [DefaultProtocol]int value) {
if (value >= Byte.MinValue && value <= Byte.MaxValue) {
return (Byte)value;
}
throw RubyExceptions.CreateRangeError("Integer {0} out of range of {1}", value, self.Name);
}
[RubyConstructor]
[RubyMethod("induced_from", RubyMethodAttributes.PublicSingleton)]
public static Byte InducedFrom(RubyClass/*!*/ self, [NotNull]BigInteger/*!*/ value) {
if (value >= Byte.MinValue && value <= Byte.MaxValue) {
return (Byte)value;
}
throw RubyExceptions.CreateRangeError("Integer {0} out of range of {1}", value, self.Name);
}
[RubyConstructor]
[RubyMethod("induced_from", RubyMethodAttributes.PublicSingleton)]
public static Byte InducedFrom(RubyClass/*!*/ self, double value) {
if (value >= Byte.MinValue && value <= Byte.MaxValue) {
return (Byte)value;
}
throw RubyExceptions.CreateRangeError("Float {0} out of range of {1}", value, self.Name);
}
[RubyMethod("inspect")]
public static MutableString/*!*/ Inspect(object/*!*/ self) {
return MutableString.CreateMutable(RubyEncoding.Binary).Append(self.ToString()).Append(" (Byte)");
}
[RubyMethod("succ")]
[RubyMethod("next")]
public static object Next(Byte self) {
if (self == Byte.MaxValue) {
return (Int32)self + 1;
}
return (Byte)(self + 1);
}
Project:IronRuby_Framework_4.7.2
File:ClrInteger.Generated.cs
Examples:6
[RubyMethod("size")]
public static int Size(Byte self) {
return sizeof(Byte);
}
[RubyConstructor]
[RubyMethod("induced_from", RubyMethodAttributes.PublicSingleton)]
public static Byte InducedFrom(RubyClass/*!*/ self, [DefaultProtocol]int value) {
if (value >= Byte.MinValue && value <= Byte.MaxValue) {
return (Byte)value;
}
throw RubyExceptions.CreateRangeError("Integer {0} out of range of {1}", value, self.Name);
}
[RubyConstructor]
[RubyMethod("induced_from", RubyMethodAttributes.PublicSingleton)]
public static Byte InducedFrom(RubyClass/*!*/ self, [NotNull]BigInteger/*!*/ value) {
if (value >= Byte.MinValue && value <= Byte.MaxValue) {
return (Byte)value;
}
throw RubyExceptions.CreateRangeError("Integer {0} out of range of {1}", value, self.Name);
}
[RubyConstructor]
[RubyMethod("induced_from", RubyMethodAttributes.PublicSingleton)]
public static Byte InducedFrom(RubyClass/*!*/ self, double value) {
if (value >= Byte.MinValue && value <= Byte.MaxValue) {
return (Byte)value;
}
throw RubyExceptions.CreateRangeError("Float {0} out of range of {1}", value, self.Name);
}
[RubyMethod("inspect")]
public static MutableString/*!*/ Inspect(object/*!*/ self) {
return MutableString.CreateMutable(RubyEncoding.Binary).Append(self.ToString()).Append(" (Byte)");
}
[RubyMethod("succ")]
[RubyMethod("next")]
public static object Next(Byte self) {
if (self == Byte.MaxValue) {
return (Int32)self + 1;
}
return (Byte)(self + 1);
}
Project:IronSP
File:ClrInteger.Generated.cs
Examples:6
[RubyMethod("size")]
public static int Size(Byte self) {
return sizeof(Byte);
}
[RubyConstructor]
[RubyMethod("induced_from", RubyMethodAttributes.PublicSingleton)]
public static Byte InducedFrom(RubyClass/*!*/ self, [DefaultProtocol]int value) {
if (value >= Byte.MinValue && value <= Byte.MaxValue) {
return (Byte)value;
}
throw RubyExceptions.CreateRangeError("Integer {0} out of range of {1}", value, self.Name);
}
[RubyConstructor]
[RubyMethod("induced_from", RubyMethodAttributes.PublicSingleton)]
public static Byte InducedFrom(RubyClass/*!*/ self, [NotNull]BigInteger/*!*/ value) {
if (value >= Byte.MinValue && value <= Byte.MaxValue) {
return (Byte)value;
}
throw RubyExceptions.CreateRangeError("Integer {0} out of range of {1}", value, self.Name);
}
[RubyConstructor]
[RubyMethod("induced_from", RubyMethodAttributes.PublicSingleton)]
public static Byte InducedFrom(RubyClass/*!*/ self, double value) {
if (value >= Byte.MinValue && value <= Byte.MaxValue) {
return (Byte)value;
}
throw RubyExceptions.CreateRangeError("Float {0} out of range of {1}", value, self.Name);
}
[RubyMethod("inspect")]
public static MutableString/*!*/ Inspect(object/*!*/ self) {
return MutableString.CreateMutable(RubyEncoding.Binary).Append(self.ToString()).Append(" (Byte)");
}
[RubyMethod("succ")]
[RubyMethod("next")]
public static object Next(Byte self) {
if (self == Byte.MaxValue) {
return (Int32)self + 1;
}
return (Byte)(self + 1);
}
Project:debian-dlr-languages
File:ClrInteger.Generated.cs
Examples:6
[RubyMethod("size")]
public static int Size(Byte self) {
return sizeof(Byte);
}
[RubyConstructor]
[RubyMethod("induced_from", RubyMethodAttributes.PublicSingleton)]
public static Byte InducedFrom(RubyClass/*!*/ self, [DefaultProtocol]int value) {
if (value >= Byte.MinValue && value <= Byte.MaxValue) {
return (Byte)value;
}
throw RubyExceptions.CreateRangeError("Integer {0} out of range of {1}", value, self.Name);
}
[RubyConstructor]
[RubyMethod("induced_from", RubyMethodAttributes.PublicSingleton)]
public static Byte InducedFrom(RubyClass/*!*/ self, [NotNull]BigInteger/*!*/ value) {
if (value >= Byte.MinValue && value <= Byte.MaxValue) {
return (Byte)value;
}
throw RubyExceptions.CreateRangeError("Integer {0} out of range of {1}", value, self.Name);
}
[RubyConstructor]
[RubyMethod("induced_from", RubyMethodAttributes.PublicSingleton)]
public static Byte InducedFrom(RubyClass/*!*/ self, double value) {
if (value >= Byte.MinValue && value <= Byte.MaxValue) {
return (Byte)value;
}
throw RubyExceptions.CreateRangeError("Float {0} out of range of {1}", value, self.Name);
}
[RubyMethod("inspect")]
public static MutableString/*!*/ Inspect(object/*!*/ self) {
return MutableString.CreateMutable(RubyEncoding.Binary).Append(self.ToString()).Append(" (Byte)");
}
[RubyMethod("succ")]
[RubyMethod("next")]
public static object Next(Byte self) {
if (self == Byte.MaxValue) {
return (Int32)self + 1;
}
return (Byte)(self + 1);
}