Small generic macros.
More...
|
| #define | container_of(ptr, type, member) ((type *)((char *)(ptr) - (size_t)&(((type *)0)->member))) |
| | Get the structure that contains a member.
|
| |
| #define | PBL_SWAP(a, b) |
| | Swap the values of two lvalues of the same type.
|
| |
| #define | PBL_FOURCC(a, b, c, d) |
| | Pack four characters into a uint32_t, the first one in the most significant byte.
|
| |
Small generic macros.
◆ container_of
| #define container_of |
( |
|
ptr, |
|
|
|
type, |
|
|
|
member |
|
) |
| ((type *)((char *)(ptr) - (size_t)&(((type *)0)->member))) |
Get the structure that contains a member.
- Parameters
-
| ptr | Pointer to the member. |
| type | Type of the containing structure. |
| member | Name of the member within type. |
- Returns
- Pointer to the containing structure.
◆ PBL_FOURCC
| #define PBL_FOURCC |
( |
|
a, |
|
|
|
b, |
|
|
|
c, |
|
|
|
d |
|
) |
| |
Value: ((uint32_t)(((uint32_t)(uint8_t)(a) << 24) | ((uint32_t)(uint8_t)(b) << 16) | \
((uint32_t)(uint8_t)(c) << 8) | (uint32_t)(uint8_t)(d)))
Pack four characters into a uint32_t, the first one in the most significant byte.
- Parameters
-
| a | First character. |
| b | Second character. |
| c | Third character. |
| d | Fourth character. |
◆ PBL_SWAP
| #define PBL_SWAP |
( |
|
a, |
|
|
|
b |
|
) |
| |
Value: do { \
__typeof__(a) _pbl_swap_tmp = (a); \
(a) = (b); \
(b) = _pbl_swap_tmp; \
} while (0)
Swap the values of two lvalues of the same type.
- Parameters
-
| a | First lvalue, evaluated more than once. |
| b | Second lvalue, evaluated more than once. |