| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | hex |
pure integer function hex2int(hex) character(len=*),intent(in) :: hex integer :: i, n, ipower ! 70c71 -> 461937 n = len(hex) hex2int = 0 !base 16 (0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f) ipower = -1 do i = n, 1, -1 ipower = ipower + 1 associate(c => hex(i:i)) if (c>='a' .and. c<='f') then hex2int = hex2int + (10+iachar(c)-iachar('a'))*(16**ipower) else hex2int = hex2int + (iachar(c)-iachar('0'))*(16**ipower) end if end associate end do end function hex2int