9#ifndef FORTRAN_RUNTIME_DESCRIPTOR_CONSTS_H_
10#define FORTRAN_RUNTIME_DESCRIPTOR_CONSTS_H_
12#include "flang/Common/Fortran-consts.h"
13#include "flang/Common/ISO_Fortran_binding_wrapper.h"
14#include "flang/Common/api-attrs.h"
19#define _CFI_ADDENDUM_FLAG 1
21#define _CFI_ALLOCATOR_IDX_SHIFT 1
23#define _CFI_ALLOCATOR_IDX_MASK 0b00001110
25namespace Fortran::runtime::typeInfo {
26using TypeParameterValue = std::int64_t;
30namespace Fortran::runtime {
32using SubscriptValue = ISO::CFI_index_t;
33using common::TypeCategory;
38static constexpr RT_API_ATTRS std::size_t MaxDescriptorSizeInBytes(
39 int rank,
bool addendum =
false,
int lengthTypeParameters = 0) {
65 std::size_t bytes{24u + rank * 24u};
66 if (addendum || lengthTypeParameters > 0) {
67 if (lengthTypeParameters < 1)
68 lengthTypeParameters = 1;
69 bytes += 8u +
static_cast<std::size_t
>(lengthTypeParameters) * 8u;