I like introducing people to new concepts, and I will assume this entry is for non-technologists. This is an excellent start. If I may suggest, stop insulting your readers (e.g., several places implying reader does or does not do something 'normally', or not know something). In cases where an error is well known, describe the error so it is understood you are using it as an example, and not an actual error (e.g., Nul…
> (e.g., Null character (�) a black diamond with white question mark in the middle). The description in the linked article is wrong, that's not a null character (U+0000) or ASCII's NUL. That black diamond symbol is U+FFFD the Unicode Replacement Character, it means "Something went wrong, so instead here is this symbol". For example if your decoder algorithm gets some gibberish and you can't or won't accept errors in…
Understanding the power of bitwise operators
21–30 of 48 posts
Re: Understanding the power of bitwise operators
#22Is it an autocorrect issue or the writer only-heard-never-read that the "^" character is called a “carrot”?
The "^" character is correctly named the "caret".
Re: Understanding the power of bitwise operators
#23Firstly, no one says that bitwise operators don't serve a purpose. Secondly, this is an interesting way to start an article that then goes on to explain how useful bitwise operators are for low level programming.
Re: Understanding the power of bitwise operators
#24Who is this article for exactly? It starts off by trying to relate to the reader by presenting the point about learning a new programming language, but then goes on to explain one of the most fundamental concepts of computing, as if the reader is a complete novice. I would imagine that nearly every person with programming experience, whether that be formal or not, would have at least some familiarity with binary repr…
GFX -> HTML&CSS -> JS -> WTF!
They can be great programmers in JS even but have little to no computer science behind it and more a design background.
Re: Understanding the power of bitwise operators
#25OT but his mention of the calculator reminded me of discovering just yesterday that the built in Mac calculator has a Programmer mode (apparently Windows too) for hex, etc. I’d been using the RPN/scientific mode for ever but never new about Programmer mode. I’m actually doing a fair amount of hex conversions and bit fiddling these days (webassembly bytecode) so it was actually something useful.
Re: Understanding the power of bitwise operators
#26A 64 bit register doing XOR is really 64x parallel XOR happening in parallel each of size 1 bit.
A shift, rotate are just fancy movement operators and exist in the SIMD space.
Good bitwise programming IMO requires a full embrace of this parallel mindset. See the Chess Programming Wiki for all sorts of things that 64x parallel bits can represent.
In particular, a 8x8 chessboard maps well to 64 bits.
-------
No really. Do remember that one of the OG SIMD computers, the CM2 (connection machine 2) was a 1-bit core but SIMD across thousands of cores (bits). And a lot of research and understanding of modern parallel concepts comes from the Connection Machine.
Re: Understanding the power of bitwise operators
#27Who is this article for exactly? It starts off by trying to relate to the reader by presenting the point about learning a new programming language, but then goes on to explain one of the most fundamental concepts of computing, as if the reader is a complete novice. I would imagine that nearly every person with programming experience, whether that be formal or not, would have at least some familiarity with binary repr…
> would have at least some familiarity with binary representation and bitwise operations. There's a whole generation of programmers that aren't interested in, and don't need , "low level" bitwise operations. I would claim that's a "good thing", since it means they're letting someone else do the "boring stuff" by using libraries, allowing them to spend more time solving higher level problems. When I was going to schoo…
But it's worth understanding them even if you never need to use them. Much like understanding how a computer works at a low level, that kind of knowledge helps contextualize higher-level things and puts additional tools in your toolbox.
Re: Understanding the power of bitwise operators
#28I like introducing people to new concepts, and I will assume this entry is for non-technologists. This is an excellent start. If I may suggest, stop insulting your readers (e.g., several places implying reader does or does not do something 'normally', or not know something). In cases where an error is well known, describe the error so it is understood you are using it as an example, and not an actual error (e.g., Nul…
> (e.g., Null character (�) a black diamond with white question mark in the middle). The description in the linked article is wrong, that's not a null character (U+0000) or ASCII's NUL. That black diamond symbol is U+FFFD the Unicode Replacement Character, it means "Something went wrong, so instead here is this symbol". For example if your decoder algorithm gets some gibberish and you can't or won't accept errors in…
Re: Understanding the power of bitwise operators
#29I like introducing people to new concepts, and I will assume this entry is for non-technologists. This is an excellent start. If I may suggest, stop insulting your readers (e.g., several places implying reader does or does not do something 'normally', or not know something). In cases where an error is well known, describe the error so it is understood you are using it as an example, and not an actual error (e.g., Nul…
> (e.g., Null character (�) a black diamond with white question mark in the middle). The description in the linked article is wrong, that's not a null character (U+0000) or ASCII's NUL. That black diamond symbol is U+FFFD the Unicode Replacement Character, it means "Something went wrong, so instead here is this symbol". For example if your decoder algorithm gets some gibberish and you can't or won't accept errors in…
Re: Understanding the power of bitwise operators
#30I was just doing some bit shifting yesterday. I wanted to pass a drawing function a Uint16 that would represent a 4x4 black and white pixel pattern. It was a little hack to create early MacOS-like pixel patterns in SDL. SDL has primitives for line and rectangle drawing with solid colors but little else. So I wrote some straight C, some nested for loops for row/column of the area to be patterned . I used row % 4, colu…