Creates a new bitset, new
, from a range, start_pos
to stop_pos
, in
bitset old
. If start_pos
is greater than stop_pos
the new bitset is
empty. If start_pos
is less than zero or stop_pos
is greater than
bits(old)-1
then if status
is present it has the value
index_invalid_error
and new
is undefined, otherwise processing stops
with an informative message.
(Specification)
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 | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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 |