Skip to content

Allow zero width BitVecValue#7

Draft
omixann wants to merge 1 commit into
cucapra:mainfrom
omixann:zero-width-support
Draft

Allow zero width BitVecValue#7
omixann wants to merge 1 commit into
cucapra:mainfrom
omixann:zero-width-support

Conversation

@omixann
Copy link
Copy Markdown

@omixann omixann commented May 16, 2026

Fixes #4.

There are a few test cases failing, I'll mark it as ready once I fix them.

@ekiwi
Copy link
Copy Markdown
Collaborator

ekiwi commented May 18, 2026

Thanks for opening the PR?

Is my understanding correct, that the use case for 0-bit values is mostly convenience for users of baa? I.e., to avoid special casing 0-bit things?

I think it would be good to support 0-bit widths as long as it isn't too complicated.

Comment thread src/bv/borrowed.rs

#[derive(Clone, Copy, Hash)]
pub(super) enum BitVecValueRefImpl<'a> {
Empty,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It might be easier to just use Word(0, 0) as connonical empty bit vec.

@omixann
Copy link
Copy Markdown
Author

omixann commented May 19, 2026

Yes, it is for convenience (e.g., it is rather useful as a base case when folding). I like your suggestion of using Word(0, 0) instead of a dedicated Empty value, I'll change that and try to fix tests, thanks for your feedback!

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.

Allow zero-sized BitVecValue

2 participants