File: example_bitsets_assignment.f90

package info (click to toggle)
fortran-stdlib 0.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 34,008 kB
  • sloc: f90: 24,178; ansic: 1,244; cpp: 623; python: 119; makefile: 13
file content (26 lines) | stat: -rw-r--r-- 824 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
program example_assignment
  use stdlib_bitsets
  use stdlib_kinds, only: int8, int32
  implicit none
  logical(int8)  :: logical1(64) = .true.
  logical(int32), allocatable :: logical2(:)
  type(bitset_64) :: set0, set1
  set0 = logical1
  if (set0%bits() /= 64) then
    error stop &
      ' initialization with logical(int8) failed to set'// &
      ' the right size.'
  else if (.not. set0%all()) then
    error stop ' initialization with'// &
      ' logical(int8) failed to set the right values.'
  else
    write (*, *) 'Initialization with logical(int8) succeeded.'
  end if
  set1 = set0
  if (set1 == set0) &
    write (*, *) 'Initialization by assignment succeeded'
  logical2 = set1
  if (all(logical2)) then
    write (*, *) 'Initialization of logical(int32) succeeded.'
  end if
end program example_assignment