4 ms·
They are fantastic for writing tests against any function that might need to bit twiddle.
by dnautics 5y ago
They are fantastic for writing tests against any function that might need to bit twiddle.
- WalterBright 5y agoYes, that is the promise. Try it for a while, you'll see what I mean.
- dnautics 5y agoAlready have, there are many more like that on a branch I haven't committed yet. I'm very happy with it: https://github.com/ityonemo/Primes/blob/f157b63d91375c62f11051dbd484615dbd17045c/PrimeZig/solution_3/src/wheel.zig#L163 https://github.com/ityonemo/Primes/blob/f157b63d91375c62f110... I've also verified that binary representations of unusual datatypes are correct and have the expected properties (~>5 yr ago, paid gig, actually my first paid gig): https://github.com/interplanetary-robot/SigmoidNumbers/blob/master/test/Posits5-test.jl https://github.com/interplanetary-robot/SigmoidNumbers/blob/... https://github.com/interplanetary-robot/SigmoidNumbers/blob/master/test/warlpiri-recasting.jl https://github.com/interplanetary-robot/SigmoidNumbers/blob/... Extremely happy with it in all cases. You can't convince me otherwise. Zig and Julia would be poorer languages if not for binary literals. My life would have been more annoying without it. It's a tool I have reached for in the past and will continue reaching for when appropriate and tasteful, I have not "abandoned it". At least, I'm one datapoint that refutes your assertion.
- WalterBright 5y ago> I'm one datapoint that refutes your assertion. There's always one! BTW, D does support 0b: https://dlang.org/spec/lex.html#BinPrefix https://dlang.org/spec/lex.html#BinPrefix
- dnautics 5y agoIt's highly unlikely I will ever use a language whose creator very wrongly assumes I don't know what I'm talking about when I talk about programming ergonomics.
- setpatchaddress 5y agoI’ve used them for almost 20 years in Ruby, several years in Swift. I do find them useful in those contexts. I haven’t used the C2x version, but one thing I expect them to be useful for is self-documentation of enums representing bitmask values.
- WalterBright 5y ago> useful for is self-documentation of enums representing bitmask values. I used to do that, and wound up back using hex. Hex is easier to read for me, as I don't have to count the digits.