コード例 #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
ファイル: UrhoString.cs プロジェクト: vladkol/urho
 public UrhoString(System.nuint value)
 {
     Runtime.Validate(typeof(UrhoString));
     handle = UrhoString_String7(value);
     OnUrhoStringCreated();
 }
コード例 #5
0
ファイル: UrhoString.cs プロジェクト: vladkol/urho
 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;
コード例 #15
0
 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);
コード例 #17
0
 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;