|
Mac OS 9
|
64-bit integer math Interfaces. More...
Go to the source code of this file.
Macros | |
| #define | S64Div(dividend, divisor) (S64Divide((dividend), (divisor), NULL)) |
| #define | U64Div(dividend, divisor) (U64Divide((dividend), (divisor), NULL)) |
| #define | SInt64ToWide(x) (x) |
| #define | WideToSInt64(x) (x) |
| #define | UInt64ToUnsignedWide(x) (x) |
| #define | UnsignedWideToUInt64(x) (x) |
64-bit integer math Interfaces.
For bug reports, consult the following page on the World Wide Web:
http://developer.apple.com/bugreporter/
Functions to convert between [Unsigned]Wide and [S|U]Int64 types.
These functions are necessary if source code which uses both wide and SInt64 is to compile under a compiler that supports long long.
SInt64ToWide
Converts a SInt64 to a wide struct. If SInt64 is implemented
as a typedef of wide, the marco does nothing. If SInt64 is
implememnted as a long long, it casts the long long into a
wide struct.
WideToSInt64
Converts a wide struct into a SInt64. If SInt64 is implemented
as a typedef of wide, the marco does nothing. If SInt64 is
implememnted as a long long, it reads the struct into a long
long.
| SInt32 S32Set | ( | SInt64 | value | ) |
Discussion: Given an SInt64, returns an SInt32 by discarding the high-order 32 bits.
Discussion: Returns the absolute value of the number (i.e. the number if it is positive, or 0 - the number if it is negative). Disabled for compilers that support long long until llabs() is available everywhere.
Discussion: Adds two integers, producing an integer result. If an overflow occurs the result is congruent mod (2^64) as if the operands and result were unsigned. No overflow is signaled.
Discussion: Returns one if left and right are non-zero, otherwise returns zero
Discussion: bitwise AND
Discussion: bitwise XOR
Discussion: bitwise negate
Discussion: bitwise OR
Discussion: Given two signed numbers, left and right, returns an SInt32 that compares with zero the same way left compares with right. If you wanted to perform a comparison on 64-bit integers of the form: operand_1 <operation> operand_2 then you could use an expression of the form: xxxS64Compare(operand_1,operand_2) <operation> 0 to test for the same condition. CAUTION: DO NOT depend on the exact value returned by this routine. Only the sign (i.e. positive, zero, or negative) of the result is guaranteed.
CALL_NOT_IN_CARBON S64Divide()
Discussion: Divides dividend by divisor, returning the quotient. The remainder is returned in *remainder if remainder (the pointer) is non-NULL. The sign of the remainder is the same as the sign of the dividend (i.e. it takes the absolute values of the operands, does the division, then fixes the sign of the quotient and remainder). If the divisor is zero, then S64Max() will be returned (or S64Min() if the dividend is negative), and the remainder will be the dividend; no error is reported.
Discussion: Returns one if left xor right are non-zero, otherwise returns zero
| SInt64 S64Max | ( | void | ) |
Discussion: Returns largest possible SInt64 value
| SInt64 S64Min | ( | void | ) |
Discussion: Returns smallest possible SInt64 value
Discussion: Returns the remainder of divide of dividend by divisor. The sign of the remainder is the same as the sign of the dividend (i.e., it takes the absolute values of the operands, does the division, then fixes the sign of the quotient and remainder).
!TYPE_LONGLONG S64Multiply()
Discussion: Multiplies two signed numbers, producing a signed result. Overflow is ignored and the low-order part of the product is returned. The sign of the result is not guaranteed to be correct if the magnitude of the product is not representable.
Discussion: Returns the additive inverse of a signed number (i.e. it returns 0 - the number). S64Negate (S64Min) is not representable (in fact, it returns S64Min).
Discussion: Returns one if value is non-zero, otherwisze returns zero.
Discussion: Returns one if left or right are non-zero, otherwise returns zero
| SInt64 S64Set | ( | SInt32 | value | ) |
Discussion: Given an SInt32, returns an SInt64 with the same value. Use this routine instead of coding 64-bit constants (at least when the constant will fit in an SInt32).
| SInt64 S64SetU | ( | UInt32 | value | ) |
Discussion: Given a UInt32, returns a SInt64 with the same value.
Discussion: Logical shift of value by the lower 7 bits of the shift.
Discussion: Arithmetic shift of value by the lower 7 bits of the shift.
Discussion: Subtracts two integers, producing an integer result. If an overflow occurs the result is congruent mod (2^64) as if the operands and result were unsigned. No overflow is signaled.
Discussion: converts SInt64 -> UInt64
| UInt32 U32SetU | ( | UInt64 | value | ) |
Discussion: Given an UInt64, returns an UInt32 by discarding the high-order 32 bits.
Discussion: Adds two unsigned integers, producing an integer result. If an overflow occurs the result is congruent mod (2^64) as if the operands and result were unsigned. No overflow is signaled.
Discussion: Returns one if left and right are non-zero, otherwise returns zero
Discussion: bitwise AND
Discussion: bitwise XOR
Discussion: bitwise negate
Discussion: bitwise OR
Discussion: Given two unsigned numbers, left and right, returns an SInt32 that compares with zero the same way left compares with right. If you wanted to perform a comparison on 64-bit integers of the form: operand_1 <operation> operand_2 then you could use an expression of the form: xxxU64Compare(operand_1,operand_2) <operation> 0 to test for the same condition. CAUTION: DO NOT depend on the exact value returned by this routine. Only the sign (i.e. positive, zero, or negative) of the result is guaranteed.
CALL_NOT_IN_CARBON U64Divide()
Discussion: Divides dividend by divisor, returning the quotient. The remainder is returned in *remainder if remainder (the pointer) is non-NULL. The sign of the remainder is the same as the sign of the dividend (i.e. it takes the absolute values of the operands, does the division, then fixes the sign of the quotient and remainder). If the divisor is zero, then U64Max() will be returned (or U64Min() if the dividend is negative), and the remainder will be the dividend; no error is reported.
Discussion: Returns one if left xor right are non-zero, otherwise returns zero
| UInt64 U64Max | ( | void | ) |
TYPE_LONGLONG || !TYPE_LONGDOUBLE_IS_DOUBLE U64Max()
Discussion: Returns largest possible UInt64 value
Discussion: Returns the remainder of divide of dividend by divisor. The sign of the remainder is the same as the sign of the dividend (i.e., it takes the absolute values of the operands, does the division, then fixes the sign of the quotient and remainder).
Discussion: Multiplies two unsigned numbers, producing a signed result. Overflow is ignored and the low-order part of the product is returned. The sign of the result is not guaranteed to be correct if the magnitude of the product is not representable.
Discussion: Returns one if value is non-zero, otherwisze returns zero.
Discussion: Returns one if left or right are non-zero, otherwise returns zero
| UInt64 U64Set | ( | SInt32 | value | ) |
Discussion: Given an SInt32, returns an UInt64 with the same value. Use this routine instead of coding 64-bit constants (at least when the constant will fit in an SInt32).
| UInt64 U64SetU | ( | UInt32 | value | ) |
Discussion: Given a UInt32, returns a UInt64 with the same value.
Discussion: Logical shift of value by the lower 7 bits of the shift.
Discussion: Arithmetic shift of value by the lower 7 bits of the shift.
Discussion: Subtracts two unsigned integers, producing an integer result. If an overflow occurs the result is congruent mod (2^64) as if the operands and result were unsigned. No overflow is signaled.
TYPE_LONGLONG || !TYPE_LONGDOUBLE_IS_DOUBLE UInt64ToSInt64()
Discussion: converts UInt64 -> SInt64