fluo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kenneth mcfarland <kennethpmcfarl...@gmail.com>
Subject BitShifting
Date Sat, 28 Oct 2017 19:11:24 GMT
Hi everyone,

I was thinking about opening an issue and eliminating as much of the bit
shifting in the code as was appropriate. My reasoning is two fold.

First its simply cryptic. I'm normally used to seeing something like it
crop up in the LMAX code as a hackish way to do super fast powers of two.
So reason one is readability and clarity.

I'm not going to fuss over bytecode but the logic is to use the shift
operator as an operator, In the event the compiler doesn't optimize the
shift out ahead of time its causing an extra couple of cycles, not a big
deal but it is a very small optimization.

var = (1<<15); //could just say 32768 and be done;
int a = 1 + 3 + 2 + 5; // could just say 10 and nobody would argue

I am curious if I will get grief for suggesting this. The other context
I've seen bit shifting in is platform agnostic code, which is also of no
concern here. So please give me your thoughts on this, does this make sense?

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message