Jim (or anyone else) I am thinking about writting an UUEncoder in M, so have come back to look at this more closely. I've taken a look in the GT.M programmer's manual also.
I notice that the $ZBITxx functions are also present in Cache' (although apparently depreciated). There are a couple parts I don't understand. First, I don't understand what you are doing with $char(0,X) during conversion to to a bit stream. Is this simply to force more bits (i.e. 0000000011111111 if X=255)? Second, you have $ZBITSTR(8,0)=$c(0,0) This seems to me to say, create a bitstring of 8 bits, all set to 0. Then you have that equal to $char(0,0), which I think is the same as $char(0)_$char(0) This seems to imply that $char(0) is only 4 bits. How can this be so? I'm confused. Thanks Kevin On 8/29/05, Jim Self <[EMAIL PROTECTED]> wrote: > Greg Woodhouse wrote: > >if X and Y represent (unsigned) decimal > > integers, does GT.M provide an easy (and efficient) means of carrying > > out bitwise operations on X and Y). For example, if X = 12 (binary > > 1100)and Y = 49 (binary 110001), I'd expect that > > > > X bitwise-or Y = 61 (binary 111101) > > > > > > 1 1 0 0 0 1 > > 1 1 0 0 > > ------------ > > 1 1 1 1 0 1 > > Bit functions in GT.M appear very similar to those in DTM, and I assume, in > Cache'. They > are oriented around doing fast tests on very long bitstrings. These might be > stored in a > database as a means of representing membership of data records in various > sets. > > According to the GT.M programmer documentation, bitstrings have a leading > byte that gives > the count of invalid bits at the end of the bitstring. As Bhaskar indicates, > there is no > automatic conversion of numerics to bitstrings. There are examples of use in > the > documentation that show a couple of different conversion methods. > > The functions are $ZBITAND(), $ZBITCOUNT(), $ZBITFIND(), $ZBITGET(), > $ZBITLEN(), > $ZBITNOT(), $ZBITOR(), $ZBITSET(), $ZBITSTR(), $ZBITXOR(). > > $ZBITSTR(bits,state) will create a bitstring with a given number of bits all > set to true > or false according to the value of state. The maximum number of bits is > 253,952. > > $ZBITSTR(8,0)=$c(0,0) > $ZBITSTR(16,0)=$c(0,0,0) > $ZBITSTR(24,0)=$c(0,0,0,0) > $ZBITSTR(32,0)=$c(0,0,0,0,0) > ... > > If X is an integer in the range 0-255 (8-bit value) then one way of > converting X to a > bitstring would be $c(0,X). > > ;testing zbit* functions > > s x=12,y=49 > s bitstr=$zbitOr($c(0,x),$c(0,y)) > zwr bitstr > > bitstr=$C(0)_"=" > > w $a(bitstr,2) > > 61 > > > --------------------------------------- > Jim Self > Systems Architect, Lead Developer > VMTH Computer Services, UC Davis > (http://www.vmth.ucdavis.edu/us/jaself) > > > ------------------------------------------------------- > SF.Net email is Sponsored by the Better Software Conference & EXPO > September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf > _______________________________________________ > Hardhats-members mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/hardhats-members > ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ Hardhats-members mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/hardhats-members
