From: <[log in to unmask]>
> [Also posted to robelle-l]
>
> greetings,
> I'd like to use SuprTool to extract records from my (Image) dataset if all
> bits set in the item ORDERED is also set in the item PERFORMED. The items
> are I1 (16-bit integers).
> Using "if ordered - performed <> 0" doesn't quite cut it since sometimes
> more bits are set in PERFORMED...
>
> In HP-Fortran I'd say something like:
> if ((ORDERED .and. PERFORMED) .eq. ORDERED)
> but that's because HP-Ftn77 can do bitwise "and" on integers.
>
> Is there a way to do this in suprtool? if not with bit-arithmetic, perhaps
> someone less mathematically challenged than I know of a way to do this with
> suprtools arithmetic operators "+, -, *, / and mod"?
I would know how to do it except that each command line is limited to 256
characters, even in continued with ampersands.
If not, you could do this:
def o,ordered,2,logical
def p,performed,2,logical
if (o.(0:1)=0 or p.(0:1)=1)and(o.(1:1)=0 or p.(1:1)=1)and(o.(2:1)=0 or
p.(2:1)=1)and(o.(3:1)=0 or p.(3:1)=1)and(o.(4:1)=0 or p.(4:1)=1)and(o.(5:1)=0
or p.(5:1)=1)and(o.(6:1)=0 or p.(6:1)=1)and(o.(7:1)=0 or
p.(7:1)=1)and(o.(8:1)=0 or p.(8:1)=1)and(o.(9:1)=0 or p.(9:1)=1)and(o.(10:1)=0
or p.(10:1)=1)and(o.(11:1)=0 or p.(11:1)=1)and(o.(12:1)=0 or
p.(12:1)=1)and(o.(13:1)=0 or p.(13:1)=1)and(o.(14:1)=0 or
p.(14:1)=1)and(o.(15:1)=0 or p.(15:1)=1)
You could do it in two phases
input original
def o,ordered,2,logical
def p,performed,2,logical
if (o.(0:1)=0 or p.(0:1)=1)and(o.(1:1)=0 or p.(1:1)=1)and(o.(2:1)=0 or
p.(2:1)=1)and(o.(3:1)=0 or p.(3:1)=1)and(o.(4:1)=0 or p.(4:1)=1)and(o.(5:1)=0
or p.(5:1)=1)and(o.(6:1)=0 or p.(6:1)=1)and(o.(7:1)=0 or p.(7:1)=1)
output phase1
xeq
input phase1
if (o.(8:1)=0 or p.(8:1)=1)and(o.(9:1)=0 or p.(9:1)=1)and(o.(10:1)=0 or
p.(10:1)=1)and(o.(11:1)=0 or p.(11:1)=1)and(o.(12:1)=0 or
p.(12:1)=1)and(o.(13:1)=0 or p.(13:1)=1)and(o.(14:1)=0 or
p.(14:1)=1)and(o.(15:1)=0 or p.(15:1)=1)
output final
xeq
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|