anchor.diff:          nperm = popcnt(iand(det1(j,ispin),                           &
               iand(ibset(0_bit_kind,m-1)-1_bit_kind,ibclr(-1_bit_kind,n)+1_bit_kind)))
         else
  -        nperm = nperm + &
  -            popcnt(iand(det1(k,ispin),ibset(0_bit_kind,m-1)-1_bit_kind)) +&
  -            popcnt(iand(det1(j,ispin),ibclr(-1_bit_kind,n)+1_bit_kind))
  +        nperm = nperm + popcnt(iand(det1(k,ispin),ibset(0_bit_kind,m-1)-1_bit_kind))
  +        if (n < bit_kind_size) then
  +            nperm = nperm + popcnt(iand(det1(j,ispin),ibclr(-1_bit_kind,n)+1_bit_kind))
  +        endif
           do i=j+1,k-1
             nperm = nperm + popcnt(det1(i,ispin))
           end do
  
positive.code:               ibclr(-1_bit_kind,n)+1_bit_kind ) ))
          else
            nperm = nperm + popcnt(iand(det1(k,ispin),                 &
                ibset(0_bit_kind,m-1)-1_bit_kind)) +                   &
                popcnt(iand(det1(j,ispin), ibclr(-1_bit_kind,n) +1_bit_kind))
            do i=j+1,k-1
              nperm = nperm + popcnt(det1(i,ispin))
            end do
  
negative.code:                 ibclr(-1_bit_kind,n)+1_bit_kind ) ))
            else
              nperm = nperm + popcnt(iand(det1(k,ispin),               &
                  ibset(0_bit_kind,m-1)-1_bit_kind)) 
              if (n < bit_kind_size) then
                 nperm = nperm + popcnt(iand(det1(j,ispin), ibclr(-1_bit_kind,n) +1_bit_kind))
              endif
              do l=j+1,k-1
                nperm = nperm + popcnt(det1(l,ispin))
              end do
  