SQLITE_WITHIN macro with one compare operator
This macro now looks like:
#define SQLITE_WITHIN(P,S,E) (((uptr)(P)>=(uptr)(S))&&((uptr)(P)<(uptr)(E)))
But it can also be rewritten as:
#define SQLITE_WITHIN(P,S,E) ((uptr)((uptr)(P)-(uptr)(S))<((uptr)(E)-(uptr)(S)))
Or is this UB ? I'm just curious, because this seems to be a bit faster..
Cachegrind tells me that your rewrites is actually a little slower, on the standard SQLite performance test benchmark. I get 1,035,083,032 CPU cycles with the existing SQLITE_WITHIN and 1,035,107,651 CPU cycles with your rewrite. Your rewrite also makes the executable 45 bytes larger.
What performance measurement tool is telling you that the rewrite is faster? The numbers above are using cachegrind on a x64 with a binary generated using gcc 5.4.0 and -Os.
I didn't measured it myself. My 'knowledge' is from this topic:
Next time i will measure..