c4e_algo32.h File Reference
(Version 551)
Functions and declarations for 32-bit variables, based on digits.
More...
#include "c4e_sys.h"
Go to the source code of this file.
Data Structures |
struct | C4eAlgo32Uint |
| A 32-bit unsigned integer composed from digits. More...
|
Defines |
#define | C4E_ALGO32_DIGIT_SIZE |
| Size of type C4eAlgo32Digit.
|
#define | C4E_ALGO32_DIGITS_PTR(pvar32) |
| Return a C4eArchDigit pointer from a C4eAlgo32Uint pointer, referencing the same memory location.
|
#define | C4E_ALGO32_NUM_DIGITS |
| This define indicates how many digits are used to emulate a 32-bit unsigned integer.
|
#define | C4E_ALGO32_CAST_DIGITS(p) |
| Return a C4eArchDigit pointer from a C4eAlgo32Digit pointer, referencing the same memory location.
|
#define | C4E_ALGO32_CAST_UINT(p) |
| Return a C4eAlgo32Uint pointer from a C4eAlgo32Digit pointer, referencing the same memory location.
|
#define | C4E_ALGO32_DIGITS_NUM(size) |
| Helper macro which calculates the number of C4eAlgo32Digit elements equivalent to a number of bytes.
|
Typedefs |
typedef C4eAlgo32Uint | C4eAlgo32Digit |
| Mixed type of C4eAlgo32Uint (a 32-bit unsigned integer, possibly emulated by digits) and C4eArchDigit, which allows safe casting to one of both using macros C4E_ALGO32_CAST_DIGITS() and C4E_ALGO32_CAST_UINT().
|
Functions |
C4eAlgo32Uint | c4e_algo32_not (C4eAlgo32Uint var32) |
| Bitwise logical negation of an emulated 32-bit number.
|
C4eAlgo32Uint | c4e_algo32_xor (C4eAlgo32Uint a, C4eAlgo32Uint b) |
| Bitwise logical XOR (exclusive-or) of two emulated 32-bit numbers.
|
C4eAlgo32Uint | c4e_algo32_or (C4eAlgo32Uint a, C4eAlgo32Uint b) |
| Bitwise logical OR of two emulated 32-bit numbers.
|
C4eAlgo32Uint | c4e_algo32_and (C4eAlgo32Uint a, C4eAlgo32Uint b) |
| Bitwise logical AND of two emulated 32-bit numbers.
|
void | c4e_algo32_inc (C4eAlgo32Uint *var32) |
| Increments an emulated 32-bit number (by one).
|
C4eAlgo32Uint | c4e_algo32_add (C4eAlgo32Uint a, C4eAlgo32Uint b) |
| Sum of two emulated 32-bit numbers.
|
C4eAlgo32Uint | c4e_algo32_shl (C4eAlgo32Uint var32, C4eArchUint shift, C4eArchUint8 lsb) |
| Shift-left of an emulated 32-bit number by a number of bits.
|
C4eAlgo32Uint | c4e_algo32_shr (C4eAlgo32Uint var32, C4eArchUint shift) |
| Shift-right of an emulated 32-bit number by a number of bits.
|
C4eAlgo32Uint | c4e_algo32_rol (C4eAlgo32Uint var32, C4eArchUint shift) |
| Rotate-left of an emulated 32-bit number by a number of bits.
|
C4eAlgo32Uint | c4e_algo32_ror (C4eAlgo32Uint var32, C4eArchUint shift) |
| Rotate-right of an emulated 32-bit number by a number of bits.
|
Detailed Description
Functions and declarations for 32-bit variables, based on digits.
- Author:
- Copyright (C) 2010-2015 Ralf Hoppe <ralf.hoppe@ieee.org>
- Version:
- Id
- c4e_algo32.h 551 2015-03-01 12:37:45Z ralf
Definition in file c4e_algo32.h.
Define Documentation
#define C4E_ALGO32_DIGIT_SIZE |
#define C4E_ALGO32_DIGITS_PTR |
( |
pvar32 |
|
) |
|
#define C4E_ALGO32_NUM_DIGITS |
This define indicates how many digits are used to emulate a 32-bit unsigned integer.
- Note:
- If it is not defined, then a native 32-bit unsigned integer is used for type C4eAlgo32Uint (else this type is composed from multiple digits).
Definition at line 69 of file c4e_algo32.h.
#define C4E_ALGO32_CAST_DIGITS |
( |
p |
|
) |
|
#define C4E_ALGO32_CAST_UINT |
( |
p |
|
) |
|
#define C4E_ALGO32_DIGITS_NUM |
( |
size |
|
) |
|
Helper macro which calculates the number of C4eAlgo32Digit elements equivalent to a number of bytes.
- Parameters:
-
[in] | size | Number of bytes. |
- Returns:
- Equivalent number of elements of type C4eAlgo32Digit.
Definition at line 172 of file c4e_algo32.h.
Function Documentation
Bitwise logical negation of an emulated 32-bit number.
- Parameters:
-
[in] | var32 | The number to invert bitwise. |
- Returns:
- Result ~
var32
.
Bitwise logical XOR (exclusive-or) of two emulated 32-bit numbers.
- Parameters:
-
[in] | a | First operand. |
[in] | b | Second operand. |
- Returns:
- Result of
a
^ b
.
Bitwise logical OR of two emulated 32-bit numbers.
- Parameters:
-
[in] | a | First operand. |
[in] | b | Second operand. |
- Returns:
- Result of
a
| b
.
Bitwise logical AND of two emulated 32-bit numbers.
- Parameters:
-
[in] | a | First operand. |
[in] | b | Second operand. |
- Returns:
- Result of
a
& b
.
Increments an emulated 32-bit number (by one).
- Parameters:
-
[in,out] | var32 | The number to increment modulo . |
Sum of two emulated 32-bit numbers.
- Parameters:
-
[in] | a | First summand. |
[in] | b | Second summand. |
- Returns:
- Result of .
Shift-left of an emulated 32-bit number by a number of bits.
- Precondition:
- The value
lsb
must fit into the least significant bits, which are cleared while left-shifting var32
.
- Parameters:
-
[in] | var32 | 32-bit variable to be shifted left. |
[in] | shift | The number of bits x shall be shifted left. |
[in] | lsb | Least significant byte, which is or'ed in to the return value (after the left-shift). |
- Returns:
- 32-bit variable
var32
shifted left by shift
bits.
Shift-right of an emulated 32-bit number by a number of bits.
- Parameters:
-
[in] | var32 | 32-bit variable to be shifted right. |
[in] | shift | The number of bits x shall be shifted right. |
- Returns:
- 32-bit variable
var32
shifted right by shift
bits.
Rotate-left of an emulated 32-bit number by a number of bits.
- Parameters:
-
[in] | var32 | 32-bit variable to be rotated left. |
[in] | shift | The number of bits x shall be rotated left. |
- Returns:
- 32-bit variable
var32
rotated left by shift
bits.
Rotate-right of an emulated 32-bit number by a number of bits.
- Parameters:
-
[in] | var32 | 32-bit variable to be rotated right. |
[in] | shift | The number of bits x shall be rotated right. |
- Returns:
- 32-bit variable
var32
rotated right by shift
bits.