本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
}