-
-
Save alexyakunin/b34fa184bb1fd574697ee8e2d731f39d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static long ComputeSumMMF(string fileName, | |
Func<IntPtr, long, long, int, (long, int)> sumComputer) | |
{ | |
using var f = MemoryMappedFile.CreateFromFile(fileName, FileMode.Open); | |
using var fAccessor = f.CreateViewAccessor(); | |
var fHandle = fAccessor.SafeMemoryMappedViewHandle; | |
var (sum, _) = sumComputer(fHandle.DangerousGetHandle(), (long) fHandle.ByteLength, 0, 0); | |
return sum; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment