uraimo / bitter Goto Github PK
View Code? Open in Web Editor NEWA Swift Bits Manipulation/Bitwise Operations Toolkit
License: MIT License
A Swift Bits Manipulation/Bitwise Operations Toolkit
License: MIT License
The last line of the first example of the Specific Byte subscript section reads:
// Let's change the third byte
i[3] = 0xAA //Error! There is no 3rd byte!
However, there's no actual error here because there is a 3rd byte. I was following along in code and at first didn't catch that there's no error, so I thought maybe that Bitter was just silently ignoring the out-of-bounds index since nothing appeared to change. But of course nothing would change by setting byte 3 to 0xAA since it's already 0xAA.
Anyway, I'd suggest something like this instead:
// Let's change the fourth byte
i[4] = 0xFF //Error! There is no 4th byte!
Currently, a GYB template is used to generate specific extensions for each integer type.
Even if it's quite easy to figure out how GYB templating works, migrating the template to Sourcery will make the template seem a little less esoteric.
The bash script that generates the classes will have to be updated too.
Tagged as 1.2.0, i'm not going to push the pod yet (something else will surely change before the Swift 3.0 is released).
A small method that generates bit mask for a given number of bits could be useful sometimes.
It could look something like mask(bits:msb:)
, where bits would be the number of bits that need to be set to 1
and msb a boolean(no need for an enum here) that select if those bits need to be set from the MSB(right) or LSB(left).
Note: Since .allZeroes has been deprecated in Swift 4, when this method is available .allOnes should be removed, it makes no sense to keep it around when mask() can do the same thing and its sibling it's not around anymore.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.