When log_blocks is greater than 25, there will be overlapping bits between block id and stamp within a 32-bit hash value. So we must check if this is the case when right shifting a hash value to retrieve block id and stamp. The following two functions derive the number of bits to right shift from the given log_blocks.
| 262 | // right shifting a hash value to retrieve block id and stamp. The following two |
| 263 | // functions derive the number of bits to right shift from the given log_blocks. |
| 264 | static int ComputeBitsShiftForBlockAndStamp(int log_blocks) { |
| 265 | if (ARROW_PREDICT_FALSE(log_blocks + bits_stamp_ > bits_hash_)) { |
| 266 | return 0; |
| 267 | } |
| 268 | return bits_hash_ - log_blocks - bits_stamp_; |
| 269 | } |
| 270 | static int ComputeBitsShiftForBlock(int log_blocks) { |
| 271 | if (ARROW_PREDICT_FALSE(log_blocks + bits_stamp_ > bits_hash_)) { |
| 272 | return bits_hash_ - log_blocks; |
no outgoing calls
no test coverage detected