{"id":13690209,"url":"https://github.com/tsolomko/BitByteData","last_synced_at":"2025-05-02T06:32:20.087Z","repository":{"id":56903720,"uuid":"113080628","full_name":"tsolomko/BitByteData","owner":"tsolomko","description":"Read and write bits and bytes in Swift.","archived":false,"fork":false,"pushed_at":"2024-01-11T13:54:51.000Z","size":1009,"stargazers_count":27,"open_issues_count":0,"forks_count":8,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2024-03-16T01:41:39.421Z","etag":null,"topics":["bits","bytes","data","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tsolomko.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-12-04T18:41:33.000Z","updated_at":"2024-04-15T13:33:38.695Z","dependencies_parsed_at":"2023-12-14T13:35:13.216Z","dependency_job_id":"bc781417-0b02-4590-a4cf-15504ea7ff9a","html_url":"https://github.com/tsolomko/BitByteData","commit_stats":{"total_commits":511,"total_committers":2,"mean_commits":255.5,"dds":"0.011741682974559686","last_synced_commit":"1d31cd0c13d703a5220e396f073204fa0e2588fc"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsolomko%2FBitByteData","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsolomko%2FBitByteData/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsolomko%2FBitByteData/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsolomko%2FBitByteData/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tsolomko","download_url":"https://codeload.github.com/tsolomko/BitByteData/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251998712,"owners_count":21678007,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bits","bytes","data","swift"],"created_at":"2024-08-02T16:00:49.261Z","updated_at":"2025-05-02T06:32:20.082Z","avatar_url":"https://github.com/tsolomko.png","language":"Swift","readme":"# BitByteData\n\n[![Swift 5.7+](https://img.shields.io/badge/Swift-5.7+-blue.svg)](https://developer.apple.com/swift/)\n[![GitHub license](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://raw.githubusercontent.com/tsolomko/BitByteData/master/LICENSE)\n[![Build Status](https://dev.azure.com/tsolomko/BitByteData/_apis/build/status/tsolomko.BitByteData?branchName=develop)](https://dev.azure.com/tsolomko/BitByteData/_build/latest?definitionId=2\u0026branchName=develop)\n\nA Swift framework with classes for reading and writing bits and bytes. Supported platforms include Apple platforms,\nLinux, __and Windows__.\n\n## Installation\n\nBitByteData can be integrated into your project using either Swift Package Manager, CocoaPods, or Carthage.\n\n### Swift Package Manager\n\nTo install using SPM, add BitByteData to you package dependencies and specify it as a dependency for your target, e.g.:\n\n```swift\nimport PackageDescription\n\nlet package = Package(\n    name: \"PackageName\",\n    dependencies: [\n        .package(url: \"https://github.com/tsolomko/BitByteData.git\",\n                 from: \"2.0.0\")\n    ],\n    targets: [\n        .target(\n            name: \"TargetName\",\n            dependencies: [\"BitByteData\"]\n        )\n    ]\n)\n```\n\nMore details you can find in [Swift Package Manager's Documentation](https://github.com/apple/swift-package-manager/tree/main/Documentation).\n\n### CocoaPods\n\nAdd `pod 'BitByteData', '~\u003e 2.0'` and `use_frameworks!` lines to your Podfile.\n\nTo complete installation, run `pod install`.\n\n### Carthage\n\nAdd to your Cartfile `github \"tsolomko/BitByteData\" ~\u003e 2.0`.\n\nThen:\n\n1. If you use Xcode 12 or later you should run `carthage update --use-xcframeworks`. After that drag\nand drop the `BitByteData.xcframework` file from the `Carthage/Build/` directory into the \"Frameworks, Libraries, and\nEmbedded Content\" section of your target's \"General\" tab in Xcode.\n\n2. If you use Xcode 11 or earlier you should run `carthage update`. After that drag and drop the\n`BitByteData.framework` file from from the `Carthage/Build/\u003cplatform\u003e/` directory into the \"Embedded Binaries\" section\nof your target's \"General\" tab in Xcode.\n\n## Migration to 2.0\n\nThere is a number of breaking changes in the 2.0 update. In this section you can find a list of modifications you need\nto perform to your code to make it compile with BitByteData 2.0. For more information, please refer to either\n[2.0 Release Notes](https://github.com/tsolomko/BitByteData/releases/tag/2.0.0) or\n[API Reference Documentation](http://tsolomko.github.io/BitByteData).\n\n1. `ByteReader` class has been renamed to `LittleEndianByteReader`.\n\n    __Solution:__ Change all occurrences in your code of `ByteReader` to `LittleEndianByteReader`.\n\n2. `BitReader` protocol has two new method requirements: `signedInt(fromBits:representation:)` and `advance(by:)`.\n\n    __Solution:__ If you have your own type that conforms to the `BitReader` protocol you need to implement these two\n    methods.\n\n3. `BitWriter` protocol has two new method requirements: `write(unsignedNumber:bitsCount:)` and\n`write(signedNumber:bitsCount:representation:)`.\n\n    __Solution:__ If you have your own type that conforms to the `BitWriter` protocol you need to implement the\n`write(unsignedNumber:bitsCount:)` function (the second function has a default implementation).\n\n4. The setter of the `offset` property of the `LsbBitReader` and `MsbBitReader` classes will now crash if the reader\nis not aligned.\n\n    __Solution:__ If you set this property directly, make sure that the reader is aligned, for example, by checking the\n`isAligned` property.\n\n5. The default implementation of the `BitWriter.write(number:bitsCount:)` function and the\n`write(unsignedNumber:bitsCount:)` function of the `LsbBitWriter` and `MsbBitWriter` classes now crash if the\n`bitsCount` argument exceeds the bit width of the integer type on the current platform.\n\n    __Solution:__ If you use these functions directly, make sure that the `bitsCount` argument has a valid value.\n\nIn addition, BitByteData 2.0 provides new functionality for working with signed integers more correctly. If you were\nworking with signed integers before, consider using the new `BitReader.signedInt(fromBits:representation:)` and\n`BitWriter.write(signedNumber:bitsCount:representation:)` functions instead of `int(fromBits:)` and\n`write(number:bitsCount:)`, respectively.\n\n## Usage\n\nTo read bytes use either `LittleEndianByteReader` or `BigEndianByteReader` class, which implement the `ByteReader`\nprotocol.\n\nFor reading bits there are also two classes: `LsbBitReader` and `MsbBitReader`, which implement the `BitReader` protocol\nfor two bit-numbering schemes (\"LSB 0\" and \"MSB 0\" correspondingly), though they only support Little Endian byte order.\nSince the `BitReader` protocol inherits from `ByteReader`, you can also use the `LsbBitReader` and `MsbBitReader`\nclasses to read bytes (but they must be aligned when doing so, see documentation for more details).\n\nWriting bits is implemented for two bit-numbering schemes as well: the `LsbBitWriter` and `MsbBitWriter` classes. Both\nof them conform to the `BitWriter` protocol.\n\n__Note:__ All readers and writers aren't structs, but classes intentionally to make it easier to pass them as references\nto functions. This allows to eliminate potential copying and avoid writing extra `inout`s and ampersands all over the\ncode.\n\n### Documentation\n\nEvery function or type of BitByteData's public API is documented. This documentation can be found at its own\n[website](http://tsolomko.github.io/BitByteData) or via a slightly shorter link:\n[bitbytedata.tsolomko.me](http://bitbytedata.tsolomko.me)\n\n## Contributing\n\nWhether you find a bug, have a suggestion, idea, feedback or something else, please\n[create an issue](https://github.com/tsolomko/BitByteData/issues) on GitHub. If you have any questions, you can ask\nthem on the [Discussions](https://github.com/tsolomko/BitByteData/discussions) page.\n\nIf you'd like to contribute, please [create a pull request](https://github.com/tsolomko/BitByteData/pulls) on GitHub.\n\n__Note:__ If you are considering working on BitByteData, please note that the Xcode project (BitByteData.xcodeproj)\nwas created manually and you shouldn't use the `swift package generate-xcodeproj` command.\n\n### Performance and benchmarks\n\nOne of the most important goals of BitByteData's development is high speed performance. To help achieve this goal there\nare benchmarks for every function in the project as well as a handy command-line tool, `benchmarks.py`, which helps to\nrun, show, and compare benchmarks and their results.\n\nIf you are considering contributing to the project please make sure that:\n\n1. Every new function has also a new benchmark added.\n2. Other changes to existing functionality do not introduce performance regressions, or, at the very least, these\n   regressions are small and such performance tradeoff is necessary and justifiable.\n\nFinally, please note that any meaningful comparison can be made only between benchmarks run on the same hardware and\nsoftware.\n","funding_links":[],"categories":["Bits"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsolomko%2FBitByteData","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftsolomko%2FBitByteData","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsolomko%2FBitByteData/lists"}