从比特集 old
中的范围 start_pos
到 stop_pos
创建一个新的比特集 new
。如果 start_pos
大于 stop_pos
,则新比特集为空。如果 start_pos
小于零或 stop_pos
大于 bits(old)-1
,则如果 status
存在,则其值为 index_invalid_error
,并且 new
未定义,否则处理将停止并显示一条信息性消息。(规范)
program example_extract
use stdlib_bitsets
type(bitset_large) :: set0, set1
call set0 % init(166)
call set0 % set(100,150)
call extract( set1, set0, 100, 150)
if ( set1 % bits() == 51 ) &
write(*,*) 'SET1 has the proper size.'
if ( set1 % all() ) write(*,*) 'SET1 has the proper values.'
end program example_extract
类型 | 意图 | 可选 | 属性 | 名称 | ||
---|---|---|---|---|---|---|
type(bitset_large), | intent(out) | :: | new | |||
type(bitset_large), | intent(in) | :: | old | |||
integer(kind=bits_kind), | intent(in) | :: | start_pos | |||
integer(kind=bits_kind), | intent(in) | :: | stop_pos | |||
integer, | intent(out), | optional | :: | status |