narrow_offsets Interface

interface
public module subroutine narrow_offsets(offsets64, proc, offsets32)

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: offsets64(:)

the group offsets.

character(len=*), intent(in) :: proc

calling procedure.

integer(kind=int32), intent(out), allocatable :: offsets32(:)

the narrowed copy.

Description

Narrows a group-offsets array to int32, aborting rather than truncating.

NOT the same test as narrow_perm's, and the difference is exactly one row: a permutation's largest entry is n, but this array's is the sentinel n + 1. At n == huge(int32) the permutation narrows cleanly while the sentinel wraps negative, and a negative sentinel turns the last group's o(g+1) - 1 into a huge negative bound -- a silently empty or wildly wrong slice instead of an abort. So this checks the sentinel itself rather than the length.