Skip to content

Commit

Permalink
options/internal: reorder and rename params of __MLIBC_FIELD_PADDED
Browse files Browse the repository at this point in the history
  • Loading branch information
FedorLap2006 committed Mar 4, 2024
1 parent 7a854fd commit f0b6039
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion options/ansi/include/bits/ansi/timespec.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct timespec {
time_t tv_sec;
// tv_nspec is required to be long by the C standard.
// However linux kernel expects long long. So we add padding.
__MLIBC_FIELD_PADDED(long, tv_nsec, long long);
__MLIBC_FIELD_PADDED(long, long long, tv_nsec);
};

#endif // MLIBC_TIMESPEC_H
Expand Down
7 changes: 3 additions & 4 deletions options/internal/include/bits/field-padding.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#ifndef MLIBC_FIELD_PADDING_H
#define MLIBC_FIELD_PADDING_H


#define __MLIBC_FIELD_PADDED(T, F, PT) \
PT : (sizeof(PT)-sizeof(T))*8*(__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__); \
#define __MLIBC_FIELD_PADDED(T, AT, F) \
AT : (sizeof(AT)-sizeof(T))*8*(__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__); \
T F; \
PT : (sizeof(PT)-sizeof(T))*8*(__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
AT : (sizeof(AT)-sizeof(T))*8*(__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)

#endif

0 comments on commit f0b6039

Please sign in to comment.