PgAlign
Namespace: Ankus
Assembly: Ankus.Runtime.dll
PostgreSQL’s alignment macros from c.h, such as MAXALIGN, for sizes and offsets of structures PostgreSQL
lays out, as pgrx’s pg_sys::align functions provide them.
public static class PgAlignThe constants are the ALIGNOF_* values every supported platform’s PostgreSQL defines; each is a power of two.
Inheritance: object
Methods
Section titled “Methods”BufferAlign(nuint)
Section titled “BufferAlign(nuint)”Rounds a length up to BufferAlignment, as BUFFERALIGN does.
public static nuint BufferAlign(nuint length)Parameters:
length — nuint
The length to round.
Returns: nuint
The aligned length.
DoubleAlign(nuint)
Section titled “DoubleAlign(nuint)”Rounds a length up to the alignment of C double, as DOUBLEALIGN does.
public static nuint DoubleAlign(nuint length)Parameters:
length — nuint
The length to round.
Returns: nuint
The aligned length.
IntAlign(nuint)
Section titled “IntAlign(nuint)”Rounds a length up to the alignment of C int, as INTALIGN does.
public static nuint IntAlign(nuint length)Parameters:
length — nuint
The length to round.
Returns: nuint
The aligned length.
MaxAlign(nuint)
Section titled “MaxAlign(nuint)”Rounds a length up to MaximumAlignment, as MAXALIGN does.
public static nuint MaxAlign(nuint length)Parameters:
length — nuint
The length to round.
Returns: nuint
The aligned length.
MaxAlignDown(nuint)
Section titled “MaxAlignDown(nuint)”Rounds a length down to a multiple of MaximumAlignment, as MAXALIGN_DOWN does.
public static nuint MaxAlignDown(nuint length)Parameters:
length — nuint
The length to round.
Returns: nuint
The aligned length.
ShortAlign(nuint)
Section titled “ShortAlign(nuint)”Rounds a length up to the alignment of C short, as SHORTALIGN does.
public static nuint ShortAlign(nuint length)Parameters:
length — nuint
The length to round.
Returns: nuint
The aligned length.
TypeAlign(nuint, nuint)
Section titled “TypeAlign(nuint, nuint)”Rounds a length up to a multiple of an alignment, as TYPEALIGN(alignval, len) does.
public static nuint TypeAlign(nuint alignment, nuint length)Parameters:
alignment — nuint
The alignment, a power of two.
length — nuint
The length to round.
Returns: nuint
The smallest multiple of the alignment that is at least the length.
Exceptions:
- ArgumentOutOfRangeException: The alignment isn’t a power of two.
- OverflowException: The result doesn’t fit.
TypeAlignDown(nuint, nuint)
Section titled “TypeAlignDown(nuint, nuint)”Rounds a length down to a multiple of an alignment, as TYPEALIGN_DOWN(alignval, len) does.
public static nuint TypeAlignDown(nuint alignment, nuint length)Parameters:
alignment — nuint
The alignment, a power of two.
length — nuint
The length to round.
Returns: nuint
The largest multiple of the alignment that is at most the length.
Exceptions:
- ArgumentOutOfRangeException: The alignment isn’t a power of two.
Fields
Section titled “Fields”BufferAlignment
Section titled “BufferAlignment”The alignment of shared buffers, ALIGNOF_BUFFER.
public const int BufferAlignment = 32DoubleAlignment
Section titled “DoubleAlignment”The alignment of C double, ALIGNOF_DOUBLE.
public const int DoubleAlignment = 8IntAlignment
Section titled “IntAlignment”The alignment of C int, ALIGNOF_INT.
public const int IntAlignment = 4MaximumAlignment
Section titled “MaximumAlignment”The alignment PostgreSQL gives every palloc’d chunk and on-disk tuple, MAXIMUM_ALIGNOF.
public const int MaximumAlignment = 8ShortAlignment
Section titled “ShortAlignment”The alignment of C short, ALIGNOF_SHORT.
public const int ShortAlignment = 2