Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move overflow macros from VFDs to H5FDpkg.h #5084

Merged
merged 1 commit into from
Nov 8, 2024

Conversation

derobins
Copy link
Member

@derobins derobins commented Nov 8, 2024

These are identical in all VFDs except the core VFD, so they've been moved to H5FDpkg.h and renamed:

* MAXADDR           -->     H5FD_MAXADDR
* ADDR_OVERFLOW     -->     H5FD_ADDR_OVERFLOW
* SIZE_OVERFLOW     -->     H5FD_SIZE_OVERFLOW
* REGION_OVERFLOW   -->     H5FD_REGION_OVERFLOW

These are identical in all VFDs except the core VFD, so they've
been moved to H5FDpkg.h and renamed:

    * MAXADDR           -->     H5FD_MAXADDR
    * ADDR_OVERFLOW     -->     H5FD_ADDR_OVERFLOW
    * SIZE_OVERFLOW     -->     H5FD_SIZE_OVERFLOW
    * REGION_OVERFLOW   -->     H5FD_REGION_OVERFLOW
@derobins derobins added Priority - 3. Low 🔽 Code cleanup, small feature change requests, etc. Component - C Library Core C library issues (usually in the src directory) Type - Improvement Improvements that don't add a new feature or functionality labels Nov 8, 2024
@derobins
Copy link
Member Author

derobins commented Nov 8, 2024

Just to show that they are, in fact, identical...

#define MAXADDR          (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) /* subfiling ioc */
#define MAXADDR          (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) /* subfiling */
#define MAXADDR          (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) /* ros3 */
#define MAXADDR          (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) /* splitter */
#define MAXADDR          (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) /* onion */
#define MAXADDR          (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) /* direct *?
#define MAXADDR          (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) /* mirror */
#define MAXADDR          (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) /* sec2 */
#define MAXADDR          (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) /* log */
#define MAXADDR          (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) /* hdfs */
#define MAXADDR          (((haddr_t)1 << (8 * sizeof(HDoff_t) - 1)) - 1) /* stdio */

#define MAXADDR          ((haddr_t)((~(size_t)0) - 1)) /* core */





#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) /* subfiling ioc */
#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) /* subfiling */
#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) /* splitter */
#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) /* direct */
#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) /* sec2 */
#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) /* log */
#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) /* stdio */

#define SIZE_OVERFLOW(Z) ((Z) > (hsize_t)MAXADDR) /* core */




#define ADDR_OVERFLOW(A) (HADDR_UNDEF == (A) || ((A) & ~(haddr_t)MAXADDR)) /* subfiling ioc */
#define ADDR_OVERFLOW(A) (HADDR_UNDEF == (A) || ((A) & ~(haddr_t)MAXADDR)) /* subfiling */
#define ADDR_OVERFLOW(A) (HADDR_UNDEF == (A) || ((A) & ~(haddr_t)MAXADDR)) /* ros3 */
#define ADDR_OVERFLOW(A) (HADDR_UNDEF == (A) || ((A) & ~(haddr_t)MAXADDR)) /* splitter */
#define ADDR_OVERFLOW(A) (HADDR_UNDEF == (A) || ((A) & ~(haddr_t)MAXADDR)) /* direct */
#define ADDR_OVERFLOW(A) (HADDR_UNDEF == (A) || ((A) & ~(haddr_t)MAXADDR)) /* mirror */
#define ADDR_OVERFLOW(A) (HADDR_UNDEF == (A) || ((A) & ~(haddr_t)MAXADDR)) /* sec2 */
#define ADDR_OVERFLOW(A) (HADDR_UNDEF == (A) || ((A) & ~(haddr_t)MAXADDR)) /* log */
#define ADDR_OVERFLOW(A) (HADDR_UNDEF == (A) || ((A) & ~(haddr_t)MAXADDR)) /* hdfs */
#define ADDR_OVERFLOW(A) (HADDR_UNDEF == (A) || ((A) & ~(haddr_t)MAXADDR)) /* stdio */

#define ADDR_OVERFLOW(A) (HADDR_UNDEF == (A) || (A) > (haddr_t)MAXADDR) /* core */

Copy link
Contributor

@qkoziol qkoziol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice :-)

Nit: Might be sensible to put the H5FD_ prefix in for the core VFD macros.

@derobins
Copy link
Member Author

derobins commented Nov 8, 2024

Nice :-)

Nit: Might be sensible to put the H5FD_ prefix in for the core VFD macros.

They get CORE_ prefixes and are local to H5FDcore.c because they are different from all the other VFDs.

@derobins derobins merged commit faec68f into HDFGroup:develop Nov 8, 2024
69 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - C Library Core C library issues (usually in the src directory) Priority - 3. Low 🔽 Code cleanup, small feature change requests, etc. Type - Improvement Improvements that don't add a new feature or functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants