@@ -223,10 +223,13 @@ enum class LogicalReduction { All, Any, Parity };
223
223
template <LogicalReduction REDUCTION> class LogicalAccumulator {
224
224
public:
225
225
using Type = bool ;
226
- explicit LogicalAccumulator (const Descriptor &array) : array_{array} {}
227
- void Reinitialize () { result_ = REDUCTION == LogicalReduction::All; }
228
- bool Result () const { return result_; }
229
- bool Accumulate (bool x) {
226
+ RT_API_ATTRS explicit LogicalAccumulator (const Descriptor &array)
227
+ : array_{array} {}
228
+ RT_API_ATTRS void Reinitialize () {
229
+ result_ = REDUCTION == LogicalReduction::All;
230
+ }
231
+ RT_API_ATTRS bool Result () const { return result_; }
232
+ RT_API_ATTRS bool Accumulate (bool x) {
230
233
if constexpr (REDUCTION == LogicalReduction::Parity) {
231
234
result_ = result_ != x;
232
235
} else if (x != (REDUCTION == LogicalReduction::All)) {
@@ -236,7 +239,7 @@ template <LogicalReduction REDUCTION> class LogicalAccumulator {
236
239
return true ;
237
240
}
238
241
template <typename IGNORED = void >
239
- bool AccumulateAt (const SubscriptValue at[]) {
242
+ RT_API_ATTRS bool AccumulateAt (const SubscriptValue at[]) {
240
243
return Accumulate (IsLogicalElementTrue (array_, at));
241
244
}
242
245
@@ -246,9 +249,9 @@ template <LogicalReduction REDUCTION> class LogicalAccumulator {
246
249
};
247
250
248
251
template <typename ACCUMULATOR>
249
- inline auto GetTotalLogicalReduction (const Descriptor &x, const char *source ,
250
- int line, int dim, ACCUMULATOR &&accumulator, const char *intrinsic) ->
251
- typename ACCUMULATOR::Type {
252
+ RT_API_ATTRS inline auto GetTotalLogicalReduction (const Descriptor &x,
253
+ const char *source, int line, int dim, ACCUMULATOR &&accumulator,
254
+ const char *intrinsic) -> typename ACCUMULATOR::Type {
252
255
Terminator terminator{source, line};
253
256
if (dim < 0 || dim > 1 ) {
254
257
terminator.Crash (" %s: bad DIM=%d for ARRAY with rank=1" , intrinsic, dim);
@@ -264,8 +267,9 @@ inline auto GetTotalLogicalReduction(const Descriptor &x, const char *source,
264
267
}
265
268
266
269
template <typename ACCUMULATOR>
267
- inline auto ReduceLogicalDimToScalar (const Descriptor &x, int zeroBasedDim,
268
- SubscriptValue subscripts[]) -> typename ACCUMULATOR::Type {
270
+ RT_API_ATTRS inline auto ReduceLogicalDimToScalar (
271
+ const Descriptor &x, int zeroBasedDim, SubscriptValue subscripts[]) ->
272
+ typename ACCUMULATOR::Type {
269
273
ACCUMULATOR accumulator{x};
270
274
SubscriptValue xAt[maxRank];
271
275
GetExpandedSubscripts (xAt, x, zeroBasedDim, subscripts);
@@ -282,8 +286,8 @@ inline auto ReduceLogicalDimToScalar(const Descriptor &x, int zeroBasedDim,
282
286
283
287
template <LogicalReduction REDUCTION> struct LogicalReduceHelper {
284
288
template <int KIND> struct Functor {
285
- void operator ()(Descriptor &result, const Descriptor &x, int dim ,
286
- Terminator &terminator, const char *intrinsic) const {
289
+ RT_API_ATTRS void operator ()(Descriptor &result, const Descriptor &x,
290
+ int dim, Terminator &terminator, const char *intrinsic) const {
287
291
// Standard requires result to have same LOGICAL kind as argument.
288
292
CreatePartialReductionResult (
289
293
result, x, x.ElementBytes (), dim, terminator, intrinsic, x.type ());
@@ -301,8 +305,9 @@ template <LogicalReduction REDUCTION> struct LogicalReduceHelper {
301
305
};
302
306
303
307
template <LogicalReduction REDUCTION>
304
- inline void DoReduceLogicalDimension (Descriptor &result, const Descriptor &x,
305
- int dim, Terminator &terminator, const char *intrinsic) {
308
+ RT_API_ATTRS inline void DoReduceLogicalDimension (Descriptor &result,
309
+ const Descriptor &x, int dim, Terminator &terminator,
310
+ const char *intrinsic) {
306
311
auto catKind{x.type ().GetCategoryAndKind ()};
307
312
RUNTIME_CHECK (terminator, catKind && catKind->first == TypeCategory::Logical);
308
313
ApplyLogicalKind<LogicalReduceHelper<REDUCTION>::template Functor, void >(
@@ -314,11 +319,12 @@ inline void DoReduceLogicalDimension(Descriptor &result, const Descriptor &x,
314
319
class CountAccumulator {
315
320
public:
316
321
using Type = std::int64_t ;
317
- explicit CountAccumulator (const Descriptor &array) : array_{array} {}
318
- void Reinitialize () { result_ = 0 ; }
319
- Type Result () const { return result_; }
322
+ RT_API_ATTRS explicit CountAccumulator (const Descriptor &array)
323
+ : array_{array} {}
324
+ RT_API_ATTRS void Reinitialize () { result_ = 0 ; }
325
+ RT_API_ATTRS Type Result () const { return result_; }
320
326
template <typename IGNORED = void >
321
- bool AccumulateAt (const SubscriptValue at[]) {
327
+ RT_API_ATTRS bool AccumulateAt (const SubscriptValue at[]) {
322
328
if (IsLogicalElementTrue (array_, at)) {
323
329
++result_;
324
330
}
@@ -331,7 +337,7 @@ class CountAccumulator {
331
337
};
332
338
333
339
template <int KIND> struct CountDimension {
334
- void operator ()(Descriptor &result, const Descriptor &x, int dim,
340
+ RT_API_ATTRS void operator ()(Descriptor &result, const Descriptor &x, int dim,
335
341
Terminator &terminator) const {
336
342
// Element size of the descriptor descriptor is the size
337
343
// of {TypeCategory::Integer, KIND}.
0 commit comments