Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

Previous Book Contents Book Index Next

Inside Macintosh: Operating System Utilities /
Chapter 3 - Mathematical and Logical Utilities / Mathematical and Logical Utilities Reference
Routines / Testing and Setting Bits


You can use the BitTst function to determine whether a given bit is set.

FUNCTION BitTst (bytePtr: Ptr; bitNum: LongInt): Boolean;
A pointer to a byte in memory.
The bit to be tested, specified as a positive offset from the high-order bit of the byte pointed to by the bytePtr parameter. The bit being tested need not be in the byte pointed to by bytePtr.
The BitTst function returns TRUE if the bit specified by the bytePtr and bitNum parameters is set (that is, has a value of 1) and returns FALSE if the specified bit is cleared (that is, has a value of 0).

The bit-numbering scheme used by the BitTst function is the opposite of MC680x0 bit numbering. To convert an MC680x0 bit number to the format required by the BitTst function, subtract the MC680x0 bit number from the highest bit number.

For an example of the use of the BitTst function, see Listing 3-2 on page 3-15. For more information about reversed bit-numbering see, "Reversed Bit-Numbering" on page 3-7.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996

Get information on Apple products.
Visit the Apple Store online or at retail locations.

Copyright © 2004 Apple Computer, Inc.
All rights reserved. | Terms of use | Privacy Notice