News for hackers. Stuff that matters.
Re:There are no good constant-time data structures by mirabilos on Wednesday December 03, 2014 @04:46AM (#8692765)
Right-shift of signed integer values is implementation-defined behaviour though. If (x - y) is unsigned, the comments are wrong, they would return 1, not -1.
Re:There are no good constant-time data structures by pbsd on Wednesday December 03, 2014 @11:46AM (#8694716)
The `-` is there to turn 1 into -1 (mod 2^n), and 0 into 0. I use `- (x >> (sizeof(x)*8-1))` to get arithmetic shift semantics while only using unsigned arithmetic.