R
Raj Pashwar
Hello :
My current program runs too slow. It uses x/8 and x%8 many times, where x
is an int in both cases.
I have replaced x/8 with x>>3, as this is faster (pretty sure).
However, I am not sure whether this is faster than x%8 :
x-=(x>>3)<<3;
Is this generally a good optimisation to use?
Also I've got a memory region that I constantly need to access, so I
would like it to be in cache. I know that I can use 'register' in
variable declarations, to speed up it's access. But if I have a pointer
to that mem. region and I declared it 'register' I will get faster access
to the pointer, not to the mem. region it points to, isn't it? What is
the way out of this paradox?
Thank You.
My current program runs too slow. It uses x/8 and x%8 many times, where x
is an int in both cases.
I have replaced x/8 with x>>3, as this is faster (pretty sure).
However, I am not sure whether this is faster than x%8 :
x-=(x>>3)<<3;
Is this generally a good optimisation to use?
Also I've got a memory region that I constantly need to access, so I
would like it to be in cache. I know that I can use 'register' in
variable declarations, to speed up it's access. But if I have a pointer
to that mem. region and I declared it 'register' I will get faster access
to the pointer, not to the mem. region it points to, isn't it? What is
the way out of this paradox?
Thank You.