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

Support for bool arrays. #10

Open
xivk opened this issue Aug 21, 2017 · 3 comments
Open

Support for bool arrays. #10

xivk opened this issue Aug 21, 2017 · 3 comments
Assignees
Milestone

Comments

@xivk
Copy link
Contributor

xivk commented Aug 21, 2017

Implement support for boolean arrays where one bit represents on bool.

We need to make breaking changes because this would make the elementsize < 1 byte.

@xivk xivk self-assigned this Aug 21, 2017
@xivk xivk added this to the Version 2.0 milestone Aug 21, 2017
@juliusfriedman
Copy link

juliusfriedman commented Mar 9, 2020

Was thinking abou this, You could also make it such that a bool[] has a default elementSize of 1 and the remaining bits are unused to preserve the elementSize == 1, the 7 bits would be wasted in cases where there was only 1 bit being used but it would allow for using them if required e.g. via Resize.

Each resize would add 8 bits and you could use only the bits out of the byte which you require.

If you can give me a little guidance I will implement this when I have time and submit a PR

@xivk
Copy link
Contributor Author

xivk commented Mar 9, 2020

Not sure I follow completely here... So you are saying instead of supporting Array support Array<bool[]> and assume each element to have 8 elements?

@juliusfriedman
Copy link

Yes, essentially.

I felt like it would be easier than making changes to the elementSize which is always at-least 1 byte and would otherwise require reading bits which would likely need an even bigger change.

This way you can assume the bool[] to support 8 bits with element size = 1, 16 with size = 2 etc.

This is more or less just specializing the use of bool to read in bits from a byte where as your suggested change would be to implement arbitrary bit reading would would be a bigger change.

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

2 participants