Home --> Fact Sheet --> Free Source Code --> type_boolean

Type boolean is a typeless type- that is, conversion to or from type boolean consists of copying the bits as is. Entities of type boolean consist of an ordered set of bits, no meaning is attached to any bit. Entities of type boolean have available several operations and procedures, all of which are bit-oriented. This module uses module standard_types, which may be obtained from the Portability Project pages.

A list of (most) operators and procedures defined follows.

**Constants****all_set**and**all_clear**are boolean constants with all bits set and all bits clear, respectively.

**Operators****=**4 byte real, integer, logical and character entities may be assigned to a boolean and vice versa. The assignment is a bit-wise copy.**+**and**-**are unary operators which treat boolean variables as signed integers**.set.**and**.clear.**are binary operators requiring a left boolean and a right integer, which set or clear, respectively, the bit in the boolean indicated by the integer.**.isset.**and**.isclear.**are binary logical operators requiring a left boolean and a right integer which are true if the bit indicated by the integer in the boolean is set or clear, respectively.**.and.**,**.or.**and**.eor.**are binary bitwise operators requiring two booleans and producing a boolean result.**.not.**is a unary bitwise operator.**.xor.**,**.eqv.**and**.neqv.**are binary bitwise operators requiring two booleans and producing a boolean result.**.eq.**,**.ne.**,**.gt.**,**.ge.**,**.le.**and**.lt.**are binary logical operators requiring two booleans and producing a logical result. The comparisons take place as if the operands were signed integers.**+**,**-**,*****and**/**are binary operators which treat boolean variables as signed integers.**.hamd.**is a binary operator which computes the Hamming distance between the two booleans and produces an integer result.**.shift.**and**.rotate.**are binary linear and circular shift operators.

**Library****bool()**,**int()**,**real()**,**logical()**and**char()**routines convert between boolean and other four byte types. No change in the underlying bit pattern occurs.**compl()**returns the boolean compliment (reverses each bit) of its operand.**csmg()**provides the merging of two booleans based on a third.**leadz()**,**lastz()**,**popcnt()**and**poppar()**return the integer leading zero count, last zero count, population count and population count parity, respectively.**hamd()**returns the integer Hamming distance.**mask()**,**maskl()**and**maskr()**take integer operands and return masks of type boolean.**ishft()**and**ishftc()**are the boolean equivalents of the standard integer intrinsics.**dshftl()**,**dshftr()**and**dshftc()**are boolean double shifts.**ibset()**,**ibclr()**,**btest()**,**mvbits()**and**ibits()**are the boolean equivalent of the integer intrinsics.**bztest()**returns true if the bit tested is clear rather than set.**not()**reverses each bit of its boolean operand.**rev_endian()**reverses the byte order of a boolean.**swap()**exchanges two booleans.**bit_size()**returns the bit size of its boolean operand.

To download the type_boolean module, click type_boolean. This module depends on the standard_types module, see the portability project for information about how to make one for your compiler.

To make comments or suggestions regarding standard_functions, or any of our software, please E-mail me. We're always happy to share the experiences others have using our software.

Home - Fact Sheet - Free Source Code - Fortran Links - Email me