Calculates the padding required to align the value to the next specified boundary.

Namespace: SharpAssembler.Core
Assembly: SharpAssembler Core (in SharpAssembler Core.dll) Version: 1.0.0.0 (1.0.0.0)

Syntax

C#
public Int128 GetPadding(
	int boundary
)
Visual Basic
Public Function GetPadding ( _
	boundary As Integer _
) As Int128
Visual C++
public:
Int128 GetPadding(
	int boundary
)

Parameters

boundary
Type: System..::..Int32
The boundary to align to, which must be a power of two.

Return Value

The number of padding bytes required to align the address to the specified boundary.

Exceptions

ExceptionCondition
System..::..ArgumentOutOfRangeExceptionboundary < 1
System..::..ArgumentException!(MathExt.IsPowerOfTwo(boundary))

Contracts

Requires
boundary >= 1
MathExt.IsPowerOfTwo(boundary)
Ensures
Contract.Result<Int128>() >= 0

See Also