我有一个内存byte[]
,需要找到偏移的位置13
和10
位置。然后,我将使用以下内容提取该行:
String oneLine = Encoding.ASCII.GetString(bytes, 0, max);
在 x64 位计算机上搜索两个字节的最快方法是什么?..并将其转换为字符串?
除了遍历每个字节,扫描13
然后扫描之外,我还能做些什么10
吗?
// Disclaimer:
// This is just for my curiosity. Perhaps I'll gain a better understanding of
// how .NET interfaces with RAM, the CPU instructions related to comparisons, etc.
//
// I don't suspect a performance problem, but I do suspect a lack of understanding
// (on my part) on how C# does low-level operations.