home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / adaptor.zip / adapt.zip / adaptor / examples / dalib / schedule / switch.f < prev   
Text File  |  1993-06-28  |  620b  |  39 lines

  1.       program indirect
  2.  
  3. c     test bed for indirect addressing, here switch
  4.  
  5.       integer N
  6.       parameter (N = 16)
  7.       integer A(N), B(N), P(N)
  8.       integer HA (N)
  9. cmf$  layout HA(:host)
  10.  
  11.       integer I
  12. c
  13.  
  14. c     init A
  15.       forall (I=1:N) A(I) = I
  16.  
  17. c     make P to a switch vector
  18.  
  19. !HPF$ INDEPENDENT, LOCAL_ACCESS
  20.       do I = 1, N 
  21.          X = mod (I-1,4)
  22.          if (X .ge. 2) then
  23.            X = I - 2
  24.           else
  25.            X = I + 2
  26.          end if
  27.          P(I) = X
  28.       end do
  29.           
  30. c
  31.       HA = P
  32.       print *, 'P = ', HA
  33.  
  34.       B = A(P)
  35.       HA = B
  36.       print *, 'B = A[P]', HA
  37.  
  38.       end
  39.