Comments (4)
The whole point of this package is to compactly store bits in a larger buffer. It's expected that when you view the buffer as a bunch of 32 bit ints it will look like nonsense.
I don't know what to tell you.
from bitfield.
If you want to get a friendly array, loop over the BitField using b.get(i)
to extract the values and put them into an array yourself.
from bitfield.
got it , but why when you call b.set(0) , it internally set the most significant bit ?
why not using (1 << (i % 8)) instead? if you make this the buffer will look like this
[1, 0, 0, 0, 0, 0, 0, 0, …]
if you b.set(1) you can
[3, 0, 0, 0, 0, 0, 0, 0, …]
with your module you get
[128, 0, 0, 0, 0, 0, 0, 0, …]
and
[64, 0, 0, 0, 0, 0, 0, 0, …]
if anyone has the same kind of issue to export as 32 bits integers , you can use swap32() on the buffer
from bitfield.
It sets bits from left to right, because that's the most useful for building up a bitfield when working with low-level wire protocols.
from bitfield.
Related Issues (9)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bitfield.