Juan Lang juan.lang@gmail.com writes:
+{
- ULARGE_INTEGER currentSize, addedSize, limit;
- currentSize.u.LowPart = pHeader->dwCacheUsageLow;
- currentSize.u.HighPart = pHeader->dwCacheUsageHigh;
- addedSize.u.HighPart = fileSizeHigh;
- addedSize.u.LowPart = fileSizeLow;
- currentSize.QuadPart += addedSize.QuadPart;
- limit.u.LowPart = pHeader->dwCacheLimitLow;
- limit.u.HighPart = pHeader->dwCacheLimitHigh;
- if (commit)
- {
pHeader->dwCacheUsageLow = currentSize.u.LowPart;
pHeader->dwCacheUsageHigh = currentSize.u.HighPart;
- }
- return currentSize.QuadPart > limit.QuadPart;
You should store the fields as large integer in the header structure, that would save a lot of redundant manipulations.