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

lib: utilities: add MB and GB defines #249

Merged
merged 1 commit into from
Sep 11, 2023
Merged

Conversation

tnmysh
Copy link
Collaborator

@tnmysh tnmysh commented Aug 16, 2023

If MB and GB definition is not available then define new ones.

This also addresses: #242

If MB and GB definition is not available then define new ones

Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
#define MB (1024 * 1024UL)
#define GB (1024 * 1024 * 1024UL)
#ifndef MB
#define MB (1024UL << 10UL)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@arnopo

I have question here. Since MB and GB are so common terms, should we check values compile time of MB and GB if they are defined somewhere else ?

For example:

#ifndef MB
...
#else

#if (MB != (1024 * 1024))
#error "error: unexpected value of MB"
#endif

something like this? Since MB can be defined as 1000 * 1000.

I am asking since want to know if it's overkill and we can simply assume that everywhere it will be defined as 1024 * 1024.

Thanks,
Tanmay

Copy link
Contributor

Choose a reason for hiding this comment

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

For me we can assume that MB is defined as 1024 *1024.

#define MB (1024 * 1024UL)
#define GB (1024 * 1024 * 1024UL)
#ifndef MB
#define MB (1024UL << 10UL)
Copy link
Contributor

Choose a reason for hiding this comment

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

For me we can assume that MB is defined as 1024 *1024.

@arnopo
Copy link
Contributor

arnopo commented Sep 7, 2023

@edmooring
could you review it please ?

@arnopo arnopo merged commit 0ad1183 into OpenAMP:main Sep 11, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants