File compiler_def.h

Defines

BEGIN_C_DECLS

Copyright (C) Mellanox Technologies Ltd. 2001-2017. ALL RIGHTS RESERVED. Copyright (C) UT-Battelle, LLC. 2015. ALL RIGHTS RESERVED. Copyright (C) Arm, Ltd. 2021. ALL RIGHTS RESERVED.

See file LICENSE for terms.

END_C_DECLS
UCS_STATIC_ASSERT(_cond)
UCS_ALLOCA_MAX_SIZE
UCS_S_MAY_ALIAS
UCS_F_PURE
UCS_F_NORETURN
UCS_S_PACKED
UCS_F_NOINLINE
UCS_F_CTOR
UCS_F_DTOR
UCS_F_MAYBE_UNUSED
UCS_F_NON_NULL
UCS_F_ALWAYS_INLINE
UCS_V_INITIALIZED(_v)
UCS_BIT(i)
UCS_MASK(i)
UCS_F_PRINTF(fmtargN, vargN)
UCS_V_UNUSED
UCS_V_ALIGNED(_align)
UCS_EMPTY_STATEMENT
UCS_PTR_BYTE_OFFSET(_ptr, _offset)
UCS_PTR_TYPE_OFFSET(_ptr, _type)
UCS_PTR_BYTE_DIFF(_start, _end)
ucs_static_array_size(_array)

Size of statically-declared array

ucs_offsetof(_type, _member)
Returns

Offset of _member in _type. _type is a structure type.

ucs_container_of(_ptr, _type, _member)

Get a pointer to a struct containing a member.

Parameters
  • _ptr – Pointer to the member.

  • _type – Container type.

  • _member – Element member inside the container.

Returns

Address of the container structure.

ucs_typeof(_type)

Get the type of a structure or variable.

Parameters
  • _type – Return the type of this argument.

Returns

The type of the given argument.

ucs_derived_of(_ptr, _type)
Returns

Address of a derived structure. It must have a “super” member at offset 0. NOTE: we use the built-in offsetof here because we can’t use ucs_offsetof() in a constant expression.

ucs_field_sizeof(_type, _field)
Parameters
  • _type – Structure type.

  • _field – Field of structure.

Returns

Size of _field in _type.

ucs_field_type(_type, _field)
Parameters
  • _type – Structure type.

  • _field – Field of structure.

Returns

Type of _field in _type.

ucs_compiler_fence()

Prevent compiler from reordering instructions

ucs_prefetch(p)

Prefetch cache line

ucs_likely(x)
ucs_unlikely(x)
ucs_is_constant(expr)
UCS_STATIC_INIT
UCS_STATIC_CLEANUP
ucs_same_type(_type1, _type2)