Exemplo n.º 1
0
 static UnmanagedPool()
 {
     Tiny    = new UnmanagedPool(TinySize);
     Default = new UnmanagedPool(DefaultSize);
     RadixSortCountBuffer = new UnmanagedPool(RadixSortCountBufferSize);
     LzwEncodeTableBuffer = new UnmanagedPool(4096 * 256 * 2);
 }
Exemplo n.º 2
0
        /// <summary>
        /// 获取匹配数组
        /// </summary>
        /// <typeparam name="T">数据类型</typeparam>
        /// <typeparam name="VT">目标数组类型</typeparam>
        /// <param name="array">数组数据</param>
        /// <param name="isValue">数据匹配器</param>
        /// <param name="getValue">数据获取器</param>
        /// <returns>匹配数组</returns>
        public unsafe static VT[] getFindArray <T, VT>(this T[] array, Func <T, bool> isValue, Func <T, VT> getValue)
        {
            int length = array.length();

            if (length == 0)
            {
                return(EmptyArray <VT> .Array);
            }
            AutoCSer.Memory.UnmanagedPool pool   = AutoCSer.Memory.UnmanagedPool.GetPool(length = ((length + 63) >> 6) << 3);
            AutoCSer.Memory.Pointer       buffer = pool.GetMinSize(length);
            try
            {
                AutoCSer.Memory.Common.Clear(buffer.ULong, length >> 3);
                return(getFindArray(array, isValue, getValue, new MemoryMap(buffer.Data)));
            }
            finally { pool.Push(ref buffer); }
        }