|
Mac OS 9
|
Toolbox Utilities Interfaces. More...
#include <MacTypes.h>#include <FixMath.h>#include <TextUtils.h>#include <Icons.h>#include <Quickdraw.h>Go to the source code of this file.
Macros | |
| #define | HiWord(x) ((short)((long)(x) >> 16)) |
| #define | LoWord(x) ((short)(x)) |
Functions | |
| Boolean | BitTst (const void *bytePtr, long bitNum) |
| void | BitSet (void *bytePtr, long bitNum) |
| Set a specified bit in a bit string to a 1. More... | |
| void | BitClr (void *bytePtr, long bitNum) |
Variables | |
| x = op1 & op2 | |
| </pre > *par | Copyright |
| </pre > *par long | value2 |
| </pre > *par short | count |
Toolbox Utilities Interfaces.
For bug reports, consult the following page on the World Wide Web:
http://developer.apple.com/bugreporter/
| void BitClr | ( | void * | bytePtr, |
| long | bitNum | ||
| ) |
\brief Clear a specified bit in a bit string to a 0 <pre>BitClr clears a specified bit in a bit string to a 0.
bytePtr is the address of the first byte of a sequence of bytes. bitNumidentifies the bit to clear. It is a positive offset from the first bit in the byte addressed by bytePtr. Bits are identified by a logical mapping (matching that used for screen pixels), rather than the normal high-to-low numbering used in CPU operations. See BitTst for details.
none
| void BitSet | ( | void * | bytePtr, |
| long | bitNum | ||
| ) |
Set a specified bit in a bit string to a 1.
@par Non-Carbon CFM: in InterfaceLib 7.1 and later
| Boolean BitTst | ( | const void * | bytePtr, |
| long | bitNum | ||
| ) |
©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©© Note:
The following routines that used to be in this header file, have moved to more appropriate headers.
FixMath.h: FixMul
FixRatio
FixRound
Icons.h: GetIcon
PlotIcon
Quickdraw.h: AngleFromSlope
DeltaPoint
GetCursor
GetIndPattern
GetPattern
GetPicture
PackBits
ScreenRes
ShieldCursor
SlopeFromAngle
UnpackBits
TextUtils.h: Munger
GetIndString
GetString
NewString
SetString
©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©©
\brief Determine state of a bit in a bit string <pre>Any bit in the bit string can be accessed individually via BitTst, BitSet,
and BitClr. Other Toolbox BitXxx functions apply to bitwise operations between long integers and not relevant for C programmers.
| x = op1 & op2 |
\brief Obtain bitwise AND of two 32-bit longs \param op1 32-bit value to be masked
| op2 | 32-bit mask to apply BitAnd returns the logical product (a bitwise AND) of two 32-bit values. The operands are not changed. op1and . . . op2are 32-bit long operands. The bit pattern of op1 is masked by the bits of op2. |
a long integer; the result of ( op1 & op2 ).
Bits in op1 that are also set in op2 are set to 1 in the result. All other bits of the result are cleared to 0. Note that op1 and op2 can be in either order without affecting the result. This capability is native to the CPU and can be performed much faster using the C & (bitwise AND) operator. longx, op1, op2; x = BitAnd( op1, op2); /* is equivalent to . . .\brief Obtain bitwise OR of two 32-bit longs \param op1 32-bit values . . .
| op2 | . . . to be ORed
|
a long integer; the result of ( op1 | op2 ).
Bits that are set in either op1 or op2 are set to 1 in the result. All other bits of the result are cleared to 0. This capability is native to the CPU and can be performed much faster using the C | (bitwise OR) operator or the Assembler OR or ORI opcode. longx, op1, op2; x = BitOr( op1, op2); /* is equivalent to . . .\brief Obtain bitwise XOR of two 32-bit longs \param op1 32-bit values . . .
| op2 | |
a long integer; the result of ( op1 ^ op2 ).
A bit in the result is set to 1 when bits of op1 and op2 contain opposite values; other bits are cleared. Alternative explanation: the bits of op2 "toggle" the bits of op1 . This capability is native to the CPU and can be performed much faster using the C ^ (bitwise XOR) operator. longx, op1, op2; x = BitXor( op1, op2); /* is equivalent to . . .\brief Obtain bitwise NOT (complement) of two longs <pre>BitNot returns the complement (a bitwise NOT) of a 32-bit operand.operand is a 32-bit long operand.
a long integer; the result of ~operand.
Bits of operand that are 0 are set to 1 in the result; all other bits of the result are cleared to 0. This capability is native to the CPU and can be performed much faster using the C ~ (bitwise NOT) operator. longx, operand; x = BitNot( operand); /* is equivalent to . . .\brief Obtain result of left- or right-shifted 32-bit value \param op 32-bit values to be shifted <pre>BitShift returns the value of bit-shifted a 32-bit operand. Bit shifting canbe used for fast multiplication and division by a power of 2. opis a 32-bit long operand. countspecifies the direction and extent of the shift operation. The bits are shifted ABS( count ) positions. count is always treated MOD 32 (should range from -31 to +31). <0(negative values) shift to the right >0(positive values) shift to the left 0Nothing happens
a long integer; the result of ( op << count ) or (op >> (-count )).
Bits of op are shifted either right or left, depending on the sign of count . Bits shifted off the end are lost and the vacated positions are cleared to 0. Note that a left shift is the same as an unsigned multiplication by 2, 4, 8, etc. A right shift is the same as unsigned division by 2, 4, 8, etc. This capability is native to the CPU and can be performed much faster using the C >> and << (bitwise shift) operators or the assembler LSL or LSR opcodes. longx, operand; shortcount; x = BitShift ( operand, count ); /* is equivalent to . . .