当前位置: 首页>>代码示例>>C#>>正文


C# Pointer.Copy64方法代码示例

本文整理汇总了C#中Pointer.Copy64方法的典型用法代码示例。如果您正苦于以下问题:C# Pointer.Copy64方法的具体用法?C# Pointer.Copy64怎么用?C# Pointer.Copy64使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pointer的用法示例。


在下文中一共展示了Pointer.Copy64方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AppendFromSelf

        public bool AppendFromSelf(int offset, int len)
        {
            int spaceLeft = _length - _index;

            if(_index <= offset - 1u)
            {
                // -1u catches offset==0
                return false;
            }

            var op = new Pointer(_buffer, _index);
            if(len <= 16 && offset >= 8 && spaceLeft >= 16)
            {
                var src = new Pointer(_buffer, _index - offset);
                op.Copy64(src);
                op.Copy64(src + 8, 8);
            }
            else
            {
                if(spaceLeft >= len + CompressorConstants.MaxIncrementCopyOverflow)
                    IncrementalCopyFastPath(op - offset, op, len);
                else
                {
                    if(spaceLeft < len)
                        return false;

                    IncrementalCopy(op - offset, op, len);
                }
            }

            _index += len;
            return true;
        }
开发者ID:reuzel,项目名称:CqlSharp,代码行数:33,代码来源:Writer.cs

示例2: TryFastAppend

        public bool TryFastAppend(Pointer ip, int available, int len)
        {
            int spaceLeft = _length - _index;

            if(len > 16 || available < 16 || spaceLeft < 16)
                return false;

            var op = new Pointer(_buffer, _index);
            op.Copy64(ip);
            op.Copy64(ip + 8, 8);

            _index += len;
            return true;
        }
开发者ID:reuzel,项目名称:CqlSharp,代码行数:14,代码来源:Writer.cs

示例3: EmitLiteral

        private static Pointer EmitLiteral(Pointer dest, Pointer literal, int length, bool allowFastPath)
        {
            int n = length - 1;
            if(n < 60)
            {
                var value = CompressorTag.Literal | (n << 2);
                dest[0] = (byte)value;
                dest += 1;

                if(allowFastPath && length <= 16)
                {
                    dest.Copy64(literal);
                    dest.Copy64(literal + 8, 8);
                    return dest + length;
                }
            }
            else
            {
                var tmp = new Pointer(dest);
                dest += 1;

                int count = 0;
                while(n > 0)
                {
                    dest[count] = (byte)(n & 0xff);
                    n >>= 8;
                    count++;
                }

                Debug.Assert(count >= 1);
                Debug.Assert(count <= 4);

                tmp[0] = (byte)(CompressorTag.Literal | (59 + count) << 2);
                dest += count;
            }

            dest.Copy(literal, length);
            return dest + length;
        }
开发者ID:reuzel,项目名称:CqlSharp,代码行数:39,代码来源:Compressor.cs

示例4: IncrementalCopyFastPath

        private void IncrementalCopyFastPath(Pointer src, Pointer op, int len)
        {
            while (op - src < 8)
            {
                op.Copy64(src);
                len -= op - src;
                op += op - src;
            }

            while (len > 0)
            {
                op.Copy64(src);
                src += 8;
                op += 8;
                len -= 8;
            }
        }
开发者ID:priyaparul,项目名称:CqlSharp,代码行数:17,代码来源:Writer.cs


注:本文中的Pointer.Copy64方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。