On 02/09/10 20:06, Benoît Minisini wrote: >> There were days when binary values were actually represented in bits >> within a byte or word. This is still true when interfacing to some boxes >> such as PLCs. >> Likewise, some operations - eg calculating a CRC - are very awkward to >> implement without bitwise operations. >> >> It would be really nice to have this functionality. Anyone who has ever >> programmed in Assembler propably knows what I mean. >> >> The following would be a fairly complete set, I think: >> >> BitAnd( a AS Expression, b AS Expression) AS Expression >> > -> a AND b > > >> BitOr( a AS Expression, b AS Expression) AS Expression >> > -> a OR b > > >> BitXOr( a AS Expression, b AS Expression) AS Expression >> > -> a XOR b > > >> BitNot( a AS Expression) AS Expression >> > -> NOT a > > >> BitShift( a AS Expression, count as Byte) AS Expression >> > -> Lsl(a, count) > -> Lsr(a, count) > -> Asl(a, count) > -> Asr(a, count) > > >> BitRotate( a AS Expression, count as Byte) AS Expression >> > -> Rol(a, count) > -> Ror(a, count) > > >> where Expression boils down to one of the following: >> Byte >> Short >> Integer >> Long >> >> If expressions a and b are not the same size the shorter one needs to be >> expanded with zeroes (MSB side) to match. >> > That is what they do. > > Regards, > > Thanks, I was under the misguided impression these were for booleans.
CHRISTMAS! :-) Werner ------------------------------------------------------------------------------ This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd _______________________________________________ Gambas-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gambas-user
