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

Portable pointer size #89

Open
andrea-marchini opened this issue Oct 24, 2020 · 0 comments
Open

Portable pointer size #89

andrea-marchini opened this issue Oct 24, 2020 · 0 comments

Comments

@andrea-marchini
Copy link

Hi,

cool project, thanks for sharing! I suggest to use a portable pointer size, e.g.:
#define vpu_align(ptr, align) (((unsigned int) ptr+(align)-1)/(align)*(align))
could be:
#define vpu_align(ptr, align) (((uintptr_t) ptr+(align)-1)/(align)*(align))
Because size of pointers depends on platforms, and uintptr_t is an unsigned integer type with the size of the pointer, independently from the platform. Using gcc flag -fpermissive may help to highlight these spots.

Andrea

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

No branches or pull requests

1 participant