WDF_ALIGN_SIZE_DOWN function (wdfcore.h)
[Applies to KMDF and UMDF]
The WDF_ALIGN_SIZE_DOWN function returns the next-lower buffer size that is aligned to a specified alignment offset.
Syntax
size_t WDF_ALIGN_SIZE_DOWN(
[in] size_t Length,
[in] size_t AlignTo
);
Parameters
[in] Length
The length, in bytes, of a memory buffer.
[in] AlignTo
The alignment offset, in bytes. This value must be a power of 2, such as 2, 4, 8, 16, and so on.
Return value
WDF_ALIGN_SIZE_DOWN returns the aligned buffer size, in bytes.
Remarks
Drivers can use WDF_ALIGN_SIZE_UP or WDF_ALIGN_SIZE_DOWN to calculate a buffer size that is aligned to a specified alignment offset. This calculation is useful if your driver must allocate multiple contiguous buffers, if each buffer must begin at an address alignment boundary.
Examples
The following code example receives a buffer size and returns the size (either the current size or the next-lower size) that aligns to a DWORD address boundary.
bufferSizeAligned = WDF_ALIGN_SIZE_DOWN(bufferSize,
sizeof(DWORD));
Requirements
Requirement | Value |
---|---|
Target Platform | Universal |
Minimum KMDF version | 1.0 |
Minimum UMDF version | 2.0 |
Header | wdfcore.h (include Wdf.h) |
Library | Wdf01000.sys (see Framework Library Versioning.) |
IRQL | Any IRQL. |
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for