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

Generic type support #11

Open
MatthieuDartiailh opened this issue Jun 7, 2024 · 5 comments · May be fixed by #12
Open

Generic type support #11

MatthieuDartiailh opened this issue Jun 7, 2024 · 5 comments · May be fixed by #12

Comments

@MatthieuDartiailh
Copy link

Hi,

I am wondering if there is anything in the theory of operation of the buffer that would prevent to make it generic over its type.

For example, I could have some use for an spsc_bip_buffer of u32. If there is nothing blocking from a fundamental point of view I may be able to look into making a PR.

Best

@utaal
Copy link
Owner

utaal commented Jun 10, 2024

Hi,

Thanks for bringing this up.

I don't think there's anything fundamental that would prevent this, however it's not clear to me what additional use case we'd support with this addition that's not already covered by one of the regular spsc queues. What's your use case?

@MatthieuDartiailh
Copy link
Author

I have a case in which I need to perform a memcopy from a device BRAM. I need the ability to get a continuous chunk of memory but since I know the device stored u64 values I would like the ring buffer to guarantee the alignment of the pointer to avoid unsafe to transmute it from a u8 buffer.

@MatthieuDartiailh
Copy link
Author

Does this makes sense to you @utaal ?

@utaal
Copy link
Owner

utaal commented Jul 4, 2024

Thanks for bumping this conversation. I think it does - I was trying to think through potential issues, but it sounds like if we're careful when allocating, and if you know you'll always need allocations that are multiples of 64bits and u64-aligned, it should be good.

Did you say you're interested in making a PR? If you do I can commit to review it promptly. Just note that I may realize that something is problematic only when I see the code.

@MatthieuDartiailh
Copy link
Author

I am interested in looking at but my bandwidth is not great. I will let you know when I start looking at it.

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 a pull request may close this issue.

2 participants