Host introspection: Difference between revisions
Content added Content deleted
No edit summary |
(Correction to non-portable code) |
||
Line 191: | Line 191: | ||
=={{header|Fortran}}== |
=={{header|Fortran}}== |
||
{{works with|Fortran|90 and later}} |
{{works with|Fortran|90 and later}} |
||
<lang fortran> |
<lang fortran> integer :: i |
||
character(len=1) :: c(20) |
|||
INTEGER, PARAMETER :: i16 = SELECTED_INT_KIND(4) |
|||
equivalence (c, i) |
|||
INTEGER(i8) :: a(2) |
|||
INTEGER(i16) :: b |
|||
WRITE(*,*) bit_size(1) |
WRITE(*,*) bit_size(1) ! number of bits in the default integer type |
||
! which may (or may not!) equal the word size |
! which may (or may not!) equal the word size |
||
i = 1 |
|||
IF (ichar(c(1)) == 0) THEN |
|||
b = Z'1234' ! Hexadecimal assignment |
|||
⚫ | |||
a = (TRANSFER(b, a)) ! Split a 16 bit number into two 8 bit numbers |
|||
⚫ | |||
⚫ | |||
IF (a(1) == Z'12') THEN ! where did the most significant 8 bits end up |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|F_Sharp|F#}}== |
=={{header|F_Sharp|F#}}== |