! File: logical.i90 ! Public domain 2006 James Van Buskirk elemental function log_op(a, b, truth_table) integer(wik) log_op integer(wik), intent(in) :: a, b integer, intent(in) :: truth_table log_op = int(0,wik) if(btest(truth_table,0)) log_op = ior(log_op,iand(not(a),not(b))) if(btest(truth_table,1)) log_op = ior(log_op,iand(not(a),b)) if(btest(truth_table,2)) log_op = ior(log_op,iand(a,not(b))) if(btest(truth_table,3)) log_op = ior(log_op,iand(a,b)) end function log_op elemental function L0(a, b) integer(wik) L0 integer(wik), intent(in) :: a, b L0 = log_op(a, b, 0) end function L0 elemental function L1(a, b) integer(wik) L1 integer(wik), intent(in) :: a, b L1 = log_op(a, b, 1) end function L1 elemental function L2(a, b) integer(wik) L2 integer(wik), intent(in) :: a, b L2 = log_op(a, b, 2) end function L2 elemental function L3(a, b) integer(wik) L3 integer(wik), intent(in) :: a, b L3 = log_op(a, b, 3) end function L3 elemental function L4(a, b) integer(wik) L4 integer(wik), intent(in) :: a, b L4 = log_op(a, b, 4) end function L4 elemental function L5(a, b) integer(wik) L5 integer(wik), intent(in) :: a, b L5 = log_op(a, b, 5) end function L5 elemental function L6(a, b) integer(wik) L6 integer(wik), intent(in) :: a, b L6 = log_op(a, b, 6) end function L6 elemental function L7(a, b) integer(wik) L7 integer(wik), intent(in) :: a, b L7 = log_op(a, b, 7) end function L7 elemental function L8(a, b) integer(wik) L8 integer(wik), intent(in) :: a, b L8 = log_op(a, b, 8) end function L8 elemental function L9(a, b) integer(wik) L9 integer(wik), intent(in) :: a, b L9 = log_op(a, b, 9) end function L9 elemental function LA(a, b) integer(wik) LA integer(wik), intent(in) :: a, b LA = log_op(a, b, 10) end function LA elemental function LB(a, b) integer(wik) LB integer(wik), intent(in) :: a, b LB = log_op(a, b, 11) end function LB elemental function LC(a, b) integer(wik) LC integer(wik), intent(in) :: a, b LC = log_op(a, b, 12) end function LC elemental function LD(a, b) integer(wik) LD integer(wik), intent(in) :: a, b LD = log_op(a, b, 13) end function LD elemental function LE(a, b) integer(wik) LE integer(wik), intent(in) :: a, b LE = log_op(a, b, 14) end function LE elemental function LF(a, b) integer(wik) LF integer(wik), intent(in) :: a, b LF = log_op(a, b, 15) end function LF ! End of file: logical.i90