Giter VIP home page Giter VIP logo

Comments (6)

eerimoq avatar eerimoq commented on July 17, 2024 1

Not that I can think of, but was some time I used bincopy so I might have forgotten. If you have time you could submit a PR with the change and I can have a closer look (and maybe you encounter some problem).

from bincopy.

eerimoq avatar eerimoq commented on July 17, 2024 1

Feel free to make it public on Segment as well.

from bincopy.

eerimoq avatar eerimoq commented on July 17, 2024

Good suggestion (probably). Part of version 18.0.0.

from bincopy.

eerimoq avatar eerimoq commented on July 17, 2024

In case this breaks peoples code, I could add aliases like _Segments = Segments. I think I'll do that actually.

from bincopy.

bessman avatar bessman commented on July 17, 2024

Great! Here's another, related suggestion: Segment.chunks should yield smaller Segments instead of Chunks.

My use case is that I need to split a Segment into chunks for writing to a target device. Then I need to split those chunks into smaller chunks in order to calculate a checksum of the larger chunk. But Chunk doesn't have a .chunks method, so that doesn't work :(

Instead, I created a new Segment and chunked that:

Segment(chunk.address, chunk.address + len(chunk.data), chunk.data, 1).chunks()

But is there any reason chunks can't just yield Segments to begin with?

from bincopy.

bessman avatar bessman commented on July 17, 2024

Segment._word_size_bytes should have a public getter. It is useful to be able to get chunks of a certain number of bytes, for example when calculating a checksum. Since .chunks wants the size and alignment in words, it is necessary to know the word size to get a certain number of bytes per chunk. The Segment knows it internally, but it's only public on the BinFile, which may not be available in a subroutine.

from bincopy.

Related Issues (20)

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.