module OW_hadam

implicit none

contains

subroutine owhadamard(i,j,k,n,h)

integer		:: i,i1,j,j1,k,n,h

j1=j
j1=iand(ieor(ishft(j1,1),ieor(i,k)),j1)
do i1=1,n-1
   j1=ieor(ishft(j1,-1),iand(j1,1))
end do
h=(-1)**j1

end subroutine

end module
