Simplifies manipulation of integer types.
More...
|
| #define | increment(i) |
| | Adds 1 to the value of the given integer type.
|
| |
| #define | decrement(i) |
| | Subtracts 1 from the value of the given integer type.
|
| |
| #define | negate(i) |
| | Negates the value of the given integer type.
|
| |
| #define | factorial(i) |
| | Returns the factorial of the given integer type.
|
| |
| #define | from_string(i, str, b) |
| | Tries to set the value of the given integer type by parsing a numeric string.
|
| |
| #define | as_binary(i) |
| | Returns the binary equivalent of the given integer type as a string.
|
| |
Simplifies manipulation of integer types.
These function macros accept any integral type, i.e., any struct representing an integer.
◆ as_binary
Returns the binary equivalent of the given integer type as a string.
- Parameters
-
- Returns
- A string representation of
i in base-2 notation.
◆ decrement
Subtracts 1 from the value of the given integer type.
- Parameters
-
◆ factorial
Returns the factorial of the given integer type.
- Parameters
-
- Returns
- The factorial of
i, if computable, otherwise 0.
◆ from_string
| #define from_string |
( |
|
i, |
|
|
|
str, |
|
|
|
b |
|
) |
| |
Tries to set the value of the given integer type by parsing a numeric string.
- Parameters
-
| i | An integer type. |
| str | A string representation of an integral value. |
| b | The radix to use when parsing str. |
◆ increment
Adds 1 to the value of the given integer type.
- Parameters
-
◆ negate
Negates the value of the given integer type.
- Parameters
-