|
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;
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.