Beispiel #1
0
 public static void Main(string[] args)
 {
     for (nuint i = 0; i < (nuint)2; i++)
     {
         System.Console.WriteLine(i);
     }
 }
Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #4
0
 public UrhoString(System.nuint value)
 {
     Runtime.Validate(typeof(UrhoString));
     handle = UrhoString_String7(value);
     OnUrhoStringCreated();
 }
Beispiel #5
0
 internal static extern IntPtr UrhoString_String7(System.nuint value);
Beispiel #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);
            }
        }
Beispiel #7
0
 public unsafe nuint PreRealloc(void *pRequest, nuint cbRequest, void **ppNewRequest, BOOL fSpyed)
 => CurrentSpy?.PreRealloc(pRequest, cbRequest, ppNewRequest, fSpyed) ?? cbRequest;
Beispiel #8
0
 private static extern unsafe void __Memmove(byte *dest, byte *src, nuint len);
Beispiel #9
0
 internal static void BulkMoveWithWriteBarrier(ref byte dmem, ref byte smem, nuint size)
 => RuntimeImports.RhBulkMoveWithWriteBarrier(ref dmem, ref smem, size);
Beispiel #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);
        }
Beispiel #11
0
 private static extern void __BulkMoveWithWriteBarrier(ref byte destination, ref byte source, nuint byteCount);
Beispiel #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);
     }
 }
Beispiel #13
0
 private static extern unsafe void __ZeroMemory(void *b, nuint byteLength);
Beispiel #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));
 }
Beispiel #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));
 }
Beispiel #18
0
 public nuint PreAlloc(nuint cbRequest) => CurrentSpy?.PreAlloc(cbRequest) ?? cbRequest;