2 #define NINT_JIT_OPTIMIZED
5 using System.Diagnostics;
6 using System.Globalization;
7 using System.Runtime.CompilerServices;
8 using System.Runtime.InteropServices;
11 public class BuiltinTests {
12 static int test_0_nint_ctor ()
14 var x = new nint (10);
16 var z = new nint (new nint (20));
26 static int test_0_nint_casts ()
42 static int test_0_nint_plus ()
51 static int test_0_nint_neg ()
60 static int test_0_nint_comp ()
70 static int test_0_nint_inc ()
79 static int test_0_nint_dec ()
89 static int test_0_nint_add ()
99 static int test_0_nint_sub ()
109 static int test_0_nint_mul ()
119 static int test_0_nint_div ()
129 static int test_0_nint_rem ()
139 static int test_0_nint_and ()
149 static int test_0_nint_or ()
159 static int test_0_nint_xor ()
169 static int test_0_nint_shl ()
178 static int test_0_nint_shr ()
187 static int test_0_nint_cmp_same_val ()
206 static int test_0_nint_cmp_small_val ()
225 static int test_0_nint_cmp_large_val ()
244 // static int test_0_nint_call_boxed_equals ()
246 // object x = new nint (10);
247 // object y = new nint (10);
248 // if (!x.Equals (y))
253 static int test_0_nint_call_boxed_funs ()
255 object x = new nint (10);
256 object y = new nint (10);
257 if (x.GetHashCode () == 0)
259 if (x.ToString () != "10")
264 public int test_0_nint_unboxed_member_calls ()
271 if (x != nint.Parse ("10"))
276 static int test_0_nuint_ctor ()
278 var x = new nuint (10u);
279 var y = new nuint (x);
280 var z = new nuint (new nuint (20u));
290 static int test_0_nuint_casts ()
306 static int test_0_nuint_plus ()
315 // static int test_0_nuint_neg ()
317 // var x = (nuint)10;
319 // if ((uint)z != -10)
324 static int test_0_nuint_comp ()
334 static int test_0_nuint_inc ()
343 static int test_0_nuint_dec ()
353 static int test_0_nuint_add ()
363 static int test_0_nuint_sub ()
373 static int test_0_nuint_mul ()
383 static int test_0_nuint_div ()
393 static int test_0_nuint_rem ()
403 static int test_0_nuint_and ()
413 static int test_0_nuint_or ()
423 static int test_0_nuint_xor ()
433 static int test_0_nuint_shl ()
442 static int test_0_nuint_shr ()
451 static int test_0_nuint_cmp_same_val ()
470 static int test_0_nuint_cmp_small_val ()
489 static int test_0_nuint_cmp_large_val ()
508 // static int test_0_nuint_call_boxed_equals ()
510 // object x = new nuint (10);
511 // object y = new nuint (10);
512 // if (!x.Equals (y))
517 static int test_0_nuint_call_boxed_funs ()
519 object x = new nuint (10u);
520 object y = new nuint (10u);
521 if (x.GetHashCode () == 0)
523 if (x.ToString () != "10")
528 public int test_0_nuint_unboxed_member_calls ()
535 if (x != nuint.Parse ("10"))
540 static int test_0_nfloat_ctor ()
542 var x = new nfloat (10.0f);
543 var y = new nfloat (x);
544 var z = new nfloat (new nfloat (20f));
554 static int test_0_nfloat_casts ()
572 static int test_0_nfloat_plus ()
581 static int test_0_nfloat_neg ()
585 if ((float)z != -10f)
591 static int test_0_nfloat_inc ()
595 if ((float)x != 11f) {
596 Console.WriteLine ((float)x);
602 static int test_0_nfloat_dec ()
606 if ((float)x != 9f) {
607 Console.WriteLine ((float)x);
614 static int test_0_nfloat_add ()
624 static int test_0_nfloat_sub ()
629 if ((float)z != -10f)
634 static int test_0_nfloat_mul ()
639 if ((float)z != 200f)
644 static int test_0_nfloat_div ()
654 static int test_0_nfloat_rem ()
664 static int test_0_nfloat_cmp_same_val ()
683 static int test_0_nfloat_cmp_small_val ()
702 static int test_0_nfloat_cmp_large_val ()
723 static int test_0_nfloat_cmp_left_nan ()
725 var x = (nfloat)float.NaN;
743 static int test_0_nfloat_cmp_right_nan ()
746 var y = (nfloat)float.NaN;
763 // static int test_0_nfloat_call_boxed_equals ()
765 // object x = new nfloat (10f);
766 // object y = new nfloat (10f);
767 // if (!x.Equals (y))
772 static int test_0_nfloat_call_boxed_funs ()
774 object x = new nfloat (10f);
775 object y = new nfloat (10f);
776 if (x.GetHashCode () == 0)
778 if (x.ToString () != "10")
783 public int test_0_nfloat_unboxed_member_calls ()
790 if (x != nfloat.Parse ("10"))
795 public static int Main (String[] args) {
796 return TestDriver.RunTests (typeof (BuiltinTests), args);
801 // !!! WARNING - GENERATED CODE - DO NOT EDIT !!!
803 // Generated by NativeTypes.tt, a T4 template.
805 // NativeTypes.cs: basic types with 32 or 64 bit sizes:
812 // Aaron Bockover <abock@xamarin.com>
814 // Copyright 2013 Xamarin, Inc. All rights reserved.
820 [DebuggerDisplay ("{v,nq}")]
821 public unsafe struct nint : IFormattable, IConvertible, IComparable, IComparable<nint>, IEquatable <nint>
823 internal nint (nint v) { this.v = v.v; }
824 public nint (Int32 v) { this.v = v; }
827 public static readonly int Size = 4;
829 public static readonly nint MaxValue = Int32.MaxValue;
830 public static readonly nint MinValue = Int32.MinValue;
832 [DebuggerBrowsable (DebuggerBrowsableState.Never)]
835 public nint (Int64 v) { this.v = (Int32)v; }
837 public static readonly int Size = 8;
839 public static readonly nint MaxValue = (nint) Int64.MaxValue; // 64-bit only codepath
840 public static readonly nint MinValue = (nint) Int64.MinValue; // 64-bit only codepath
842 [DebuggerBrowsable (DebuggerBrowsableState.Never)]
845 public nint (Int64 v) { this.v = v; }
848 public static explicit operator nint (nuint v)
850 #if NINT_JIT_OPTIMIZED
851 throw new NotImplementedException ();
853 return new nint ((int)v.v);
855 return new nint ((long)v.v);
859 public static explicit operator nuint (nint v)
861 #if NINT_JIT_OPTIMIZED
862 throw new NotImplementedException ();
864 return new nuint ((uint)v.v);
866 return new nuint ((ulong)v.v);
870 public static explicit operator nint (nfloat v)
872 #if NINT_JIT_OPTIMIZED
873 throw new NotImplementedException ();
875 return new nint ((int)v.v);
877 return new nint ((long)v.v);
881 public static implicit operator nfloat (nint v)
883 #if NINT_JIT_OPTIMIZED
884 throw new NotImplementedException ();
886 return new nfloat ((float)v.v);
888 return new nfloat ((double)v.v);
892 public static explicit operator nint (IntPtr v)
894 #if NINT_JIT_OPTIMIZED
895 throw new NotImplementedException ();
897 return new nint (*((int *)&v));
899 return new nint (*((long *)&v));
903 public static explicit operator IntPtr (nint v)
905 #if NINT_JIT_OPTIMIZED
906 throw new NotImplementedException ();
908 return *((IntPtr *)&v.v);
910 return *((IntPtr *)&v.v);
914 public static implicit operator nint (sbyte v)
916 #if NINT_JIT_OPTIMIZED
917 throw new NotImplementedException ();
919 return new nint ((int)v);
921 return new nint ((long)v);
925 public static explicit operator sbyte (nint v)
927 #if NINT_JIT_OPTIMIZED
928 throw new NotImplementedException ();
936 public static implicit operator nint (byte v)
938 #if NINT_JIT_OPTIMIZED
939 throw new NotImplementedException ();
941 return new nint ((int)v);
943 return new nint ((long)v);
947 public static explicit operator byte (nint v)
949 #if NINT_JIT_OPTIMIZED
950 throw new NotImplementedException ();
958 public static implicit operator nint (char v)
960 #if NINT_JIT_OPTIMIZED
961 throw new NotImplementedException ();
963 return new nint ((int)v);
965 return new nint ((long)v);
969 public static explicit operator char (nint v)
971 #if NINT_JIT_OPTIMIZED
972 throw new NotImplementedException ();
980 public static implicit operator nint (short v)
982 #if NINT_JIT_OPTIMIZED
983 throw new NotImplementedException ();
985 return new nint ((int)v);
987 return new nint ((long)v);
991 public static explicit operator short (nint v)
993 #if NINT_JIT_OPTIMIZED
994 throw new NotImplementedException ();
1002 public static explicit operator nint (ushort v)
1004 #if NINT_JIT_OPTIMIZED
1005 throw new NotImplementedException ();
1007 return new nint ((int)v);
1009 return new nint ((long)v);
1013 public static explicit operator ushort (nint v)
1015 #if NINT_JIT_OPTIMIZED
1016 throw new NotImplementedException ();
1024 public static implicit operator nint (int v)
1026 #if NINT_JIT_OPTIMIZED
1027 throw new NotImplementedException ();
1029 return new nint ((int)v);
1031 return new nint ((long)v);
1035 public static explicit operator int (nint v)
1037 #if NINT_JIT_OPTIMIZED
1038 throw new NotImplementedException ();
1046 public static explicit operator nint (uint v)
1048 #if NINT_JIT_OPTIMIZED
1049 throw new NotImplementedException ();
1051 return new nint ((int)v);
1053 return new nint ((long)v);
1057 public static explicit operator uint (nint v)
1059 #if NINT_JIT_OPTIMIZED
1060 throw new NotImplementedException ();
1068 public static explicit operator nint (long v)
1070 #if NINT_JIT_OPTIMIZED
1071 throw new NotImplementedException ();
1073 return new nint ((int)v);
1075 return new nint ((long)v);
1079 public static implicit operator long (nint v)
1081 #if NINT_JIT_OPTIMIZED
1082 throw new NotImplementedException ();
1090 public static explicit operator nint (ulong v)
1092 #if NINT_JIT_OPTIMIZED
1093 throw new NotImplementedException ();
1095 return new nint ((int)v);
1097 return new nint ((long)v);
1101 public static explicit operator ulong (nint v)
1103 #if NINT_JIT_OPTIMIZED
1104 throw new NotImplementedException ();
1112 public static explicit operator nint (float v)
1114 #if NINT_JIT_OPTIMIZED
1115 throw new NotImplementedException ();
1117 return new nint ((int)v);
1119 return new nint ((long)v);
1123 public static implicit operator float (nint v)
1125 #if NINT_JIT_OPTIMIZED
1126 throw new NotImplementedException ();
1134 public static explicit operator nint (double v)
1136 #if NINT_JIT_OPTIMIZED
1137 throw new NotImplementedException ();
1139 return new nint ((int)v);
1141 return new nint ((long)v);
1145 public static implicit operator double (nint v)
1147 #if NINT_JIT_OPTIMIZED
1148 throw new NotImplementedException ();
1156 public static explicit operator nint (decimal v)
1158 #if NINT_JIT_OPTIMIZED
1159 throw new NotImplementedException ();
1161 return new nint ((int)v);
1163 return new nint ((long)v);
1167 public static implicit operator decimal (nint v)
1169 #if NINT_JIT_OPTIMIZED
1170 throw new NotImplementedException ();
1172 return (decimal)v.v;
1174 return (decimal)v.v;
1178 #if NINT_JIT_OPTIMIZED
1179 public static nint operator + (nint v) { throw new NotImplementedException (); }
1180 public static nint operator - (nint v) { throw new NotImplementedException (); }
1181 public static nint operator ~ (nint v) { throw new NotImplementedException (); }
1183 public static nint operator + (nint v) { return new nint (+v.v); }
1184 public static nint operator - (nint v) { return new nint (-v.v); }
1185 public static nint operator ~ (nint v) { return new nint (~v.v); }
1188 #if NINT_JIT_OPTIMIZED
1189 public static nint operator ++ (nint v) { throw new NotImplementedException (); }
1190 public static nint operator -- (nint v) { throw new NotImplementedException (); }
1192 public static nint operator ++ (nint v) { return new nint (v.v + 1); }
1193 public static nint operator -- (nint v) { return new nint (v.v - 1); }
1196 #if NINT_JIT_OPTIMIZED
1197 public static nint operator + (nint l, nint r) { throw new NotImplementedException (); }
1198 public static nint operator - (nint l, nint r) { throw new NotImplementedException (); }
1199 public static nint operator * (nint l, nint r) { throw new NotImplementedException (); }
1200 public static nint operator / (nint l, nint r) { throw new NotImplementedException (); }
1201 public static nint operator % (nint l, nint r) { throw new NotImplementedException (); }
1202 public static nint operator & (nint l, nint r) { throw new NotImplementedException (); }
1203 public static nint operator | (nint l, nint r) { throw new NotImplementedException (); }
1204 public static nint operator ^ (nint l, nint r) { throw new NotImplementedException (); }
1206 public static nint operator << (nint l, int r) { throw new NotImplementedException (); }
1207 public static nint operator >> (nint l, int r) { throw new NotImplementedException (); }
1209 public static nint operator + (nint l, nint r) { return new nint (l.v + r.v); }
1210 public static nint operator - (nint l, nint r) { return new nint (l.v - r.v); }
1211 public static nint operator * (nint l, nint r) { return new nint (l.v * r.v); }
1212 public static nint operator / (nint l, nint r) { return new nint (l.v / r.v); }
1213 public static nint operator % (nint l, nint r) { return new nint (l.v % r.v); }
1214 public static nint operator & (nint l, nint r) { return new nint (l.v & r.v); }
1215 public static nint operator | (nint l, nint r) { return new nint (l.v | r.v); }
1216 public static nint operator ^ (nint l, nint r) { return new nint (l.v ^ r.v); }
1218 public static nint operator << (nint l, int r) { return new nint (l.v << r); }
1219 public static nint operator >> (nint l, int r) { return new nint (l.v >> r); }
1222 #if NINT_JIT_OPTIMIZED
1223 public static bool operator == (nint l, nint r) { throw new NotImplementedException (); }
1224 public static bool operator != (nint l, nint r) { throw new NotImplementedException (); }
1225 public static bool operator < (nint l, nint r) { throw new NotImplementedException (); }
1226 public static bool operator > (nint l, nint r) { throw new NotImplementedException (); }
1227 public static bool operator <= (nint l, nint r) { throw new NotImplementedException (); }
1228 public static bool operator >= (nint l, nint r) { throw new NotImplementedException (); }
1230 public static bool operator == (nint l, nint r) { return l.v == r.v; }
1231 public static bool operator != (nint l, nint r) { return l.v != r.v; }
1232 public static bool operator < (nint l, nint r) { return l.v < r.v; }
1233 public static bool operator > (nint l, nint r) { return l.v > r.v; }
1234 public static bool operator <= (nint l, nint r) { return l.v <= r.v; }
1235 public static bool operator >= (nint l, nint r) { return l.v >= r.v; }
1238 public int CompareTo (nint value) { return v.CompareTo (value.v); }
1239 public int CompareTo (object value)
1242 return v.CompareTo (((nint) value).v);
1243 return v.CompareTo (value);
1245 public bool Equals (nint obj) { return v.Equals (obj.v); }
1246 public override bool Equals (object obj)
1249 return v.Equals (((nint) obj).v);
1250 return v.Equals (obj);
1252 public override int GetHashCode () { return v.GetHashCode (); }
1255 public static nint Parse (string s, IFormatProvider provider) { return (nint)Int32.Parse (s, provider); }
1256 public static nint Parse (string s, NumberStyles style) { return (nint)Int32.Parse (s, style); }
1257 public static nint Parse (string s) { return (nint)Int32.Parse (s); }
1258 public static nint Parse (string s, NumberStyles style, IFormatProvider provider) {
1259 return (nint)Int32.Parse (s, style, provider);
1262 public static bool TryParse (string s, out nint result)
1265 var r = Int32.TryParse (s, out v);
1270 public static bool TryParse (string s, NumberStyles style, IFormatProvider provider, out nint result)
1273 var r = Int32.TryParse (s, style, provider, out v);
1278 public static nint Parse (string s, IFormatProvider provider) { return (nint)Int64.Parse (s, provider); }
1279 public static nint Parse (string s, NumberStyles style) { return (nint)Int64.Parse (s, style); }
1280 public static nint Parse (string s) { return (nint)Int64.Parse (s); }
1281 public static nint Parse (string s, NumberStyles style, IFormatProvider provider) {
1282 return (nint)Int64.Parse (s, style, provider);
1285 public static bool TryParse (string s, out nint result)
1288 var r = Int64.TryParse (s, out v);
1293 public static bool TryParse (string s, NumberStyles style, IFormatProvider provider, out nint result)
1296 var r = Int64.TryParse (s, style, provider, out v);
1302 public override string ToString () { return v.ToString (); }
1303 public string ToString (IFormatProvider provider) { return v.ToString (provider); }
1304 public string ToString (string format) { return v.ToString (format); }
1305 public string ToString (string format, IFormatProvider provider) { return v.ToString (format, provider); }
1307 public TypeCode GetTypeCode () { return v.GetTypeCode (); }
1309 bool IConvertible.ToBoolean (IFormatProvider provider) { return ((IConvertible)v).ToBoolean (provider); }
1310 byte IConvertible.ToByte (IFormatProvider provider) { return ((IConvertible)v).ToByte (provider); }
1311 char IConvertible.ToChar (IFormatProvider provider) { return ((IConvertible)v).ToChar (provider); }
1312 DateTime IConvertible.ToDateTime (IFormatProvider provider) { return ((IConvertible)v).ToDateTime (provider); }
1313 decimal IConvertible.ToDecimal (IFormatProvider provider) { return ((IConvertible)v).ToDecimal (provider); }
1314 double IConvertible.ToDouble (IFormatProvider provider) { return ((IConvertible)v).ToDouble (provider); }
1315 short IConvertible.ToInt16 (IFormatProvider provider) { return ((IConvertible)v).ToInt16 (provider); }
1316 int IConvertible.ToInt32 (IFormatProvider provider) { return ((IConvertible)v).ToInt32 (provider); }
1317 long IConvertible.ToInt64 (IFormatProvider provider) { return ((IConvertible)v).ToInt64 (provider); }
1318 sbyte IConvertible.ToSByte (IFormatProvider provider) { return ((IConvertible)v).ToSByte (provider); }
1319 float IConvertible.ToSingle (IFormatProvider provider) { return ((IConvertible)v).ToSingle (provider); }
1320 ushort IConvertible.ToUInt16 (IFormatProvider provider) { return ((IConvertible)v).ToUInt16 (provider); }
1321 uint IConvertible.ToUInt32 (IFormatProvider provider) { return ((IConvertible)v).ToUInt32 (provider); }
1322 ulong IConvertible.ToUInt64 (IFormatProvider provider) { return ((IConvertible)v).ToUInt64 (provider); }
1324 object IConvertible.ToType (Type targetType, IFormatProvider provider) {
1325 return ((IConvertible)v).ToType (targetType, provider);
1328 public static void CopyArray (IntPtr source, nint [] destination, int startIndex, int length)
1330 if (source == IntPtr.Zero)
1331 throw new ArgumentNullException ("source");
1332 if (destination == null)
1333 throw new ArgumentNullException ("destination");
1334 if (destination.Rank != 1)
1335 throw new ArgumentException ("destination", "array is multi-dimensional");
1337 throw new ArgumentException ("startIndex", "must be >= 0");
1339 throw new ArgumentException ("length", "must be >= 0");
1340 if (startIndex + length > destination.Length)
1341 throw new ArgumentException ("length", "startIndex + length > destination.Length");
1343 for (int i = 0; i < length; i++)
1344 destination [i + startIndex] = (nint)Marshal.ReadIntPtr (source, i * nint.Size);
1347 public static void CopyArray (nint [] source, int startIndex, IntPtr destination, int length)
1350 throw new ArgumentNullException ("source");
1351 if (destination == IntPtr.Zero)
1352 throw new ArgumentNullException ("destination");
1353 if (source.Rank != 1)
1354 throw new ArgumentException ("source", "array is multi-dimensional");
1356 throw new ArgumentException ("startIndex", "must be >= 0");
1358 throw new ArgumentException ("length", "must be >= 0");
1359 if (startIndex + length > source.Length)
1360 throw new ArgumentException ("length", "startIndex + length > source.Length");
1362 for (int i = 0; i < length; i++)
1363 Marshal.WriteIntPtr (destination, i * nint.Size, (IntPtr)source [i + startIndex]);
1367 [DebuggerDisplay ("{v,nq}")]
1368 public unsafe struct nuint : IFormattable, IConvertible, IComparable, IComparable<nuint>, IEquatable <nuint>
1370 internal nuint (nuint v) { this.v = v.v; }
1371 public nuint (UInt32 v) { this.v = v; }
1374 public static readonly int Size = 4;
1376 public static readonly nuint MaxValue = UInt32.MaxValue;
1377 public static readonly nuint MinValue = UInt32.MinValue;
1379 [DebuggerBrowsable (DebuggerBrowsableState.Never)]
1382 public nuint (UInt64 v) { this.v = (UInt32)v; }
1384 public static readonly int Size = 8;
1386 public static readonly nuint MaxValue = (nuint) UInt64.MaxValue; // 64-bit only codepath
1387 public static readonly nuint MinValue = (nuint) UInt64.MinValue; // 64-bit only codepath
1389 [DebuggerBrowsable (DebuggerBrowsableState.Never)]
1392 public nuint (UInt64 v) { this.v = v; }
1395 public static explicit operator nuint (nfloat v)
1397 #if NINT_JIT_OPTIMIZED
1398 throw new NotImplementedException ();
1400 return new nuint ((uint)v.v);
1402 return new nuint ((ulong)v.v);
1406 public static implicit operator nfloat (nuint v)
1408 #if NINT_JIT_OPTIMIZED
1409 throw new NotImplementedException ();
1411 return new nfloat ((float)v.v);
1413 return new nfloat ((double)v.v);
1417 public static explicit operator nuint (IntPtr v)
1419 #if NINT_JIT_OPTIMIZED
1420 throw new NotImplementedException ();
1422 return new nuint (*((uint *)&v));
1424 return new nuint (*((ulong *)&v));
1428 public static explicit operator IntPtr (nuint v)
1430 #if NINT_JIT_OPTIMIZED
1431 throw new NotImplementedException ();
1433 return *((IntPtr *)&v.v);
1435 return *((IntPtr *)&v.v);
1439 public static explicit operator nuint (sbyte v)
1441 #if NINT_JIT_OPTIMIZED
1442 throw new NotImplementedException ();
1444 return new nuint ((uint)v);
1446 return new nuint ((ulong)v);
1450 public static explicit operator sbyte (nuint v)
1452 #if NINT_JIT_OPTIMIZED
1453 throw new NotImplementedException ();
1461 public static implicit operator nuint (byte v)
1463 #if NINT_JIT_OPTIMIZED
1464 throw new NotImplementedException ();
1466 return new nuint ((uint)v);
1468 return new nuint ((ulong)v);
1472 public static explicit operator byte (nuint v)
1474 #if NINT_JIT_OPTIMIZED
1475 throw new NotImplementedException ();
1483 public static implicit operator nuint (char v)
1485 #if NINT_JIT_OPTIMIZED
1486 throw new NotImplementedException ();
1488 return new nuint ((uint)v);
1490 return new nuint ((ulong)v);
1494 public static explicit operator char (nuint v)
1496 #if NINT_JIT_OPTIMIZED
1497 throw new NotImplementedException ();
1505 public static explicit operator nuint (short v)
1507 #if NINT_JIT_OPTIMIZED
1508 throw new NotImplementedException ();
1510 return new nuint ((uint)v);
1512 return new nuint ((ulong)v);
1516 public static explicit operator short (nuint v)
1518 #if NINT_JIT_OPTIMIZED
1519 throw new NotImplementedException ();
1527 public static implicit operator nuint (ushort v)
1529 #if NINT_JIT_OPTIMIZED
1530 throw new NotImplementedException ();
1532 return new nuint ((uint)v);
1534 return new nuint ((ulong)v);
1538 public static explicit operator ushort (nuint v)
1540 #if NINT_JIT_OPTIMIZED
1541 throw new NotImplementedException ();
1549 public static explicit operator nuint (int v)
1551 #if NINT_JIT_OPTIMIZED
1552 throw new NotImplementedException ();
1554 return new nuint ((uint)v);
1556 return new nuint ((ulong)v);
1560 public static explicit operator int (nuint v)
1562 #if NINT_JIT_OPTIMIZED
1563 throw new NotImplementedException ();
1571 public static implicit operator nuint (uint v)
1573 #if NINT_JIT_OPTIMIZED
1574 throw new NotImplementedException ();
1576 return new nuint ((uint)v);
1578 return new nuint ((ulong)v);
1582 public static explicit operator uint (nuint v)
1584 #if NINT_JIT_OPTIMIZED
1585 throw new NotImplementedException ();
1593 public static explicit operator nuint (long v)
1595 #if NINT_JIT_OPTIMIZED
1596 throw new NotImplementedException ();
1598 return new nuint ((uint)v);
1600 return new nuint ((ulong)v);
1604 public static explicit operator long (nuint v)
1606 #if NINT_JIT_OPTIMIZED
1607 throw new NotImplementedException ();
1615 public static explicit operator nuint (ulong v)
1617 #if NINT_JIT_OPTIMIZED
1618 throw new NotImplementedException ();
1620 return new nuint ((uint)v);
1622 return new nuint ((ulong)v);
1626 public static implicit operator ulong (nuint v)
1628 #if NINT_JIT_OPTIMIZED
1629 throw new NotImplementedException ();
1637 public static explicit operator nuint (float v)
1639 #if NINT_JIT_OPTIMIZED
1640 throw new NotImplementedException ();
1642 return new nuint ((uint)v);
1644 return new nuint ((ulong)v);
1648 public static implicit operator float (nuint v)
1650 #if NINT_JIT_OPTIMIZED
1651 throw new NotImplementedException ();
1659 public static explicit operator nuint (double v)
1661 #if NINT_JIT_OPTIMIZED
1662 throw new NotImplementedException ();
1664 return new nuint ((uint)v);
1666 return new nuint ((ulong)v);
1670 public static implicit operator double (nuint v)
1672 #if NINT_JIT_OPTIMIZED
1673 throw new NotImplementedException ();
1681 public static explicit operator nuint (decimal v)
1683 #if NINT_JIT_OPTIMIZED
1684 throw new NotImplementedException ();
1686 return new nuint ((uint)v);
1688 return new nuint ((ulong)v);
1692 public static implicit operator decimal (nuint v)
1694 #if NINT_JIT_OPTIMIZED
1695 throw new NotImplementedException ();
1697 return (decimal)v.v;
1699 return (decimal)v.v;
1703 #if NINT_JIT_OPTIMIZED
1704 public static nuint operator + (nuint v) { throw new NotImplementedException (); }
1705 public static nuint operator ~ (nuint v) { throw new NotImplementedException (); }
1707 public static nuint operator + (nuint v) { return new nuint (+v.v); }
1708 public static nuint operator ~ (nuint v) { return new nuint (~v.v); }
1711 #if NINT_JIT_OPTIMIZED
1712 public static nuint operator ++ (nuint v) { throw new NotImplementedException (); }
1713 public static nuint operator -- (nuint v) { throw new NotImplementedException (); }
1715 public static nuint operator ++ (nuint v) { return new nuint (v.v + 1); }
1716 public static nuint operator -- (nuint v) { return new nuint (v.v - 1); }
1719 #if NINT_JIT_OPTIMIZED
1720 public static nuint operator + (nuint l, nuint r) { throw new NotImplementedException (); }
1721 public static nuint operator - (nuint l, nuint r) { throw new NotImplementedException (); }
1722 public static nuint operator * (nuint l, nuint r) { throw new NotImplementedException (); }
1723 public static nuint operator / (nuint l, nuint r) { throw new NotImplementedException (); }
1724 public static nuint operator % (nuint l, nuint r) { throw new NotImplementedException (); }
1725 public static nuint operator & (nuint l, nuint r) { throw new NotImplementedException (); }
1726 public static nuint operator | (nuint l, nuint r) { throw new NotImplementedException (); }
1727 public static nuint operator ^ (nuint l, nuint r) { throw new NotImplementedException (); }
1729 public static nuint operator << (nuint l, int r) { throw new NotImplementedException (); }
1730 public static nuint operator >> (nuint l, int r) { throw new NotImplementedException (); }
1732 public static nuint operator + (nuint l, nuint r) { return new nuint (l.v + r.v); }
1733 public static nuint operator - (nuint l, nuint r) { return new nuint (l.v - r.v); }
1734 public static nuint operator * (nuint l, nuint r) { return new nuint (l.v * r.v); }
1735 public static nuint operator / (nuint l, nuint r) { return new nuint (l.v / r.v); }
1736 public static nuint operator % (nuint l, nuint r) { return new nuint (l.v % r.v); }
1737 public static nuint operator & (nuint l, nuint r) { return new nuint (l.v & r.v); }
1738 public static nuint operator | (nuint l, nuint r) { return new nuint (l.v | r.v); }
1739 public static nuint operator ^ (nuint l, nuint r) { return new nuint (l.v ^ r.v); }
1741 public static nuint operator << (nuint l, int r) { return new nuint (l.v << r); }
1742 public static nuint operator >> (nuint l, int r) { return new nuint (l.v >> r); }
1745 #if NINT_JIT_OPTIMIZED
1746 public static bool operator == (nuint l, nuint r) { throw new NotImplementedException (); }
1747 public static bool operator != (nuint l, nuint r) { throw new NotImplementedException (); }
1748 public static bool operator < (nuint l, nuint r) { throw new NotImplementedException (); }
1749 public static bool operator > (nuint l, nuint r) { throw new NotImplementedException (); }
1750 public static bool operator <= (nuint l, nuint r) { throw new NotImplementedException (); }
1751 public static bool operator >= (nuint l, nuint r) { throw new NotImplementedException (); }
1753 public static bool operator == (nuint l, nuint r) { return l.v == r.v; }
1754 public static bool operator != (nuint l, nuint r) { return l.v != r.v; }
1755 public static bool operator < (nuint l, nuint r) { return l.v < r.v; }
1756 public static bool operator > (nuint l, nuint r) { return l.v > r.v; }
1757 public static bool operator <= (nuint l, nuint r) { return l.v <= r.v; }
1758 public static bool operator >= (nuint l, nuint r) { return l.v >= r.v; }
1761 public int CompareTo (nuint value) { return v.CompareTo (value.v); }
1762 public int CompareTo (object value)
1765 return v.CompareTo (((nuint) value).v);
1766 return v.CompareTo (value);
1768 public bool Equals (nuint obj) { return v.Equals (obj.v); }
1769 public override bool Equals (object obj)
1772 return v.Equals (((nuint) obj).v);
1773 return v.Equals (obj);
1775 public override int GetHashCode () { return v.GetHashCode (); }
1778 public static nuint Parse (string s, IFormatProvider provider) { return (nuint)UInt32.Parse (s, provider); }
1779 public static nuint Parse (string s, NumberStyles style) { return (nuint)UInt32.Parse (s, style); }
1780 public static nuint Parse (string s) { return (nuint)UInt32.Parse (s); }
1781 public static nuint Parse (string s, NumberStyles style, IFormatProvider provider) {
1782 return (nuint)UInt32.Parse (s, style, provider);
1785 public static bool TryParse (string s, out nuint result)
1788 var r = UInt32.TryParse (s, out v);
1793 public static bool TryParse (string s, NumberStyles style, IFormatProvider provider, out nuint result)
1796 var r = UInt32.TryParse (s, style, provider, out v);
1801 public static nuint Parse (string s, IFormatProvider provider) { return (nuint)UInt64.Parse (s, provider); }
1802 public static nuint Parse (string s, NumberStyles style) { return (nuint)UInt64.Parse (s, style); }
1803 public static nuint Parse (string s) { return (nuint)UInt64.Parse (s); }
1804 public static nuint Parse (string s, NumberStyles style, IFormatProvider provider) {
1805 return (nuint)UInt64.Parse (s, style, provider);
1808 public static bool TryParse (string s, out nuint result)
1811 var r = UInt64.TryParse (s, out v);
1816 public static bool TryParse (string s, NumberStyles style, IFormatProvider provider, out nuint result)
1819 var r = UInt64.TryParse (s, style, provider, out v);
1825 public override string ToString () { return v.ToString (); }
1826 public string ToString (IFormatProvider provider) { return v.ToString (provider); }
1827 public string ToString (string format) { return v.ToString (format); }
1828 public string ToString (string format, IFormatProvider provider) { return v.ToString (format, provider); }
1830 public TypeCode GetTypeCode () { return v.GetTypeCode (); }
1832 bool IConvertible.ToBoolean (IFormatProvider provider) { return ((IConvertible)v).ToBoolean (provider); }
1833 byte IConvertible.ToByte (IFormatProvider provider) { return ((IConvertible)v).ToByte (provider); }
1834 char IConvertible.ToChar (IFormatProvider provider) { return ((IConvertible)v).ToChar (provider); }
1835 DateTime IConvertible.ToDateTime (IFormatProvider provider) { return ((IConvertible)v).ToDateTime (provider); }
1836 decimal IConvertible.ToDecimal (IFormatProvider provider) { return ((IConvertible)v).ToDecimal (provider); }
1837 double IConvertible.ToDouble (IFormatProvider provider) { return ((IConvertible)v).ToDouble (provider); }
1838 short IConvertible.ToInt16 (IFormatProvider provider) { return ((IConvertible)v).ToInt16 (provider); }
1839 int IConvertible.ToInt32 (IFormatProvider provider) { return ((IConvertible)v).ToInt32 (provider); }
1840 long IConvertible.ToInt64 (IFormatProvider provider) { return ((IConvertible)v).ToInt64 (provider); }
1841 sbyte IConvertible.ToSByte (IFormatProvider provider) { return ((IConvertible)v).ToSByte (provider); }
1842 float IConvertible.ToSingle (IFormatProvider provider) { return ((IConvertible)v).ToSingle (provider); }
1843 ushort IConvertible.ToUInt16 (IFormatProvider provider) { return ((IConvertible)v).ToUInt16 (provider); }
1844 uint IConvertible.ToUInt32 (IFormatProvider provider) { return ((IConvertible)v).ToUInt32 (provider); }
1845 ulong IConvertible.ToUInt64 (IFormatProvider provider) { return ((IConvertible)v).ToUInt64 (provider); }
1847 object IConvertible.ToType (Type targetType, IFormatProvider provider) {
1848 return ((IConvertible)v).ToType (targetType, provider);
1851 public static void CopyArray (IntPtr source, nuint [] destination, int startIndex, int length)
1853 if (source == IntPtr.Zero)
1854 throw new ArgumentNullException ("source");
1855 if (destination == null)
1856 throw new ArgumentNullException ("destination");
1857 if (destination.Rank != 1)
1858 throw new ArgumentException ("destination", "array is multi-dimensional");
1860 throw new ArgumentException ("startIndex", "must be >= 0");
1862 throw new ArgumentException ("length", "must be >= 0");
1863 if (startIndex + length > destination.Length)
1864 throw new ArgumentException ("length", "startIndex + length > destination.Length");
1866 for (int i = 0; i < length; i++)
1867 destination [i + startIndex] = (nuint)Marshal.ReadIntPtr (source, i * nuint.Size);
1870 public static void CopyArray (nuint [] source, int startIndex, IntPtr destination, int length)
1873 throw new ArgumentNullException ("source");
1874 if (destination == IntPtr.Zero)
1875 throw new ArgumentNullException ("destination");
1876 if (source.Rank != 1)
1877 throw new ArgumentException ("source", "array is multi-dimensional");
1879 throw new ArgumentException ("startIndex", "must be >= 0");
1881 throw new ArgumentException ("length", "must be >= 0");
1882 if (startIndex + length > source.Length)
1883 throw new ArgumentException ("length", "startIndex + length > source.Length");
1885 for (int i = 0; i < length; i++)
1886 Marshal.WriteIntPtr (destination, i * nuint.Size, (IntPtr)source [i + startIndex]);
1890 [DebuggerDisplay ("{v,nq}")]
1891 public unsafe struct nfloat : IFormattable, IConvertible, IComparable, IComparable<nfloat>, IEquatable <nfloat>
1893 internal nfloat (nfloat v) { this.v = v.v; }
1894 public nfloat (Single v) { this.v = v; }
1897 public static readonly int Size = 4;
1899 public static readonly nfloat MaxValue = Single.MaxValue;
1900 public static readonly nfloat MinValue = Single.MinValue;
1901 public static readonly nfloat Epsilon = (nfloat)Single.Epsilon;
1902 public static readonly nfloat NaN = (nfloat)Single.NaN;
1903 public static readonly nfloat NegativeInfinity = (nfloat)Single.NegativeInfinity;
1904 public static readonly nfloat PositiveInfinity = (nfloat)Single.PositiveInfinity;
1906 [DebuggerBrowsable (DebuggerBrowsableState.Never)]
1909 public nfloat (Double v) { this.v = (Single)v; }
1911 public static readonly int Size = 8;
1913 public static readonly nfloat MaxValue = (nfloat) Double.MaxValue; // 64-bit only codepath
1914 public static readonly nfloat MinValue = (nfloat) Double.MinValue; // 64-bit only codepath
1915 public static readonly nfloat Epsilon = (nfloat)Double.Epsilon;
1916 public static readonly nfloat NaN = (nfloat)Double.NaN;
1917 public static readonly nfloat NegativeInfinity = (nfloat)Double.NegativeInfinity;
1918 public static readonly nfloat PositiveInfinity = (nfloat)Double.PositiveInfinity;
1920 [DebuggerBrowsable (DebuggerBrowsableState.Never)]
1923 public nfloat (Double v) { this.v = v; }
1926 public static explicit operator nfloat (IntPtr v)
1928 #if NINT_JIT_OPTIMIZED
1929 throw new NotImplementedException ();
1931 return new nfloat (*((float *)&v));
1933 return new nfloat (*((double *)&v));
1937 public static explicit operator IntPtr (nfloat v)
1939 #if NINT_JIT_OPTIMIZED
1940 throw new NotImplementedException ();
1942 return *((IntPtr *)&v.v);
1944 return *((IntPtr *)&v.v);
1948 public static implicit operator nfloat (sbyte v)
1950 #if NINT_JIT_OPTIMIZED
1951 throw new NotImplementedException ();
1953 return new nfloat ((float)v);
1955 return new nfloat ((double)v);
1959 public static explicit operator sbyte (nfloat v)
1961 #if NINT_JIT_OPTIMIZED
1962 throw new NotImplementedException ();
1970 public static implicit operator nfloat (byte v)
1972 #if NINT_JIT_OPTIMIZED
1973 throw new NotImplementedException ();
1975 return new nfloat ((float)v);
1977 return new nfloat ((double)v);
1981 public static explicit operator byte (nfloat v)
1983 #if NINT_JIT_OPTIMIZED
1984 throw new NotImplementedException ();
1992 public static implicit operator nfloat (char v)
1994 #if NINT_JIT_OPTIMIZED
1995 throw new NotImplementedException ();
1997 return new nfloat ((float)v);
1999 return new nfloat ((double)v);
2003 public static explicit operator char (nfloat v)
2005 #if NINT_JIT_OPTIMIZED
2006 throw new NotImplementedException ();
2014 public static implicit operator nfloat (short v)
2016 #if NINT_JIT_OPTIMIZED
2017 throw new NotImplementedException ();
2019 return new nfloat ((float)v);
2021 return new nfloat ((double)v);
2025 public static explicit operator short (nfloat v)
2027 #if NINT_JIT_OPTIMIZED
2028 throw new NotImplementedException ();
2036 public static implicit operator nfloat (ushort v)
2038 #if NINT_JIT_OPTIMIZED
2039 throw new NotImplementedException ();
2041 return new nfloat ((float)v);
2043 return new nfloat ((double)v);
2047 public static explicit operator ushort (nfloat v)
2049 #if NINT_JIT_OPTIMIZED
2050 throw new NotImplementedException ();
2058 public static implicit operator nfloat (int v)
2060 #if NINT_JIT_OPTIMIZED
2061 throw new NotImplementedException ();
2063 return new nfloat ((float)v);
2065 return new nfloat ((double)v);
2069 public static explicit operator int (nfloat v)
2071 #if NINT_JIT_OPTIMIZED
2072 throw new NotImplementedException ();
2080 public static implicit operator nfloat (uint v)
2082 #if NINT_JIT_OPTIMIZED
2083 throw new NotImplementedException ();
2085 return new nfloat ((float)v);
2087 return new nfloat ((double)v);
2091 public static explicit operator uint (nfloat v)
2093 #if NINT_JIT_OPTIMIZED
2094 throw new NotImplementedException ();
2102 public static implicit operator nfloat (long v)
2104 #if NINT_JIT_OPTIMIZED
2105 throw new NotImplementedException ();
2107 return new nfloat ((float)v);
2109 return new nfloat ((double)v);
2113 public static explicit operator long (nfloat v)
2115 #if NINT_JIT_OPTIMIZED
2116 throw new NotImplementedException ();
2124 public static implicit operator nfloat (ulong v)
2126 #if NINT_JIT_OPTIMIZED
2127 throw new NotImplementedException ();
2129 return new nfloat ((float)v);
2131 return new nfloat ((double)v);
2135 public static explicit operator ulong (nfloat v)
2137 #if NINT_JIT_OPTIMIZED
2138 throw new NotImplementedException ();
2146 public static implicit operator nfloat (float v)
2148 #if NINT_JIT_OPTIMIZED
2149 throw new NotImplementedException ();
2151 return new nfloat ((float)v);
2153 return new nfloat ((double)v);
2157 public static explicit operator float (nfloat v)
2159 #if NINT_JIT_OPTIMIZED
2160 throw new NotImplementedException ();
2168 public static explicit operator nfloat (double v)
2170 #if NINT_JIT_OPTIMIZED
2171 throw new NotImplementedException ();
2173 return new nfloat ((float)v);
2175 return new nfloat ((double)v);
2179 public static implicit operator double (nfloat v)
2181 #if NINT_JIT_OPTIMIZED
2182 throw new NotImplementedException ();
2190 public static explicit operator nfloat (decimal v)
2192 #if NINT_JIT_OPTIMIZED
2193 throw new NotImplementedException ();
2195 return new nfloat ((float)v);
2197 return new nfloat ((double)v);
2201 public static explicit operator decimal (nfloat v)
2203 #if NINT_JIT_OPTIMIZED
2204 throw new NotImplementedException ();
2206 return (decimal)v.v;
2208 return (decimal)v.v;
2212 #if NINT_JIT_OPTIMIZED
2213 public static nfloat operator + (nfloat v) { throw new NotImplementedException (); }
2214 public static nfloat operator - (nfloat v) { throw new NotImplementedException (); }
2216 public static nfloat operator + (nfloat v) { return new nfloat (+v.v); }
2217 public static nfloat operator - (nfloat v) { return new nfloat (-v.v); }
2220 #if NINT_JIT_OPTIMIZED
2221 public static nfloat operator ++ (nfloat v) { throw new NotImplementedException (); }
2222 public static nfloat operator -- (nfloat v) { throw new NotImplementedException (); }
2224 public static nfloat operator ++ (nfloat v) { return new nfloat (v.v + 1); }
2225 public static nfloat operator -- (nfloat v) { return new nfloat (v.v - 1); }
2228 #if NINT_JIT_OPTIMIZED
2229 public static nfloat operator + (nfloat l, nfloat r) { throw new NotImplementedException (); }
2230 public static nfloat operator - (nfloat l, nfloat r) { throw new NotImplementedException (); }
2231 public static nfloat operator * (nfloat l, nfloat r) { throw new NotImplementedException (); }
2232 public static nfloat operator / (nfloat l, nfloat r) { throw new NotImplementedException (); }
2233 public static nfloat operator % (nfloat l, nfloat r) { throw new NotImplementedException (); }
2235 public static nfloat operator + (nfloat l, nfloat r) { return new nfloat (l.v + r.v); }
2236 public static nfloat operator - (nfloat l, nfloat r) { return new nfloat (l.v - r.v); }
2237 public static nfloat operator * (nfloat l, nfloat r) { return new nfloat (l.v * r.v); }
2238 public static nfloat operator / (nfloat l, nfloat r) { return new nfloat (l.v / r.v); }
2239 public static nfloat operator % (nfloat l, nfloat r) { return new nfloat (l.v % r.v); }
2242 #if NINT_JIT_OPTIMIZED
2243 public static bool operator == (nfloat l, nfloat r) { throw new NotImplementedException (); }
2244 public static bool operator != (nfloat l, nfloat r) { throw new NotImplementedException (); }
2245 public static bool operator < (nfloat l, nfloat r) { throw new NotImplementedException (); }
2246 public static bool operator > (nfloat l, nfloat r) { throw new NotImplementedException (); }
2247 public static bool operator <= (nfloat l, nfloat r) { throw new NotImplementedException (); }
2248 public static bool operator >= (nfloat l, nfloat r) { throw new NotImplementedException (); }
2250 public static bool operator == (nfloat l, nfloat r) { return l.v == r.v; }
2251 public static bool operator != (nfloat l, nfloat r) { return l.v != r.v; }
2252 public static bool operator < (nfloat l, nfloat r) { return l.v < r.v; }
2253 public static bool operator > (nfloat l, nfloat r) { return l.v > r.v; }
2254 public static bool operator <= (nfloat l, nfloat r) { return l.v <= r.v; }
2255 public static bool operator >= (nfloat l, nfloat r) { return l.v >= r.v; }
2258 public int CompareTo (nfloat value) { return v.CompareTo (value.v); }
2259 public int CompareTo (object value)
2261 if (value is nfloat)
2262 return v.CompareTo (((nfloat) value).v);
2263 return v.CompareTo (value);
2265 public bool Equals (nfloat obj) { return v.Equals (obj.v); }
2266 public override bool Equals (object obj)
2269 return v.Equals (((nfloat) obj).v);
2270 return v.Equals (obj);
2272 public override int GetHashCode () { return v.GetHashCode (); }
2275 public static bool IsNaN (nfloat f) { return Single.IsNaN ((Single)f); }
2276 public static bool IsInfinity (nfloat f) { return Single.IsInfinity ((Single)f); }
2277 public static bool IsPositiveInfinity (nfloat f) { return Single.IsPositiveInfinity ((Single)f); }
2278 public static bool IsNegativeInfinity (nfloat f) { return Single.IsNegativeInfinity ((Single)f); }
2280 public static nfloat Parse (string s, IFormatProvider provider) { return (nfloat)Single.Parse (s, provider); }
2281 public static nfloat Parse (string s, NumberStyles style) { return (nfloat)Single.Parse (s, style); }
2282 public static nfloat Parse (string s) { return (nfloat)Single.Parse (s); }
2283 public static nfloat Parse (string s, NumberStyles style, IFormatProvider provider) {
2284 return (nfloat)Single.Parse (s, style, provider);
2287 public static bool TryParse (string s, out nfloat result)
2290 var r = Single.TryParse (s, out v);
2295 public static bool TryParse (string s, NumberStyles style, IFormatProvider provider, out nfloat result)
2298 var r = Single.TryParse (s, style, provider, out v);
2303 public static bool IsNaN (nfloat f) { return Double.IsNaN ((Double)f); }
2304 public static bool IsInfinity (nfloat f) { return Double.IsInfinity ((Double)f); }
2305 public static bool IsPositiveInfinity (nfloat f) { return Double.IsPositiveInfinity ((Double)f); }
2306 public static bool IsNegativeInfinity (nfloat f) { return Double.IsNegativeInfinity ((Double)f); }
2308 public static nfloat Parse (string s, IFormatProvider provider) { return (nfloat)Double.Parse (s, provider); }
2309 public static nfloat Parse (string s, NumberStyles style) { return (nfloat)Double.Parse (s, style); }
2310 public static nfloat Parse (string s) { return (nfloat)Double.Parse (s); }
2311 public static nfloat Parse (string s, NumberStyles style, IFormatProvider provider) {
2312 return (nfloat)Double.Parse (s, style, provider);
2315 public static bool TryParse (string s, out nfloat result)
2318 var r = Double.TryParse (s, out v);
2323 public static bool TryParse (string s, NumberStyles style, IFormatProvider provider, out nfloat result)
2326 var r = Double.TryParse (s, style, provider, out v);
2332 public override string ToString () { return v.ToString (); }
2333 public string ToString (IFormatProvider provider) { return v.ToString (provider); }
2334 public string ToString (string format) { return v.ToString (format); }
2335 public string ToString (string format, IFormatProvider provider) { return v.ToString (format, provider); }
2337 public TypeCode GetTypeCode () { return v.GetTypeCode (); }
2339 bool IConvertible.ToBoolean (IFormatProvider provider) { return ((IConvertible)v).ToBoolean (provider); }
2340 byte IConvertible.ToByte (IFormatProvider provider) { return ((IConvertible)v).ToByte (provider); }
2341 char IConvertible.ToChar (IFormatProvider provider) { return ((IConvertible)v).ToChar (provider); }
2342 DateTime IConvertible.ToDateTime (IFormatProvider provider) { return ((IConvertible)v).ToDateTime (provider); }
2343 decimal IConvertible.ToDecimal (IFormatProvider provider) { return ((IConvertible)v).ToDecimal (provider); }
2344 double IConvertible.ToDouble (IFormatProvider provider) { return ((IConvertible)v).ToDouble (provider); }
2345 short IConvertible.ToInt16 (IFormatProvider provider) { return ((IConvertible)v).ToInt16 (provider); }
2346 int IConvertible.ToInt32 (IFormatProvider provider) { return ((IConvertible)v).ToInt32 (provider); }
2347 long IConvertible.ToInt64 (IFormatProvider provider) { return ((IConvertible)v).ToInt64 (provider); }
2348 sbyte IConvertible.ToSByte (IFormatProvider provider) { return ((IConvertible)v).ToSByte (provider); }
2349 float IConvertible.ToSingle (IFormatProvider provider) { return ((IConvertible)v).ToSingle (provider); }
2350 ushort IConvertible.ToUInt16 (IFormatProvider provider) { return ((IConvertible)v).ToUInt16 (provider); }
2351 uint IConvertible.ToUInt32 (IFormatProvider provider) { return ((IConvertible)v).ToUInt32 (provider); }
2352 ulong IConvertible.ToUInt64 (IFormatProvider provider) { return ((IConvertible)v).ToUInt64 (provider); }
2354 object IConvertible.ToType (Type targetType, IFormatProvider provider) {
2355 return ((IConvertible)v).ToType (targetType, provider);
2358 public static void CopyArray (IntPtr source, nfloat [] destination, int startIndex, int length)
2360 if (source == IntPtr.Zero)
2361 throw new ArgumentNullException ("source");
2362 if (destination == null)
2363 throw new ArgumentNullException ("destination");
2364 if (destination.Rank != 1)
2365 throw new ArgumentException ("destination", "array is multi-dimensional");
2367 throw new ArgumentException ("startIndex", "must be >= 0");
2369 throw new ArgumentException ("length", "must be >= 0");
2370 if (startIndex + length > destination.Length)
2371 throw new ArgumentException ("length", "startIndex + length > destination.Length");
2373 for (int i = 0; i < length; i++)
2374 destination [i + startIndex] = (nfloat)Marshal.ReadIntPtr (source, i * nfloat.Size);
2377 public static void CopyArray (nfloat [] source, int startIndex, IntPtr destination, int length)
2380 throw new ArgumentNullException ("source");
2381 if (destination == IntPtr.Zero)
2382 throw new ArgumentNullException ("destination");
2383 if (source.Rank != 1)
2384 throw new ArgumentException ("source", "array is multi-dimensional");
2386 throw new ArgumentException ("startIndex", "must be >= 0");
2388 throw new ArgumentException ("length", "must be >= 0");
2389 if (startIndex + length > source.Length)
2390 throw new ArgumentException ("length", "startIndex + length > source.Length");
2392 for (int i = 0; i < length; i++)
2393 Marshal.WriteIntPtr (destination, i * nfloat.Size, (IntPtr)source [i + startIndex]);