示例#1
0
 public static void Main(string[] args)
 {
     for (nuint i = 0; i < (nuint)2; i++)
     {
         System.Console.WriteLine(i);
     }
 }
示例#2
0
 public MPMediaQuerySection GetSection(xint index)
 {
     using (var array = new NSArray (Messaging.IntPtr_objc_msgSend (Handle, Selector.GetHandle ("itemSections"))))
         return array.GetItem<MPMediaQuerySection> (index);
 }
示例#3
0
 public MPMediaItem GetItem(xint index)
 {
     using (var array = new NSArray (Messaging.IntPtr_objc_msgSend (Handle, Selector.GetHandle ("items"))))
         return array.GetItem<MPMediaItem> (index);
 }
示例#4
0
 public UrhoString(System.nuint value)
 {
     Runtime.Validate(typeof(UrhoString));
     handle = UrhoString_String7(value);
     OnUrhoStringCreated();
 }
示例#5
0
 internal static extern IntPtr UrhoString_String7(System.nuint value);
示例#6
0
        private static bool TryConvertFromTruncating <TOther>(TOther value, out ushort result)
            where TOther : INumberBase <TOther>
        {
            // In order to reduce overall code duplication and improve the inlinabilty of these
            // methods for the corelib types we have `ConvertFrom` handle the same sign and
            // `ConvertTo` handle the opposite sign. However, since there is an uneven split
            // between signed and unsigned types, the one that handles unsigned will also
            // handle `Decimal`.
            //
            // That is, `ConvertFrom` for `ushort` will handle the other unsigned types and
            // `ConvertTo` will handle the signed types

            if (typeof(TOther) == typeof(byte))
            {
                byte actualValue = (byte)(object)value;
                result = actualValue;
                return(true);
            }
            else if (typeof(TOther) == typeof(char))
            {
                char actualValue = (char)(object)value;
                result = actualValue;
                return(true);
            }
            else if (typeof(TOther) == typeof(decimal))
            {
                decimal actualValue = (decimal)(object)value;
                result = (actualValue >= MaxValue) ? MaxValue :
                         (actualValue <= MinValue) ? MinValue : (ushort)actualValue;
                return(true);
            }
            else if (typeof(TOther) == typeof(uint))
            {
                uint actualValue = (uint)(object)value;
                result = (ushort)actualValue;
                return(true);
            }
            else if (typeof(TOther) == typeof(ulong))
            {
                ulong actualValue = (ulong)(object)value;
                result = (ushort)actualValue;
                return(true);
            }
            else if (typeof(TOther) == typeof(UInt128))
            {
                UInt128 actualValue = (UInt128)(object)value;
                result = (ushort)actualValue;
                return(true);
            }
            else if (typeof(TOther) == typeof(nuint))
            {
                nuint actualValue = (nuint)(object)value;
                result = (ushort)actualValue;
                return(true);
            }
            else
            {
                result = default;
                return(false);
            }
        }
示例#7
0
 public unsafe nuint PreRealloc(void *pRequest, nuint cbRequest, void **ppNewRequest, BOOL fSpyed)
 => CurrentSpy?.PreRealloc(pRequest, cbRequest, ppNewRequest, fSpyed) ?? cbRequest;
示例#8
0
 private static extern unsafe void __Memmove(byte *dest, byte *src, nuint len);
示例#9
0
 internal static void BulkMoveWithWriteBarrier(ref byte dmem, ref byte smem, nuint size)
 => RuntimeImports.RhBulkMoveWithWriteBarrier(ref dmem, ref smem, size);
示例#10
0
        private static void _BulkMoveWithWriteBarrier(ref byte destination, ref byte source, nuint byteCount)
        {
            Debug.Assert(byteCount > BulkMoveWithWriteBarrierChunk);

            if (Unsafe.AreSame(ref source, ref destination))
            {
                return;
            }

            // This is equivalent to: (destination - source) >= byteCount || (destination - source) < 0
            if ((nuint)(nint)Unsafe.ByteOffset(ref source, ref destination) >= byteCount)
            {
                // Copy forwards
                do
                {
                    byteCount -= BulkMoveWithWriteBarrierChunk;
                    __BulkMoveWithWriteBarrier(ref destination, ref source, BulkMoveWithWriteBarrierChunk);
                    destination = ref Unsafe.AddByteOffset(ref destination, BulkMoveWithWriteBarrierChunk);
                    source      = ref Unsafe.AddByteOffset(ref source, BulkMoveWithWriteBarrierChunk);
                }while (byteCount > BulkMoveWithWriteBarrierChunk);
            }
            else
            {
                // Copy backwards
                do
                {
                    byteCount -= BulkMoveWithWriteBarrierChunk;
                    __BulkMoveWithWriteBarrier(ref Unsafe.AddByteOffset(ref destination, byteCount), ref Unsafe.AddByteOffset(ref source, byteCount), BulkMoveWithWriteBarrierChunk);
                }while (byteCount > BulkMoveWithWriteBarrierChunk);
            }
            __BulkMoveWithWriteBarrier(ref destination, ref source, byteCount);
        }
示例#11
0
 private static extern void __BulkMoveWithWriteBarrier(ref byte destination, ref byte source, nuint byteCount);
示例#12
0
 internal static void BulkMoveWithWriteBarrier(ref byte destination, ref byte source, nuint byteCount)
 {
     if (byteCount <= BulkMoveWithWriteBarrierChunk)
     {
         __BulkMoveWithWriteBarrier(ref destination, ref source, byteCount);
     }
     else
     {
         _BulkMoveWithWriteBarrier(ref destination, ref source, byteCount);
     }
 }
示例#13
0
 private static extern unsafe void __ZeroMemory(void *b, nuint byteLength);
示例#14
0
 public nuint PostGetSize(nuint cbActual, BOOL fSpyed)
 => CurrentSpy?.PostGetSize(cbActual, fSpyed) ?? cbActual;
 public MPMediaItem GetItem(xint index)
 {
     using (var array = new NSArray(Messaging.IntPtr_objc_msgSend(Handle, Selector.GetHandle("items"))))
         return(array.GetItem <MPMediaItem> (index));
 }
示例#16
0
 private static unsafe void __Memmove(byte *dest, byte *src, nuint len) =>
 RuntimeImports.memmove(dest, src, len);
 public MPMediaItemCollection GetCollection(xint index)
 {
     using (var array = new NSArray(Messaging.IntPtr_objc_msgSend(Handle, Selector.GetHandle("collections"))))
         return(array.GetItem <MPMediaItemCollection> (index));
 }
示例#18
0
 public nuint PreAlloc(nuint cbRequest) => CurrentSpy?.PreAlloc(cbRequest) ?? cbRequest;