|
Dave, I see that yours is a more accurate translation. Very creative use of the XLATEWT instruction. Steve Richter ----- Original Message ----- From: "Dave McKenzie" <davemck@zbiggroup.com> To: <mi400@midrange.com> Sent: Saturday, December 15, 2001 5:55 PM Subject: Re: [MI400] CCITT Group 4 compression > bitmap is an array of chars. > cp is a pointer to a char. > > bitmap[*cp++] means: the char from bitmap at index *cp++. (C indexes are > 0-relative, so bitmap[0] is the first char.) > > *cp means: the char pointed to by cp. > The ++ after cp means: increment cp after using it to address a char. > > So bitmap[*cp++] means: Extract the char from bitmap at the index equal to > the integer value of the char pointed to by cp. Then increment cp by 1. > > X << BitsAvail means: left shift X by BitsAvail bits (where BitsAvail is an > integer). > > BitAcc |= X means: "or" X into BitAcc. It's shorthand for BitAcc = BitAcc | X > where "|" is the "or" operator. > > Here's MI that attempts to do the same thing: > > DCL SPCPTR CP AUTO; > DCL DD C CHAR(1) BAS(CP); > DCL DD BITMAP CHAR(256) AUTO; > DCL DD CHAR4 CHAR(4) AUTO; > DCL DD BITSAVAIL UNSGND BIN(2) AUTO BDRY(2); > DCL DD UBIN4 UNSGND BIN(4) AUTO BDRY(4); > DCL DD BITACC UNSGND BIN(4) AUTO BDRY(4); > > XOR(S) CHAR4, CHAR4; > XLATEWT CHAR4(4:1), C, BITMAP; > ADDSPP CP, CP, 1; > CPYBTLLS UBIN4, CHAR4, BITSAVAIL; > OR(S) BITACC, UBIN4; > > --Dave > > > On Saturday 15 December 2001 07:25, Harry Williarms wrote: > > Ok, > > The code I am stuck on is > > BitAcc |= bitmap[*cp++]<<BitsAvail; > _______________________________________________ > 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 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.