Skip to content

Commit 486be15

Browse files
committed
implement int8
1 parent ebde8b1 commit 486be15

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/stdlib_experimental_default.f90

+15-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module stdlib_experimental_default
1111
!! For additional clarity, `default` be called with keyword argument
1212
!! for the fallback value, e.g., `default(x, to=1.0)`.
1313
!!
14-
use iso_fortran_env, only: sp => real32, dp => real64, qp => real128, int16, int32, int64
14+
use iso_fortran_env, only: sp => real32, dp => real64, qp => real128, int8, int16, int32, int64
1515
implicit none
1616

1717

@@ -23,6 +23,7 @@ module stdlib_experimental_default
2323
module procedure default_sp
2424
module procedure default_dp
2525
module procedure default_qp
26+
module procedure default_int8
2627
module procedure default_int16
2728
module procedure default_int32
2829
module procedure default_int64
@@ -75,6 +76,19 @@ function default_qp(x, to) result(y)
7576
end function default_qp
7677

7778

79+
function default_int8(x, to) result(y)
80+
integer(int8), intent(in), optional :: x
81+
integer(int8), intent(in) :: to
82+
integer(int8) :: y
83+
84+
if (present(x)) then
85+
y = x
86+
else
87+
y = to
88+
end if
89+
end function default_int8
90+
91+
7892
function default_int16(x, to) result(y)
7993
integer(int16), intent(in), optional :: x
8094
integer(int16), intent(in) :: to

0 commit comments

Comments
 (0)