bits.h -> bitops.h, start bitops refactor: target all implem. visible

This commit is contained in:
2024-01-03 19:13:44 +01:00
parent b63a5cceda
commit 0dcca10559
13 changed files with 55 additions and 41 deletions

View File

@@ -1,6 +1,6 @@
/* struct-group.h - mirrored structure macros.
*
* Copyright (C) 2021-2022 Bruno Raoult ("br")
* Copyright (C) 2021-2024 Bruno Raoult ("br")
* Licensed under the GNU General Public License v3.0 or later.
* Some rights reserved. See COPYING.
*
@@ -33,10 +33,10 @@
* as both having struct attributes appended.
*/
#define __struct_group(TAG, NAME, ATTRS, MEMBERS...) \
union { \
struct { MEMBERS } ATTRS; \
struct TAG { MEMBERS } ATTRS NAME; \
}
union { \
struct { MEMBERS } ATTRS; \
struct TAG { MEMBERS } ATTRS NAME; \
}
/**
* DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union
@@ -48,11 +48,11 @@
* struct, it needs to be wrapped in an anonymous struct with at least 1
* named member, but that member can be empty.
*/
#define DECLARE_FLEX_ARRAY(TYPE, NAME) \
struct { \
struct { } __empty_ ## NAME; \
TYPE NAME[]; \
}
#define DECLARE_FLEX_ARRAY(TYPE, NAME) \
struct { \
struct { } __empty_ ## NAME; \
TYPE NAME[]; \
}
/**
* struct_group() - Wrap a set of declarations in a mirrored struct
@@ -67,7 +67,7 @@
* struct members.
*/
#define struct_group(NAME, MEMBERS...) \
__struct_group(/* no tag */, NAME, /* no attrs */, MEMBERS)
__struct_group(/* no tag */, NAME, /* no attrs */, MEMBERS)
/**
* struct_group_attr() - Create a struct_group() with trailing attributes
@@ -83,7 +83,7 @@
* struct members. Includes structure attributes argument.
*/
#define struct_group_attr(NAME, ATTRS, MEMBERS...) \
__struct_group(/* no tag */, NAME, ATTRS, MEMBERS)
__struct_group(/* no tag */, NAME, ATTRS, MEMBERS)
/**
* struct_group_tagged() - Create a struct_group with a reusable tag
@@ -100,6 +100,6 @@
* so the specified layout can be reused later.
*/
#define struct_group_tagged(TAG, NAME, MEMBERS...) \
__struct_group(TAG, NAME, /* no attrs */, MEMBERS)
__struct_group(TAG, NAME, /* no attrs */, MEMBERS)
#endif /* _STRUCT_GROUP_H */