GithubHelp home page GithubHelp logo

Comments (6)

brianloveswords avatar brianloveswords commented on June 17, 2024

The constructor currently takes a length. Would passing an array of bytes assume the the length of the array, with appropriate adjustment made for 16 or 32 bit ints?

That strawman for specifying length doesn't seem unreasonable to me.

from bitwriter.

JerrySievert avatar JerrySievert commented on June 17, 2024

in my case, I'm writing against a graphics board that has different word lengths: header can include 8bit commands and 16bit commands like x and y.

it would be nice to be able to commingle those in the constructor.

I'd whip up some code but I'm on my way to the zoo for the day :)

from bitwriter.

brianloveswords avatar brianloveswords commented on June 17, 2024

Rad, enjoy the zoo!

Just to make sure I implement what you're asking for:

var buf = new BitWriter([ 1, 2, 64738, 23 ]);

Would basically be convenience for

var buf = new BitWriter(5);
buf
  .write(1)
  .write(2) 
  .write(64738)
  .write(23);

and

var buf = new BitWriter([ 1, 2, 64738, { value: 23, width: 16 } ]);

would be

var buf = new BitWriter(6);
buf
  .write(1)
  .write(2) 
  .write(64738)
  .write(23, { size: 16 });

from bitwriter.

JerrySievert avatar JerrySievert commented on June 17, 2024

that's exactly what I am after.

from bitwriter.

brianloveswords avatar brianloveswords commented on June 17, 2024

Done & published!

$ npm install [email protected]

from bitwriter.

JerrySievert avatar JerrySievert commented on June 17, 2024

awesome! on it in the morning to try it out! thank you very much!

from bitwriter.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.