News for hackers. Stuff that matters.
Re:Do you know your bitwise operators? by gamegoblin on Friday January 10, 2014 @02:42PM (#7038851)
The only time I find myself using bit manipulations in production code is when I am writing a library that uses an int to represent a set of option flags (where each bit is a boolean flag). It's pretty common in C libs to define some constants like

    int FLAG_1 = 1;
    int FLAG_2 = 2;
    int FLAG_3 = 4; //These would actually probably be formatted like (1 << N) 
    ...
And then pass in your options to a function like f(... FLAG_1+FLAG_2) so you can have an optional number of flags in a single argument.

There are no comments on this comment yet.