10

i fucking hate bit shifting operation fuckery

fuck your clever math and shit

also documenting what represents what in an idiot proof way so i can easily consume it

Comments
  • 2
    it's beyond me how most modern languages don't have a feature like C's bit structs

    And even in C/C++ it's only a half baked feature since it relies on compile specifics
  • 2
    Bit shifting is only math in terms of multiplying and dividing unsigned integers by two.

    (And it's a sensible optimization where applicable).

    All other uses are for boolean comparison reasons.
  • 1
    As long as it's not absolutely necessary for it to be super fast and super compact, I'd rather use a set type with enum values.

    It makes you feel less than a hacker but the code is so much better.
  • 0
    Do yourself one better and just add integer powers of two in lieu of bit twiddling. It's the same thing anyway.
  • 1
    @LotsOfCaffeine I have this complaint too. Bit Fields are lot intuitive to work with than using masks, shifts
  • 1
    @TheCommoner282

    Yes, I know it. It's one iteration of newton's method, and guess what it does? Exactly, take a float, interpret as int, and shift right, effectively halving the exponent (which handles the square root) and then using the constant to adjust the mantissa.
  • 1
    @LotsOfCaffeine oh hell yeah, bit fields in C are quite nice.
  • 1
    had an old collegue that used this when it could have more clearly been expressed in a switch statement. mind you, not less LINES of code, but more CLEAR

    you choose what is more important
Add Comment