9#ifndef FORTRAN_RUNTIME_DESCRIPTOR_CONSTS_H_
10#define FORTRAN_RUNTIME_DESCRIPTOR_CONSTS_H_
12#include "flang/Common/api-attrs.h"
13#include "flang/ISO_Fortran_binding_wrapper.h"
18#define _CFI_ADDENDUM_FLAG 1
20#define _CFI_ALLOCATOR_IDX_SHIFT 1
22#define _CFI_ALLOCATOR_IDX_MASK 0b00001110
24namespace Fortran::runtime::typeInfo {
25using TypeParameterValue = std::int64_t;
29namespace Fortran::runtime {
31using SubscriptValue = ISO::CFI_index_t;
36static constexpr RT_API_ATTRS std::size_t MaxDescriptorSizeInBytes(
37 int rank,
bool addendum =
false,
int lengthTypeParameters = 0) {
63 std::size_t bytes{24u + rank * 24u};
64 if (addendum || lengthTypeParameters > 0) {
65 if (lengthTypeParameters < 1)
66 lengthTypeParameters = 1;
67 bytes += 8u +
static_cast<std::size_t
>(lengthTypeParameters) * 8u;