Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ bitset(3C) — DG/UX 4.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought



                                                               bitset(3C)



        _________________________________________________________________
        bitset                                          $builtin function
        Set a bit to either 0 or 1.
        _________________________________________________________________


        Calling Sequence

        #include <bit.h>
        void bitset();
        short *ptr;
        int offset, value;
        bitset(ptr, offset, value);

        or

        $builtin void bitset();
        short *ptr;
        int offset, value;
        bitset(ptr, offset, value);


        Description

        The bitset function sets the bit specified by a word pointer,
        ptr, and a non-negative bit offset, offset, to 0 if the least
        significant bit of value is 0; otherwise, the bit is set to 1.
        Note that the most significant bit in the 16-bit word pointed to
        by ptr is at offset 0, and the least significant bit is at offset
        15.  If the offset is negative, the bitset routine may cause an
        error.

        The first calling sequence noted above uses a function call.  The
        second might generate smaller or faster code, but may not run
        under other C compilers.

        The include file bit.h defines this function.


        Returns

        The bitset function does not return anything.


        Related Functions

        See also the bitvalue and bitszbo functions.


        Example




        DG/UX 4.00                                                 Page 1
               Licensed material--property of copyright holder(s)





                                                               bitset(3C)



        /* Program test for the bitset() function */

        #include <bit.h>
        #include <stdio.h>


        short s;

        main() {
            s = 3;                       /* bits 15 & 14 are 1 */
            bitset(&s, 0, 1);            /* set bit 0 to 1 */
            bitset(&s, 15, 0);           /* set bit 15 to 0 */
            (void) printf("s = %hx (hexadecimal)\n", s);
        }

        The above program produces the output

        s = 8002 (hexadecimal)




































        DG/UX 4.00                                                 Page 2
               Licensed material--property of copyright holder(s)



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026