mask(3I)

_mask, _maskl, _maskr, MASK - Returns a bit mask

As shipped in IRIX 6.5.22. Last changed in IRIX 6.5.19.

NAME
     _mask, _maskl, _maskr, MASK - Returns a bit mask

SYNOPSIS
     C/C++:

     #include <intrinsics.h>
     long _mask (long i);
     long _maskl (long i);
     long _maskr (long i);

     Fortran:

     MASK ([I=]i)

STANDARDS
     C/C++ extension

     Fortran extension

DESCRIPTION
   C++
     The _mask function forms a mask of bits set to 1, left-justified or
     right-justified.  If 0 <= i <= 63, a left-justified mask of bits set
     to 1, i bits long, is formed.  Otherwise, a right-justified mask of
     bits set to 1, (128 - i) bits long, is formed.  Value i must be in the
     range of 0 through 128.

     The _maskl function returns a left-justified mask of i bits set to 1.
     Value i must be in the range of 0 through 64.

     The _maskr function returns a right-justified mask of i bits set to 1.
     Value i must be in the range of 0 through 64.

     Because these are intrinsic functions, no externally visible library
     functions are available for them.  The compiler generates inline code
     to produce the result.

   Fortran
     The MASK function returns a bit mask of 1's.

     On IRIX systems, the argument is an 8-bit, 16-bit, 32-bit, or 64-bit
     integer.

     It accepts the following argument:

     i    In Fortran, this must be an integer argument, as follows:

          * If i is an 8-bit object, i must be in the range 0 <= i <= 16.

          * If i is a 16-bit object, i must be in the range 0 <= i <= 32.

          * If i is a 32-bit object, i must be in the range 0 <= i <= 64.

          * If i is a 64-bit object, i must be in the range 0 <= i <= 128.

     MASK is an elemental function.  The name of this function cannot be
     passed as an argument.

     This is an outmoded routine.  Refer to the MIPSpro Fortran Language
     Reference Manual, Volume 2, for information about outmoded features
     and their preferred standard alternatives.

RETURN VALUES
     In C/C++, the mask functions return a 64-bit object.

     In Fortran, MASK returns an integer result on IRIX systems.

     When i is a 64-bit object, the return values are of the following
     form:

     * If i is in the range 0 <= i <= 64, a left-justified mask of i bits
       is returned.

     * If i is in the range 65 <= i <= 128, a right-justified mask of (128
       - i) bits is returned.

     When i is a 32-bit object, the return values are of the following
     form:

     * If i is in the range 0 <= i <= 32, a left-justified mask of i bits
       is returned.

     * If i is in the range 33 <= i <= 64, a right-justified mask of (64 -
       i) bits is returned.

     When i is a 16-bit object, the return values are of the following
     form:

     * If i is in the range 0 <= i <= 16, a left-justified mask of i bits
       is returned.

     * If i is in the range 17 <= i <= 32, a right-justified mask of (32 -
       i) bits is returned.

     When i is a 8-bit object, the return values are of the following form:

     * If i is in the range 0 <= i <= 8, a left-justified mask of i bits is
       returned.

     * If i is in the range 7 <= i <= 16, a right-justified mask of (16 -
       i) bits is returned.

EXAMPLES
     Fortran:  The following section of Fortran code shows the MASK
     function used with several different arguments.  The bit patterns of
     the results are given.

          INTEGER I1, I2, I3
          ...
          I1 = MASK(3)
          I2 = MASK(64)
          I3 = MASK(127)

           -----------------------------------------------------
          | 1 | 1 | 1 | 0 | 0 | 0 | 0 |    ...    | 0 | 0 | 0 |
           -----------------------------------------------------
                                     I1

           ---------------------------------------------
          | 1 | 1 | 1 | 1 |    ...    | 1 | 1 | 1 | 1 |
           ---------------------------------------------
                              I2

           ---------------------------------------------
          | 0 | 0 | 0 | 0 |    ...    | 0 | 0 | 0 | 1 |
           ---------------------------------------------
                              I3