GithubHelp home page GithubHelp logo

chandragillellamudi / bitbytedata Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tsolomko/bitbytedata

0.0 1.0 0.0 913 KB

Read and write bits and bytes in Swift.

License: MIT License

Swift 90.34% Ruby 0.40% Python 9.26%

bitbytedata's Introduction

BitByteData

Swift 4.2 Swift 5.X GitHub license Build Status Build Status

A Swift framework with classes for reading and writing bits and bytes.

Installation

BitByteData can be integrated into your project using Swift Package Manager, CocoaPods or Carthage.

Swift Package Manager

To install using SPM, add BitByteData to you package dependencies and specify it as a dependency for your target, e.g.:

import PackageDescription

let package = Package(
    name: "PackageName",
    dependencies: [
        .package(url: "https://github.com/tsolomko/BitByteData.git",
                 from: "1.4.0")
    ],
    targets: [
        .target(
            name: "TargetName",
            dependencies: ["BitByteData"]
        )
    ]
)

More details you can find in Swift Package Manager's Documentation.

CocoaPods

Add pod 'BitByteData', '~> 1.4' and use_frameworks! lines to your Podfile.

To complete installation, run pod install.

Carthage

Important: Only Swift 5.x is supported when installing BitByteData via Carthage.

Add to your Cartfile github "tsolomko/BitByteData" ~> 1.4.

Then run carthage update.

Finally, drag and drop BitByteData.framework from Carthage/Build folder into the "Embedded Binaries" section on your targets' "General" tab in Xcode.

Usage

Use ByteReader class to read bytes. For reading bits there are two classes: LsbBitReader and MsbBitReader, which implement BitReader protocol for two bit-numbering schemes ("LSB 0" and "MSB 0" correspondingly). Both LsbBitReader and MsbBitReader classes inherit from ByteReader so you can also use them to read bytes (but they must be aligned, see documentation for more details).

Writing bits is implemented in two classes LsbBitWriter and MsbBitWriter (again, for two bit-numbering schemes). They both conform to BitWriter protocol.

Note: All readers and writers aren't structs, but classes intentionally to make it easier to pass them as arguments to functions and to eliminate unnecessary copying and inouts.

Documentation

Every function or type of BitByteData's public API is documented. This documentation can be found at its own website.

Contributing

Whether you find a bug, have a suggestion, idea, feedback or something else, please create an issue on GitHub.

If you'd like to contribute, please create a pull request on GitHub.

Note: If you are considering working on BitByteData, please note that Xcode project (BitByteData.xcodeproj) was created manually and you shouldn't use swift package generate-xcodeproj command.

Performance and benchmarks

One of the most important goals of BitByteData's development is high speed performance. To help achieve this goal there are benchmarks for every function in the project as well as a handy command-line tool, benchmarks.py, which helps to run, show, and compare benchmarks and their results.

If you are considering contributing to the project please make sure that:

  1. Every new function has also a new benchmark added.
  2. Every other change to any existing function doesn't introduce performance regressions, or, at the very least, these regressions are small and such performance tradeoff is necessary and justifiable.

Finally, please note that any meaningful comparison can be made only between benchmarks run on the same hardware and software.

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.