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"))
796 public static int Main (String[] args) {
797 return TestDriver.RunTests (typeof (BuiltinTests), args);
803 // !!! WARNING - GENERATED CODE - DO NOT EDIT !!!
805 // Generated by NativeTypes.tt, a T4 template.
807 // NativeTypes.cs: basic types with 32 or 64 bit sizes:
814 // Aaron Bockover <abock@xamarin.com>
816 // Copyright 2013 Xamarin, Inc. All rights reserved.
822 [DebuggerDisplay ("{v,nq}")]
823 public unsafe struct nint : IFormattable, IConvertible, IComparable, IComparable<nint>, IEquatable <nint>
825 internal nint (nint v) { this.v = v.v; }
826 public nint (Int32 v) { this.v = v; }
829 public static readonly int Size = 4;
831 public static readonly nint MaxValue = Int32.MaxValue;
832 public static readonly nint MinValue = Int32.MinValue;
834 [DebuggerBrowsable (DebuggerBrowsableState.Never)]
837 public nint (Int64 v) { this.v = (Int32)v; }
839 public static readonly int Size = 8;
841 public static readonly nint MaxValue = (nint) Int64.MaxValue; // 64-bit only codepath
842 public static readonly nint MinValue = (nint) Int64.MinValue; // 64-bit only codepath
844 [DebuggerBrowsable (DebuggerBrowsableState.Never)]
847 public nint (Int64 v) { this.v = v; }
850 public static explicit operator nint (nuint v)
852 #if NINT_JIT_OPTIMIZED
853 throw new NotImplementedException ();
855 return new nint ((int)v.v);
857 return new nint ((long)v.v);
861 public static explicit operator nuint (nint v)
863 #if NINT_JIT_OPTIMIZED
864 throw new NotImplementedException ();
866 return new nuint ((uint)v.v);
868 return new nuint ((ulong)v.v);
872 public static explicit operator nint (nfloat v)
874 #if NINT_JIT_OPTIMIZED
875 throw new NotImplementedException ();
877 return new nint ((int)v.v);
879 return new nint ((long)v.v);
883 public static implicit operator nfloat (nint v)
885 #if NINT_JIT_OPTIMIZED
886 throw new NotImplementedException ();
888 return new nfloat ((float)v.v);
890 return new nfloat ((double)v.v);
894 public static explicit operator nint (IntPtr v)
896 #if NINT_JIT_OPTIMIZED
897 throw new NotImplementedException ();
899 return new nint (*((int *)&v));
901 return new nint (*((long *)&v));
905 public static explicit operator IntPtr (nint v)
907 #if NINT_JIT_OPTIMIZED
908 throw new NotImplementedException ();
910 return *((IntPtr *)&v.v);
912 return *((IntPtr *)&v.v);
916 public static implicit operator nint (sbyte v)
918 #if NINT_JIT_OPTIMIZED
919 throw new NotImplementedException ();
921 return new nint ((int)v);
923 return new nint ((long)v);
927 public static explicit operator sbyte (nint v)
929 #if NINT_JIT_OPTIMIZED
930 throw new NotImplementedException ();
938 public static implicit operator nint (byte v)
940 #if NINT_JIT_OPTIMIZED
941 throw new NotImplementedException ();
943 return new nint ((int)v);
945 return new nint ((long)v);
949 public static explicit operator byte (nint v)
951 #if NINT_JIT_OPTIMIZED
952 throw new NotImplementedException ();
960 public static implicit operator nint (char v)
962 #if NINT_JIT_OPTIMIZED
963 throw new NotImplementedException ();
965 return new nint ((int)v);
967 return new nint ((long)v);
971 public static explicit operator char (nint v)
973 #if NINT_JIT_OPTIMIZED
974 throw new NotImplementedException ();
982 public static implicit operator nint (short v)
984 #if NINT_JIT_OPTIMIZED
985 throw new NotImplementedException ();
987 return new nint ((int)v);
989 return new nint ((long)v);
993 public static explicit operator short (nint v)
995 #if NINT_JIT_OPTIMIZED
996 throw new NotImplementedException ();
1004 public static explicit operator nint (ushort v)
1006 #if NINT_JIT_OPTIMIZED
1007 throw new NotImplementedException ();
1009 return new nint ((int)v);
1011 return new nint ((long)v);
1015 public static explicit operator ushort (nint v)
1017 #if NINT_JIT_OPTIMIZED
1018 throw new NotImplementedException ();
1026 public static implicit operator nint (int v)
1028 #if NINT_JIT_OPTIMIZED
1029 throw new NotImplementedException ();
1031 return new nint ((int)v);
1033 return new nint ((long)v);
1037 public static explicit operator int (nint v)
1039 #if NINT_JIT_OPTIMIZED
1040 throw new NotImplementedException ();
1048 public static explicit operator nint (uint v)
1050 #if NINT_JIT_OPTIMIZED
1051 throw new NotImplementedException ();
1053 return new nint ((int)v);
1055 return new nint ((long)v);
1059 public static explicit operator uint (nint v)
1061 #if NINT_JIT_OPTIMIZED
1062 throw new NotImplementedException ();
1070 public static explicit operator nint (long v)
1072 #if NINT_JIT_OPTIMIZED
1073 throw new NotImplementedException ();
1075 return new nint ((int)v);
1077 return new nint ((long)v);
1081 public static implicit operator long (nint v)
1083 #if NINT_JIT_OPTIMIZED
1084 throw new NotImplementedException ();
1092 public static explicit operator nint (ulong v)
1094 #if NINT_JIT_OPTIMIZED
1095 throw new NotImplementedException ();
1097 return new nint ((int)v);
1099 return new nint ((long)v);
1103 public static explicit operator ulong (nint v)
1105 #if NINT_JIT_OPTIMIZED
1106 throw new NotImplementedException ();
1114 public static explicit operator nint (float v)
1116 #if NINT_JIT_OPTIMIZED
1117 throw new NotImplementedException ();
1119 return new nint ((int)v);
1121 return new nint ((long)v);
1125 public static implicit operator float (nint v)
1127 #if NINT_JIT_OPTIMIZED
1128 throw new NotImplementedException ();
1136 public static explicit operator nint (double v)
1138 #if NINT_JIT_OPTIMIZED
1139 throw new NotImplementedException ();
1141 return new nint ((int)v);
1143 return new nint ((long)v);
1147 public static implicit operator double (nint v)
1149 #if NINT_JIT_OPTIMIZED
1150 throw new NotImplementedException ();
1158 public static explicit operator nint (decimal v)
1160 #if NINT_JIT_OPTIMIZED
1161 throw new NotImplementedException ();
1163 return new nint ((int)v);
1165 return new nint ((long)v);
1169 public static implicit operator decimal (nint v)
1171 #if NINT_JIT_OPTIMIZED
1172 throw new NotImplementedException ();
1174 return (decimal)v.v;
1176 return (decimal)v.v;
1180 #if NINT_JIT_OPTIMIZED
1181 public static nint operator + (nint v) { throw new NotImplementedException (); }
1182 public static nint operator - (nint v) { throw new NotImplementedException (); }
1183 public static nint operator ~ (nint v) { throw new NotImplementedException (); }
1185 public static nint operator + (nint v) { return new nint (+v.v); }
1186 public static nint operator - (nint v) { return new nint (-v.v); }
1187 public static nint operator ~ (nint v) { return new nint (~v.v); }
1190 #if NINT_JIT_OPTIMIZED
1191 public static nint operator ++ (nint v) { throw new NotImplementedException (); }
1192 public static nint operator -- (nint v) { throw new NotImplementedException (); }
1194 public static nint operator ++ (nint v) { return new nint (v.v + 1); }
1195 public static nint operator -- (nint v) { return new nint (v.v - 1); }
1198 #if NINT_JIT_OPTIMIZED
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 (); }
1205 public static nint operator | (nint l, nint r) { throw new NotImplementedException (); }
1206 public static nint operator ^ (nint l, nint r) { throw new NotImplementedException (); }
1208 public static nint operator << (nint l, int r) { throw new NotImplementedException (); }
1209 public static nint operator >> (nint l, int r) { throw new NotImplementedException (); }
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); }
1217 public static nint operator | (nint l, nint r) { return new nint (l.v | r.v); }
1218 public static nint operator ^ (nint l, nint r) { return new nint (l.v ^ r.v); }
1220 public static nint operator << (nint l, int r) { return new nint (l.v << r); }
1221 public static nint operator >> (nint l, int r) { return new nint (l.v >> r); }
1224 #if NINT_JIT_OPTIMIZED
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 (); }
1229 public static bool operator <= (nint l, nint r) { throw new NotImplementedException (); }
1230 public static bool operator >= (nint l, nint r) { throw new NotImplementedException (); }
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; }
1236 public static bool operator <= (nint l, nint r) { return l.v <= r.v; }
1237 public static bool operator >= (nint l, nint r) { return l.v >= r.v; }
1240 public int CompareTo (nint value) { return v.CompareTo (value.v); }
1241 public int CompareTo (object value)
1244 return v.CompareTo (((nint) value).v);
1245 return v.CompareTo (value);
1247 public bool Equals (nint obj) { return v.Equals (obj.v); }
1248 public override bool Equals (object obj)
1251 return v.Equals (((nint) obj).v);
1252 return v.Equals (obj);
1254 public override int GetHashCode () { return v.GetHashCode (); }
1257 public static nint Parse (string s, IFormatProvider provider) { return (nint)Int32.Parse (s, provider); }
1258 public static nint Parse (string s, NumberStyles style) { return (nint)Int32.Parse (s, style); }
1259 public static nint Parse (string s) { return (nint)Int32.Parse (s); }
1260 public static nint Parse (string s, NumberStyles style, IFormatProvider provider) {
1261 return (nint)Int32.Parse (s, style, provider);
1264 public static bool TryParse (string s, out nint result)
1267 var r = Int32.TryParse (s, out v);
1272 public static bool TryParse (string s, NumberStyles style, IFormatProvider provider, out nint result)
1275 var r = Int32.TryParse (s, style, provider, out v);
1280 public static nint Parse (string s, IFormatProvider provider) { return (nint)Int64.Parse (s, provider); }
1281 public static nint Parse (string s, NumberStyles style) { return (nint)Int64.Parse (s, style); }
1282 public static nint Parse (string s) { return (nint)Int64.Parse (s); }
1283 public static nint Parse (string s, NumberStyles style, IFormatProvider provider) {
1284 return (nint)Int64.Parse (s, style, provider);
1287 public static bool TryParse (string s, out nint result)
1290 var r = Int64.TryParse (s, out v);
1295 public static bool TryParse (string s, NumberStyles style, IFormatProvider provider, out nint result)
1298 var r = Int64.TryParse (s, style, provider, out v);
1304 public override string ToString () { return v.ToString (); }
1305 public string ToString (IFormatProvider provider) { return v.ToString (provider); }
1306 public string ToString (string format) { return v.ToString (format); }
1307 public string ToString (string format, IFormatProvider provider) { return v.ToString (format, provider); }
1309 public TypeCode GetTypeCode () { return v.GetTypeCode (); }
1311 bool IConvertible.ToBoolean (IFormatProvider provider) { return ((IConvertible)v).ToBoolean (provider); }
1312 byte IConvertible.ToByte (IFormatProvider provider) { return ((IConvertible)v).ToByte (provider); }
1313 char IConvertible.ToChar (IFormatProvider provider) { return ((IConvertible)v).ToChar (provider); }
1314 DateTime IConvertible.ToDateTime (IFormatProvider provider) { return ((IConvertible)v).ToDateTime (provider); }
1315 decimal IConvertible.ToDecimal (IFormatProvider provider) { return ((IConvertible)v).ToDecimal (provider); }
1316 double IConvertible.ToDouble (IFormatProvider provider) { return ((IConvertible)v).ToDouble (provider); }
1317 short IConvertible.ToInt16 (IFormatProvider provider) { return ((IConvertible)v).ToInt16 (provider); }
1318 int IConvertible.ToInt32 (IFormatProvider provider) { return ((IConvertible)v).ToInt32 (provider); }
1319 long IConvertible.ToInt64 (IFormatProvider provider) { return ((IConvertible)v).ToInt64 (provider); }
1320 sbyte IConvertible.ToSByte (IFormatProvider provider) { return ((IConvertible)v).ToSByte (provider); }
1321 float IConvertible.ToSingle (IFormatProvider provider) { return ((IConvertible)v).ToSingle (provider); }
1322 ushort IConvertible.ToUInt16 (IFormatProvider provider) { return ((IConvertible)v).ToUInt16 (provider); }
1323 uint IConvertible.ToUInt32 (IFormatProvider provider) { return ((IConvertible)v).ToUInt32 (provider); }
1324 ulong IConvertible.ToUInt64 (IFormatProvider provider) { return ((IConvertible)v).ToUInt64 (provider); }
1326 object IConvertible.ToType (Type targetType, IFormatProvider provider) {
1327 return ((IConvertible)v).ToType (targetType, provider);
1330 public static void CopyArray (IntPtr source, nint [] destination, int startIndex, int length)
1332 if (source == IntPtr.Zero)
1333 throw new ArgumentNullException ("source");
1334 if (destination == null)
1335 throw new ArgumentNullException ("destination");
1336 if (destination.Rank != 1)
1337 throw new ArgumentException ("destination", "array is multi-dimensional");
1339 throw new ArgumentException ("startIndex", "must be >= 0");
1341 throw new ArgumentException ("length", "must be >= 0");
1342 if (startIndex + length > destination.Length)
1343 throw new ArgumentException ("length", "startIndex + length > destination.Length");
1345 for (int i = 0; i < length; i++)
1346 destination [i + startIndex] = (nint)Marshal.ReadIntPtr (source, i * nint.Size);
1349 public static void CopyArray (nint [] source, int startIndex, IntPtr destination, int length)
1352 throw new ArgumentNullException ("source");
1353 if (destination == IntPtr.Zero)
1354 throw new ArgumentNullException ("destination");
1355 if (source.Rank != 1)
1356 throw new ArgumentException ("source", "array is multi-dimensional");
1358 throw new ArgumentException ("startIndex", "must be >= 0");
1360 throw new ArgumentException ("length", "must be >= 0");
1361 if (startIndex + length > source.Length)
1362 throw new ArgumentException ("length", "startIndex + length > source.Length");
1364 for (int i = 0; i < length; i++)
1365 Marshal.WriteIntPtr (destination, i * nint.Size, (IntPtr)source [i + startIndex]);
1369 [DebuggerDisplay ("{v,nq}")]
1370 public unsafe struct nuint : IFormattable, IConvertible, IComparable, IComparable<nuint>, IEquatable <nuint>
1372 internal nuint (nuint v) { this.v = v.v; }
1373 public nuint (UInt32 v) { this.v = v; }
1376 public static readonly int Size = 4;
1378 public static readonly nuint MaxValue = UInt32.MaxValue;
1379 public static readonly nuint MinValue = UInt32.MinValue;
1381 [DebuggerBrowsable (DebuggerBrowsableState.Never)]
1384 public nuint (UInt64 v) { this.v = (UInt32)v; }
1386 public static readonly int Size = 8;
1388 public static readonly nuint MaxValue = (nuint) UInt64.MaxValue; // 64-bit only codepath
1389 public static readonly nuint MinValue = (nuint) UInt64.MinValue; // 64-bit only codepath
1391 [DebuggerBrowsable (DebuggerBrowsableState.Never)]
1394 public nuint (UInt64 v) { this.v = v; }
1397 public static explicit operator nuint (nfloat v)
1399 #if NINT_JIT_OPTIMIZED
1400 throw new NotImplementedException ();
1402 return new nuint ((uint)v.v);
1404 return new nuint ((ulong)v.v);
1408 public static implicit operator nfloat (nuint v)
1410 #if NINT_JIT_OPTIMIZED
1411 throw new NotImplementedException ();
1413 return new nfloat ((float)v.v);
1415 return new nfloat ((double)v.v);
1419 public static explicit operator nuint (IntPtr v)
1421 #if NINT_JIT_OPTIMIZED
1422 throw new NotImplementedException ();
1424 return new nuint (*((uint *)&v));
1426 return new nuint (*((ulong *)&v));
1430 public static explicit operator IntPtr (nuint v)
1432 #if NINT_JIT_OPTIMIZED
1433 throw new NotImplementedException ();
1435 return *((IntPtr *)&v.v);
1437 return *((IntPtr *)&v.v);
1441 public static explicit operator nuint (sbyte v)
1443 #if NINT_JIT_OPTIMIZED
1444 throw new NotImplementedException ();
1446 return new nuint ((uint)v);
1448 return new nuint ((ulong)v);
1452 public static explicit operator sbyte (nuint v)
1454 #if NINT_JIT_OPTIMIZED
1455 throw new NotImplementedException ();
1463 public static implicit operator nuint (byte v)
1465 #if NINT_JIT_OPTIMIZED
1466 throw new NotImplementedException ();
1468 return new nuint ((uint)v);
1470 return new nuint ((ulong)v);
1474 public static explicit operator byte (nuint v)
1476 #if NINT_JIT_OPTIMIZED
1477 throw new NotImplementedException ();
1485 public static implicit operator nuint (char v)
1487 #if NINT_JIT_OPTIMIZED
1488 throw new NotImplementedException ();
1490 return new nuint ((uint)v);
1492 return new nuint ((ulong)v);
1496 public static explicit operator char (nuint v)
1498 #if NINT_JIT_OPTIMIZED
1499 throw new NotImplementedException ();
1507 public static explicit operator nuint (short v)
1509 #if NINT_JIT_OPTIMIZED
1510 throw new NotImplementedException ();
1512 return new nuint ((uint)v);
1514 return new nuint ((ulong)v);
1518 public static explicit operator short (nuint v)
1520 #if NINT_JIT_OPTIMIZED
1521 throw new NotImplementedException ();
1529 public static implicit operator nuint (ushort v)
1531 #if NINT_JIT_OPTIMIZED
1532 throw new NotImplementedException ();
1534 return new nuint ((uint)v);
1536 return new nuint ((ulong)v);
1540 public static explicit operator ushort (nuint v)
1542 #if NINT_JIT_OPTIMIZED
1543 throw new NotImplementedException ();
1551 public static explicit operator nuint (int v)
1553 #if NINT_JIT_OPTIMIZED
1554 throw new NotImplementedException ();
1556 return new nuint ((uint)v);
1558 return new nuint ((ulong)v);
1562 public static explicit operator int (nuint v)
1564 #if NINT_JIT_OPTIMIZED
1565 throw new NotImplementedException ();
1573 public static implicit operator nuint (uint v)
1575 #if NINT_JIT_OPTIMIZED
1576 throw new NotImplementedException ();
1578 return new nuint ((uint)v);
1580 return new nuint ((ulong)v);
1584 public static explicit operator uint (nuint v)
1586 #if NINT_JIT_OPTIMIZED
1587 throw new NotImplementedException ();
1595 public static explicit operator nuint (long v)
1597 #if NINT_JIT_OPTIMIZED
1598 throw new NotImplementedException ();
1600 return new nuint ((uint)v);
1602 return new nuint ((ulong)v);
1606 public static explicit operator long (nuint v)
1608 #if NINT_JIT_OPTIMIZED
1609 throw new NotImplementedException ();
1617 public static explicit operator nuint (ulong v)
1619 #if NINT_JIT_OPTIMIZED
1620 throw new NotImplementedException ();
1622 return new nuint ((uint)v);
1624 return new nuint ((ulong)v);
1628 public static implicit operator ulong (nuint v)
1630 #if NINT_JIT_OPTIMIZED
1631 throw new NotImplementedException ();
1639 public static explicit operator nuint (float v)
1641 #if NINT_JIT_OPTIMIZED
1642 throw new NotImplementedException ();
1644 return new nuint ((uint)v);
1646 return new nuint ((ulong)v);
1650 public static implicit operator float (nuint v)
1652 #if NINT_JIT_OPTIMIZED
1653 throw new NotImplementedException ();
1661 public static explicit operator nuint (double v)
1663 #if NINT_JIT_OPTIMIZED
1664 throw new NotImplementedException ();
1666 return new nuint ((uint)v);
1668 return new nuint ((ulong)v);
1672 public static implicit operator double (nuint v)
1674 #if NINT_JIT_OPTIMIZED
1675 throw new NotImplementedException ();
1683 public static explicit operator nuint (decimal v)
1685 #if NINT_JIT_OPTIMIZED
1686 throw new NotImplementedException ();
1688 return new nuint ((uint)v);
1690 return new nuint ((ulong)v);
1694 public static implicit operator decimal (nuint v)
1696 #if NINT_JIT_OPTIMIZED
1697 throw new NotImplementedException ();
1699 return (decimal)v.v;
1701 return (decimal)v.v;
1705 #if NINT_JIT_OPTIMIZED
1706 public static nuint operator + (nuint v) { throw new NotImplementedException (); }
1707 public static nuint operator ~ (nuint v) { throw new NotImplementedException (); }
1709 public static nuint operator + (nuint v) { return new nuint (+v.v); }
1710 public static nuint operator ~ (nuint v) { return new nuint (~v.v); }
1713 #if NINT_JIT_OPTIMIZED
1714 public static nuint operator ++ (nuint v) { throw new NotImplementedException (); }
1715 public static nuint operator -- (nuint v) { throw new NotImplementedException (); }
1717 public static nuint operator ++ (nuint v) { return new nuint (v.v + 1); }
1718 public static nuint operator -- (nuint v) { return new nuint (v.v - 1); }
1721 #if NINT_JIT_OPTIMIZED
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 (); }
1728 public static nuint operator | (nuint l, nuint r) { throw new NotImplementedException (); }
1729 public static nuint operator ^ (nuint l, nuint r) { throw new NotImplementedException (); }
1731 public static nuint operator << (nuint l, int r) { throw new NotImplementedException (); }
1732 public static nuint operator >> (nuint l, int r) { throw new NotImplementedException (); }
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); }
1740 public static nuint operator | (nuint l, nuint r) { return new nuint (l.v | r.v); }
1741 public static nuint operator ^ (nuint l, nuint r) { return new nuint (l.v ^ r.v); }
1743 public static nuint operator << (nuint l, int r) { return new nuint (l.v << r); }
1744 public static nuint operator >> (nuint l, int r) { return new nuint (l.v >> r); }
1747 #if NINT_JIT_OPTIMIZED
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 (); }
1752 public static bool operator <= (nuint l, nuint r) { throw new NotImplementedException (); }
1753 public static bool operator >= (nuint l, nuint r) { throw new NotImplementedException (); }
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; }
1759 public static bool operator <= (nuint l, nuint r) { return l.v <= r.v; }
1760 public static bool operator >= (nuint l, nuint r) { return l.v >= r.v; }
1763 public int CompareTo (nuint value) { return v.CompareTo (value.v); }
1764 public int CompareTo (object value)
1767 return v.CompareTo (((nuint) value).v);
1768 return v.CompareTo (value);
1770 public bool Equals (nuint obj) { return v.Equals (obj.v); }
1771 public override bool Equals (object obj)
1774 return v.Equals (((nuint) obj).v);
1775 return v.Equals (obj);
1777 public override int GetHashCode () { return v.GetHashCode (); }
1780 public static nuint Parse (string s, IFormatProvider provider) { return (nuint)UInt32.Parse (s, provider); }
1781 public static nuint Parse (string s, NumberStyles style) { return (nuint)UInt32.Parse (s, style); }
1782 public static nuint Parse (string s) { return (nuint)UInt32.Parse (s); }
1783 public static nuint Parse (string s, NumberStyles style, IFormatProvider provider) {
1784 return (nuint)UInt32.Parse (s, style, provider);
1787 public static bool TryParse (string s, out nuint result)
1790 var r = UInt32.TryParse (s, out v);
1795 public static bool TryParse (string s, NumberStyles style, IFormatProvider provider, out nuint result)
1798 var r = UInt32.TryParse (s, style, provider, out v);
1803 public static nuint Parse (string s, IFormatProvider provider) { return (nuint)UInt64.Parse (s, provider); }
1804 public static nuint Parse (string s, NumberStyles style) { return (nuint)UInt64.Parse (s, style); }
1805 public static nuint Parse (string s) { return (nuint)UInt64.Parse (s); }
1806 public static nuint Parse (string s, NumberStyles style, IFormatProvider provider) {
1807 return (nuint)UInt64.Parse (s, style, provider);
1810 public static bool TryParse (string s, out nuint result)
1813 var r = UInt64.TryParse (s, out v);
1818 public static bool TryParse (string s, NumberStyles style, IFormatProvider provider, out nuint result)
1821 var r = UInt64.TryParse (s, style, provider, out v);
1827 public override string ToString () { return v.ToString (); }
1828 public string ToString (IFormatProvider provider) { return v.ToString (provider); }
1829 public string ToString (string format) { return v.ToString (format); }
1830 public string ToString (string format, IFormatProvider provider) { return v.ToString (format, provider); }
1832 public TypeCode GetTypeCode () { return v.GetTypeCode (); }
1834 bool IConvertible.ToBoolean (IFormatProvider provider) { return ((IConvertible)v).ToBoolean (provider); }
1835 byte IConvertible.ToByte (IFormatProvider provider) { return ((IConvertible)v).ToByte (provider); }
1836 char IConvertible.ToChar (IFormatProvider provider) { return ((IConvertible)v).ToChar (provider); }
1837 DateTime IConvertible.ToDateTime (IFormatProvider provider) { return ((IConvertible)v).ToDateTime (provider); }
1838 decimal IConvertible.ToDecimal (IFormatProvider provider) { return ((IConvertible)v).ToDecimal (provider); }
1839 double IConvertible.ToDouble (IFormatProvider provider) { return ((IConvertible)v).ToDouble (provider); }
1840 short IConvertible.ToInt16 (IFormatProvider provider) { return ((IConvertible)v).ToInt16 (provider); }
1841 int IConvertible.ToInt32 (IFormatProvider provider) { return ((IConvertible)v).ToInt32 (provider); }
1842 long IConvertible.ToInt64 (IFormatProvider provider) { return ((IConvertible)v).ToInt64 (provider); }
1843 sbyte IConvertible.ToSByte (IFormatProvider provider) { return ((IConvertible)v).ToSByte (provider); }
1844 float IConvertible.ToSingle (IFormatProvider provider) { return ((IConvertible)v).ToSingle (provider); }
1845 ushort IConvertible.ToUInt16 (IFormatProvider provider) { return ((IConvertible)v).ToUInt16 (provider); }
1846 uint IConvertible.ToUInt32 (IFormatProvider provider) { return ((IConvertible)v).ToUInt32 (provider); }
1847 ulong IConvertible.ToUInt64 (IFormatProvider provider) { return ((IConvertible)v).ToUInt64 (provider); }
1849 object IConvertible.ToType (Type targetType, IFormatProvider provider) {
1850 return ((IConvertible)v).ToType (targetType, provider);
1853 public static void CopyArray (IntPtr source, nuint [] destination, int startIndex, int length)
1855 if (source == IntPtr.Zero)
1856 throw new ArgumentNullException ("source");
1857 if (destination == null)
1858 throw new ArgumentNullException ("destination");
1859 if (destination.Rank != 1)
1860 throw new ArgumentException ("destination", "array is multi-dimensional");
1862 throw new ArgumentException ("startIndex", "must be >= 0");
1864 throw new ArgumentException ("length", "must be >= 0");
1865 if (startIndex + length > destination.Length)
1866 throw new ArgumentException ("length", "startIndex + length > destination.Length");
1868 for (int i = 0; i < length; i++)
1869 destination [i + startIndex] = (nuint)Marshal.ReadIntPtr (source, i * nuint.Size);
1872 public static void CopyArray (nuint [] source, int startIndex, IntPtr destination, int length)
1875 throw new ArgumentNullException ("source");
1876 if (destination == IntPtr.Zero)
1877 throw new ArgumentNullException ("destination");
1878 if (source.Rank != 1)
1879 throw new ArgumentException ("source", "array is multi-dimensional");
1881 throw new ArgumentException ("startIndex", "must be >= 0");
1883 throw new ArgumentException ("length", "must be >= 0");
1884 if (startIndex + length > source.Length)
1885 throw new ArgumentException ("length", "startIndex + length > source.Length");
1887 for (int i = 0; i < length; i++)
1888 Marshal.WriteIntPtr (destination, i * nuint.Size, (IntPtr)source [i + startIndex]);
1892 [DebuggerDisplay ("{v,nq}")]
1893 public unsafe struct nfloat : IFormattable, IConvertible, IComparable, IComparable<nfloat>, IEquatable <nfloat>
1895 internal nfloat (nfloat v) { this.v = v.v; }
1896 public nfloat (Single v) { this.v = v; }
1899 public static readonly int Size = 4;
1901 public static readonly nfloat MaxValue = Single.MaxValue;
1902 public static readonly nfloat MinValue = Single.MinValue;
1903 public static readonly nfloat Epsilon = (nfloat)Single.Epsilon;
1904 public static readonly nfloat NaN = (nfloat)Single.NaN;
1905 public static readonly nfloat NegativeInfinity = (nfloat)Single.NegativeInfinity;
1906 public static readonly nfloat PositiveInfinity = (nfloat)Single.PositiveInfinity;
1908 [DebuggerBrowsable (DebuggerBrowsableState.Never)]
1911 public nfloat (Double v) { this.v = (Single)v; }
1913 public static readonly int Size = 8;
1915 public static readonly nfloat MaxValue = (nfloat) Double.MaxValue; // 64-bit only codepath
1916 public static readonly nfloat MinValue = (nfloat) Double.MinValue; // 64-bit only codepath
1917 public static readonly nfloat Epsilon = (nfloat)Double.Epsilon;
1918 public static readonly nfloat NaN = (nfloat)Double.NaN;
1919 public static readonly nfloat NegativeInfinity = (nfloat)Double.NegativeInfinity;
1920 public static readonly nfloat PositiveInfinity = (nfloat)Double.PositiveInfinity;
1922 [DebuggerBrowsable (DebuggerBrowsableState.Never)]
1925 public nfloat (Double v) { this.v = v; }
1928 public static explicit operator nfloat (IntPtr v)
1930 #if NINT_JIT_OPTIMIZED
1931 throw new NotImplementedException ();
1933 return new nfloat (*((float *)&v));
1935 return new nfloat (*((double *)&v));
1939 public static explicit operator IntPtr (nfloat v)
1941 #if NINT_JIT_OPTIMIZED
1942 throw new NotImplementedException ();
1944 return *((IntPtr *)&v.v);
1946 return *((IntPtr *)&v.v);
1950 public static implicit operator nfloat (sbyte v)
1952 #if NINT_JIT_OPTIMIZED
1953 throw new NotImplementedException ();
1955 return new nfloat ((float)v);
1957 return new nfloat ((double)v);
1961 public static explicit operator sbyte (nfloat v)
1963 #if NINT_JIT_OPTIMIZED
1964 throw new NotImplementedException ();
1972 public static implicit operator nfloat (byte v)
1974 #if NINT_JIT_OPTIMIZED
1975 throw new NotImplementedException ();
1977 return new nfloat ((float)v);
1979 return new nfloat ((double)v);
1983 public static explicit operator byte (nfloat v)
1985 #if NINT_JIT_OPTIMIZED
1986 throw new NotImplementedException ();
1994 public static implicit operator nfloat (char v)
1996 #if NINT_JIT_OPTIMIZED
1997 throw new NotImplementedException ();
1999 return new nfloat ((float)v);
2001 return new nfloat ((double)v);
2005 public static explicit operator char (nfloat v)
2007 #if NINT_JIT_OPTIMIZED
2008 throw new NotImplementedException ();
2016 public static implicit operator nfloat (short v)
2018 #if NINT_JIT_OPTIMIZED
2019 throw new NotImplementedException ();
2021 return new nfloat ((float)v);
2023 return new nfloat ((double)v);
2027 public static explicit operator short (nfloat v)
2029 #if NINT_JIT_OPTIMIZED
2030 throw new NotImplementedException ();
2038 public static implicit operator nfloat (ushort v)
2040 #if NINT_JIT_OPTIMIZED
2041 throw new NotImplementedException ();
2043 return new nfloat ((float)v);
2045 return new nfloat ((double)v);
2049 public static explicit operator ushort (nfloat v)
2051 #if NINT_JIT_OPTIMIZED
2052 throw new NotImplementedException ();
2060 public static implicit operator nfloat (int v)
2062 #if NINT_JIT_OPTIMIZED
2063 throw new NotImplementedException ();
2065 return new nfloat ((float)v);
2067 return new nfloat ((double)v);
2071 public static explicit operator int (nfloat v)
2073 #if NINT_JIT_OPTIMIZED
2074 throw new NotImplementedException ();
2082 public static implicit operator nfloat (uint v)
2084 #if NINT_JIT_OPTIMIZED
2085 throw new NotImplementedException ();
2087 return new nfloat ((float)v);
2089 return new nfloat ((double)v);
2093 public static explicit operator uint (nfloat v)
2095 #if NINT_JIT_OPTIMIZED
2096 throw new NotImplementedException ();
2104 public static implicit operator nfloat (long v)
2106 #if NINT_JIT_OPTIMIZED
2107 throw new NotImplementedException ();
2109 return new nfloat ((float)v);
2111 return new nfloat ((double)v);
2115 public static explicit operator long (nfloat v)
2117 #if NINT_JIT_OPTIMIZED
2118 throw new NotImplementedException ();
2126 public static implicit operator nfloat (ulong v)
2128 #if NINT_JIT_OPTIMIZED
2129 throw new NotImplementedException ();
2131 return new nfloat ((float)v);
2133 return new nfloat ((double)v);
2137 public static explicit operator ulong (nfloat v)
2139 #if NINT_JIT_OPTIMIZED
2140 throw new NotImplementedException ();
2148 public static implicit operator nfloat (float v)
2150 #if NINT_JIT_OPTIMIZED
2151 throw new NotImplementedException ();
2153 return new nfloat ((float)v);
2155 return new nfloat ((double)v);
2159 public static explicit operator float (nfloat v)
2161 #if NINT_JIT_OPTIMIZED
2162 throw new NotImplementedException ();
2170 public static explicit operator nfloat (double v)
2172 #if NINT_JIT_OPTIMIZED
2173 throw new NotImplementedException ();
2175 return new nfloat ((float)v);
2177 return new nfloat ((double)v);
2181 public static implicit operator double (nfloat v)
2183 #if NINT_JIT_OPTIMIZED
2184 throw new NotImplementedException ();
2192 public static explicit operator nfloat (decimal v)
2194 #if NINT_JIT_OPTIMIZED
2195 throw new NotImplementedException ();
2197 return new nfloat ((float)v);
2199 return new nfloat ((double)v);
2203 public static explicit operator decimal (nfloat v)
2205 #if NINT_JIT_OPTIMIZED
2206 throw new NotImplementedException ();
2208 return (decimal)v.v;
2210 return (decimal)v.v;
2214 #if NINT_JIT_OPTIMIZED
2215 public static nfloat operator + (nfloat v) { throw new NotImplementedException (); }
2216 public static nfloat operator - (nfloat v) { throw new NotImplementedException (); }
2218 public static nfloat operator + (nfloat v) { return new nfloat (+v.v); }
2219 public static nfloat operator - (nfloat v) { return new nfloat (-v.v); }
2222 #if NINT_JIT_OPTIMIZED
2223 public static nfloat operator ++ (nfloat v) { throw new NotImplementedException (); }
2224 public static nfloat operator -- (nfloat v) { throw new NotImplementedException (); }
2226 public static nfloat operator ++ (nfloat v) { return new nfloat (v.v + 1); }
2227 public static nfloat operator -- (nfloat v) { return new nfloat (v.v - 1); }
2230 #if NINT_JIT_OPTIMIZED
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 (); }
2234 public static nfloat operator / (nfloat l, nfloat r) { throw new NotImplementedException (); }
2235 public static nfloat operator % (nfloat l, nfloat r) { throw new NotImplementedException (); }
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); }
2240 public static nfloat operator / (nfloat l, nfloat r) { return new nfloat (l.v / r.v); }
2241 public static nfloat operator % (nfloat l, nfloat r) { return new nfloat (l.v % r.v); }
2244 #if NINT_JIT_OPTIMIZED
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 (); }
2249 public static bool operator <= (nfloat l, nfloat r) { throw new NotImplementedException (); }
2250 public static bool operator >= (nfloat l, nfloat r) { throw new NotImplementedException (); }
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; }
2256 public static bool operator <= (nfloat l, nfloat r) { return l.v <= r.v; }
2257 public static bool operator >= (nfloat l, nfloat r) { return l.v >= r.v; }
2260 public int CompareTo (nfloat value) { return v.CompareTo (value.v); }
2261 public int CompareTo (object value)
2263 if (value is nfloat)
2264 return v.CompareTo (((nfloat) value).v);
2265 return v.CompareTo (value);
2267 public bool Equals (nfloat obj) { return v.Equals (obj.v); }
2268 public override bool Equals (object obj)
2271 return v.Equals (((nfloat) obj).v);
2272 return v.Equals (obj);
2274 public override int GetHashCode () { return v.GetHashCode (); }
2277 public static bool IsNaN (nfloat f) { return Single.IsNaN ((Single)f); }
2278 public static bool IsInfinity (nfloat f) { return Single.IsInfinity ((Single)f); }
2279 public static bool IsPositiveInfinity (nfloat f) { return Single.IsPositiveInfinity ((Single)f); }
2280 public static bool IsNegativeInfinity (nfloat f) { return Single.IsNegativeInfinity ((Single)f); }
2282 public static nfloat Parse (string s, IFormatProvider provider) { return (nfloat)Single.Parse (s, provider); }
2283 public static nfloat Parse (string s, NumberStyles style) { return (nfloat)Single.Parse (s, style); }
2284 public static nfloat Parse (string s) { return (nfloat)Single.Parse (s); }
2285 public static nfloat Parse (string s, NumberStyles style, IFormatProvider provider) {
2286 return (nfloat)Single.Parse (s, style, provider);
2289 public static bool TryParse (string s, out nfloat result)
2292 var r = Single.TryParse (s, out v);
2297 public static bool TryParse (string s, NumberStyles style, IFormatProvider provider, out nfloat result)
2300 var r = Single.TryParse (s, style, provider, out v);
2305 public static bool IsNaN (nfloat f) { return Double.IsNaN ((Double)f); }
2306 public static bool IsInfinity (nfloat f) { return Double.IsInfinity ((Double)f); }
2307 public static bool IsPositiveInfinity (nfloat f) { return Double.IsPositiveInfinity ((Double)f); }
2308 public static bool IsNegativeInfinity (nfloat f) { return Double.IsNegativeInfinity ((Double)f); }
2310 public static nfloat Parse (string s, IFormatProvider provider) { return (nfloat)Double.Parse (s, provider); }
2311 public static nfloat Parse (string s, NumberStyles style) { return (nfloat)Double.Parse (s, style); }
2312 public static nfloat Parse (string s) { return (nfloat)Double.Parse (s); }
2313 public static nfloat Parse (string s, NumberStyles style, IFormatProvider provider) {
2314 return (nfloat)Double.Parse (s, style, provider);
2317 public static bool TryParse (string s, out nfloat result)
2320 var r = Double.TryParse (s, out v);
2325 public static bool TryParse (string s, NumberStyles style, IFormatProvider provider, out nfloat result)
2328 var r = Double.TryParse (s, style, provider, out v);
2334 public override string ToString () { return v.ToString (); }
2335 public string ToString (IFormatProvider provider) { return v.ToString (provider); }
2336 public string ToString (string format) { return v.ToString (format); }
2337 public string ToString (string format, IFormatProvider provider) { return v.ToString (format, provider); }
2339 public TypeCode GetTypeCode () { return v.GetTypeCode (); }
2341 bool IConvertible.ToBoolean (IFormatProvider provider) { return ((IConvertible)v).ToBoolean (provider); }
2342 byte IConvertible.ToByte (IFormatProvider provider) { return ((IConvertible)v).ToByte (provider); }
2343 char IConvertible.ToChar (IFormatProvider provider) { return ((IConvertible)v).ToChar (provider); }
2344 DateTime IConvertible.ToDateTime (IFormatProvider provider) { return ((IConvertible)v).ToDateTime (provider); }
2345 decimal IConvertible.ToDecimal (IFormatProvider provider) { return ((IConvertible)v).ToDecimal (provider); }
2346 double IConvertible.ToDouble (IFormatProvider provider) { return ((IConvertible)v).ToDouble (provider); }
2347 short IConvertible.ToInt16 (IFormatProvider provider) { return ((IConvertible)v).ToInt16 (provider); }
2348 int IConvertible.ToInt32 (IFormatProvider provider) { return ((IConvertible)v).ToInt32 (provider); }
2349 long IConvertible.ToInt64 (IFormatProvider provider) { return ((IConvertible)v).ToInt64 (provider); }
2350 sbyte IConvertible.ToSByte (IFormatProvider provider) { return ((IConvertible)v).ToSByte (provider); }
2351 float IConvertible.ToSingle (IFormatProvider provider) { return ((IConvertible)v).ToSingle (provider); }
2352 ushort IConvertible.ToUInt16 (IFormatProvider provider) { return ((IConvertible)v).ToUInt16 (provider); }
2353 uint IConvertible.ToUInt32 (IFormatProvider provider) { return ((IConvertible)v).ToUInt32 (provider); }
2354 ulong IConvertible.ToUInt64 (IFormatProvider provider) { return ((IConvertible)v).ToUInt64 (provider); }
2356 object IConvertible.ToType (Type targetType, IFormatProvider provider) {
2357 return ((IConvertible)v).ToType (targetType, provider);
2360 public static void CopyArray (IntPtr source, nfloat [] destination, int startIndex, int length)
2362 if (source == IntPtr.Zero)
2363 throw new ArgumentNullException ("source");
2364 if (destination == null)
2365 throw new ArgumentNullException ("destination");
2366 if (destination.Rank != 1)
2367 throw new ArgumentException ("destination", "array is multi-dimensional");
2369 throw new ArgumentException ("startIndex", "must be >= 0");
2371 throw new ArgumentException ("length", "must be >= 0");
2372 if (startIndex + length > destination.Length)
2373 throw new ArgumentException ("length", "startIndex + length > destination.Length");
2375 for (int i = 0; i < length; i++)
2376 destination [i + startIndex] = (nfloat)Marshal.ReadIntPtr (source, i * nfloat.Size);
2379 public static void CopyArray (nfloat [] source, int startIndex, IntPtr destination, int length)
2382 throw new ArgumentNullException ("source");
2383 if (destination == IntPtr.Zero)
2384 throw new ArgumentNullException ("destination");
2385 if (source.Rank != 1)
2386 throw new ArgumentException ("source", "array is multi-dimensional");
2388 throw new ArgumentException ("startIndex", "must be >= 0");
2390 throw new ArgumentException ("length", "must be >= 0");
2391 if (startIndex + length > source.Length)
2392 throw new ArgumentException ("length", "startIndex + length > source.Length");
2394 for (int i = 0; i < length; i++)
2395 Marshal.WriteIntPtr (destination, i * nfloat.Size, (IntPtr)source [i + startIndex]);