Dynamic Fraction Library 1.0.0
Reference-counted arbitrary precision rational number library (MIT OR Unlicense)
Loading...
Searching...
No Matches
Functions
Bitwise Operations

Bitwise operations for arbitrary precision integers. More...

Functions

di_int di_and (di_int a, di_int b)
 Bitwise AND of two integers.
 
di_int di_or (di_int a, di_int b)
 Bitwise OR of two integers.
 
di_int di_xor (di_int a, di_int b)
 Bitwise XOR of two integers.
 
di_int di_not (di_int a)
 Bitwise NOT (complement) of an integer.
 
di_int di_shift_left (di_int a, size_t bits)
 Left shift an integer by specified bits.
 
di_int di_shift_right (di_int a, size_t bits)
 Right shift an integer by specified bits.
 

Detailed Description

Bitwise operations for arbitrary precision integers.

Function Documentation

◆ di_and()

di_int di_and ( di_int  a,
di_int  b 
)

Bitwise AND of two integers.

Parameters
aFirst integer (may be NULL)
bSecond integer (may be NULL)
Returns
New di_int with result of a & b, or NULL on failure
Since
1.0.0

Definition at line 2064 of file dynamic_int.h.

◆ di_not()

di_int di_not ( di_int  a)

Bitwise NOT (complement) of an integer.

Parameters
aInteger to complement (may be NULL)
Returns
New di_int with result of ~a, or NULL on failure
Since
1.0.0

Definition at line 2133 of file dynamic_int.h.

◆ di_or()

di_int di_or ( di_int  a,
di_int  b 
)

Bitwise OR of two integers.

Parameters
aFirst integer (may be NULL)
bSecond integer (may be NULL)
Returns
New di_int with result of a | b, or NULL on failure
Since
1.0.0

Definition at line 2087 of file dynamic_int.h.

◆ di_shift_left()

di_int di_shift_left ( di_int  a,
size_t  bits 
)

Left shift an integer by specified bits.

Parameters
aInteger to shift (may be NULL)
bitsNumber of bits to shift left
Returns
New di_int with result of a << bits, or NULL on failure
Since
1.0.0

Definition at line 2155 of file dynamic_int.h.

◆ di_shift_right()

di_int di_shift_right ( di_int  a,
size_t  bits 
)

Right shift an integer by specified bits.

Parameters
aInteger to shift (may be NULL)
bitsNumber of bits to shift right
Returns
New di_int with result of a >> bits, or NULL on failure
Since
1.0.0

Definition at line 2197 of file dynamic_int.h.

◆ di_xor()

di_int di_xor ( di_int  a,
di_int  b 
)

Bitwise XOR of two integers.

Parameters
aFirst integer (may be NULL)
bSecond integer (may be NULL)
Returns
New di_int with result of a ^ b, or NULL on failure
Since
1.0.0

Definition at line 2110 of file dynamic_int.h.