Skip to content

Commit 10b857a

Browse files
committed
bool: simplify
1 parent d86e952 commit 10b857a

File tree

1 file changed

+2
-23
lines changed

1 file changed

+2
-23
lines changed

src/bool/logbool.f90

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,16 @@ logical(c_bool) function logical_not(L) bind(C)
1010

1111
logical(c_bool), intent(in), value :: L
1212

13-
logical :: Ld
14-
integer :: i
15-
integer(C_INT) :: ic
16-
17-
character(*), parameter :: fmt = '(a16,2x,i3,2x,z8)'
18-
19-
!> avoid uninitialized variable warning
20-
i = 0
21-
ic = 0
22-
Ld = .false.
23-
24-
!> workaround for nvfortran 24.3 etc.
25-
!! nvfortran reference guide:
2613
!! The logical constants .TRUE. and .FALSE. are defined to be the four-byte values -1 and 0 respectively.
2714
!! A logical expression is defined to be .TRUE. if its least significant bit is 1 and .FALSE. otherwise.
28-
!if(L) then
29-
! logical_not = .false._C_BOOL
30-
!else
31-
! logical_not = .true._C_BOOL
32-
!endif
3315

3416
logical_not = .not. L
3517

3618
print '(/, a, l1, a, l1)', "logical_not(", L, "): ", logical_not
3719

3820

39-
print '(a16,2x,a,2x,a8)', "storage_size()", "bits", "hex"
40-
print fmt, "logical:", storage_size(Ld), Ld
41-
print fmt, "C_BOOL: ", storage_size(L), L
42-
print fmt, "integer: ", storage_size(i), i
43-
print fmt, "C_INT: ", storage_size(ic), ic
21+
print '(a16,2x,a,2x,a8,2x,a8)', "storage_size()", "bits", "hex(in)", "hex(out)"
22+
print '(a16,2x,i3,2x,z8,2x,z8)', "C_BOOL: ", storage_size(L), L, logical_not
4423

4524
end function logical_not
4625

0 commit comments

Comments
 (0)