예제 #1
0
 public ExecutionOutput(TimeSpan time, MemorySpan memory, string result, int exitCode)
 {
     this.Time     = time;
     this.Memory   = memory;
     this.Result   = result;
     this.ExitCode = exitCode;
 }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        public static List <float> Decompress(byte[] values)
        {
            var          memory = new MemorySpan(values);
            var          type   = memory.ReadByte();
            List <float> re     = new List <float>(300);
            var          dval   = (float)Math.Pow(10, type);

            if (type == byte.MaxValue)
            {
                while (memory.Position < memory.Length)
                {
                    re.Add(memory.ReadFloat());
                }
            }
            else
            {
                var val = memory.ReadFloat();
                re.Add(val);
                using (ProtoMemory vmemory = new ProtoMemory(values.AsSpan().Slice(9).ToArray()))
                {
                    while (vmemory.ReadPosition < vmemory.DataBuffer.Length)
                    {
                        val += (vmemory.ReadSInt32() / dval);
                        re.Add(val);
                    }
                }
            }
            return(re);
        }
예제 #3
0
파일: Sampler.cs 프로젝트: 0xCM/arrows
 public Sampler(MklRng src, S distspec, int?bufferLen = null)
 {
     this.Source       = src;
     this.BufferLength = bufferLen ?? Pow2.T14;
     this.Buffer       = MemorySpan.Alloc <T>(this.BufferLength);
     this.Remaining    = 0;
     this.DistSpec     = distspec;
 }
예제 #4
0
        public void BinaryStreamTests_MemorySpanTest()
        {
            MemorySpan span = new MemorySpan(new byte[0]);

            span.WriteBytes(ArrayUtils.CreateArray <byte>(1000, 0));
            span.Offset = 0;
            byte[][] buffers = Binary.SplitBytes(span, 90);
            for (int i = 0; i < buffers.Length; ++i)
            {
                Console.WriteLine(buffers[i].Length);
            }
        }
예제 #5
0
 public ExecutingOptions(TimeSpan timeLimit, MemorySpan memoryLimit)
 {
     this.TimeLimit   = timeLimit;
     this.MemoryLimit = memoryLimit;
 }