× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Harry, Leif,

If 0111 = 2, then 0111 0111 is 2 2 correct ?

Is there another value that starts with the bit pattern 0111 0111 ?

if so, then the table of 4000+ entries does not work, correct ?

Also, if the 4000+ entry table is indexed by the 12 bit right adjusted bit
pattern, what is the index value of 0111 which must result in "2" ?  Its 12
bit pattern just starts with 0111. After that comes another bit pattern.


Steve Richter

----- Original Message -----
From: "Harry Williams" <planesmart@teleteam.com>
To: <mi400@midrange.com>
Sent: Thursday, December 20, 2001 9:02 PM
Subject: Re: [MI400] Is there an easy way to scan for bits?


> 00110101 = 0
> 000111 = 1
> 0111 = 2
> 1000 = 3
> 1011 = 4
> 1100 = 5
> 1110 = 6
> 1111 = 7
> 10011 = 8
> 10100 = 9
> 00111 = 10
> 01000 = 11
> 001000 = 12
> 000011 = 13
> 110100 = 14
> 110101 = 15
> 101010 = 16
> 101011 = 17
> 0100111 = 18
> 0001100 = 19
> 0001000 = 20
> 0010111 = 21
> 0000011 = 22
> 0000100 = 23
> 0101000 = 24
> 0101011 = 25
> 0010011 = 26
> There are about 300 of these codes.
>
> Leif Svalgaard wrote:
>
> > From: Steve Richter <srichter@AutoCoder.com>
> > > Leif,
> > > I find your solution intriguing, but I cant think anymore today unless
I
> > get
> > > paid for it. So I cant verify it.
> > > Could you show how it would work with Harry's data:
> > >
> > > "As an example. I start reading the bits, and if I
> > > read  00110101 then I translate it to the number 0.  If I read 000111
I
> > > translate it to 1,  0111 translates to 2, 1000 goes to 3, 10011 is 8,
> > > ..... 0100111 translates to 18.   There is about 100 of these codes."
> > >
> > > And Harry, could you post more of the codes and their resulting values
?
> > >
> >
> > here is a sketch, it need be fleshed out with more values.
> > Also, there need be some code to shift the bits over and
> > to get new bits from the source:
> >
> > DCL DD BITS CHAR(12);
> > DCL DD NBR  BIN(2);
> >
> > TOP:        TSTBUM(B)   BITS, X'80'/ONES(L1);
> > L0:         TSTBUM(B)   BITS, X'40'/ONES(L01);
> > L00:        TSTBUM(B)   BITS, X'20'/ONES(L001);
> > L000:       TSTBUM(B)   BITS, X'10'/ONES(L0001);
> > L0000:      /* ... */
> >
> > L0001:      TSTBUM(B)   BITS, X'08'/ONES(L00011);
> > L00010:     /* ... */
> >
> > L00011:     TSTBUM(B)   BITS, X'04'/ONES(L000111);
> > L000110:    /* ... */
> >
> > L000111:    CPYNV(B)    NBR, 1/POS(DONE);
> >
> > L01:        TSTBUM(B)   BITS, X'20'/ONES(L011);
> > L010:       TSTBUM(B)   BITS, X'10'/ONES(L0101);
> > L0100:      TSTBUM(B)   BITS, X'08'/ONES(L01001);
> > L01000:     /* ... */
> >
> > L01001:     TSTBUM(B)   BITS, X'04'/ONES(L010011);
> > L010010:    /* ... */
> >
> > L010011:    TSTBUM(B)   BITS, X'02'/ONES(L0100111);
> > L0100110:   /* ... */
> >
> > L0100111:   CPYNV(B)    NBR, 18/POS(DONE);
> >
> > L001:       TSTBUM(B)   BITS, X'20'/ONES(L0011);
> > L0010:      /* ... */
> >
> > L0011:      TSTBUM(B)   BITS, X'08'/ONES(L00111);
> > L00110:     TSTBUM(B)   BITS, X'04'/ONES(L001101);
> > L00001:     /* ... */
> >
> > L001101:    TSTBUM(B)   BITS, X'02'/ONES(L0011010);
> > L0011010:   TSTBUM(B)   BITS, X'01'/ONES(L00110101);
> > L00110100:  ...
> > L00110101:  CPYNV(B)    NBR, 0/ZER(DONE);
> >
> > /* ... */
> >
> > L1:         TSTBUM(B)   BITS, X'40'/ONES(L11);
> > L10:        TSTBUM(B)   BITS, X'20'/ONES(L101);
> > L100:       TSTBUM(B)   BITS, X'10'/ONES(L1001);
> > L1000:      CPYNV(B)    NBR, 3/POS(DONE);
> >
> > L1001:      TSTBUM(B)   BITS, X'08'/ONES(L10011);
> > L10010:     /* ... */
> >
> > L10011:     CPYNV(B),   NBR, 8/POS(DONE);
> >
> > /* ... */
> >
> > DONE:
> >
> > Another fast way would be to have a table with 2^12 entries
> > in it. Then simply use the 12 bits as an index to get the number
> > (and the shift).
> >
> > _______________________________________________
> > This is the MI Programming on the AS400 / iSeries (MI400) mailing list
> > To post a message email: MI400@midrange.com
> > To subscribe, unsubscribe, or change list options,
> > visit: http://lists.midrange.com/cgi-bin/listinfo/mi400
> > or email: MI400-request@midrange.com
> > Before posting, please take a moment to review the archives
> > at http://archive.midrange.com/mi400.
>
> _______________________________________________
> This is the MI Programming on the AS400 / iSeries (MI400) mailing list
> To post a message email: MI400@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/mi400
> or email: MI400-request@midrange.com
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/mi400.
>
>



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.