• P
    Add some more bit operations to internal APIs (#11660) · f4e4039f
    Peter Dillinger 提交于
    Summary:
    BottomNBits() - there is a single fast instruction for this on x86 since BMI2, but testing with godbolt indicates you need at least GCC 10 for the compiler to choose that instruction from the obvious C++ code. https://godbolt.org/z/5a7Ysd41h
    
    BitwiseAnd() - this is a convenience function that works around the language flaw that the type of the result of x & y is the larger of the two input types, when it should be the smaller. This can save some ugly static_cast.
    
    I expect to use both of these in coming HyperClockCache developments, and have applied them in a couple of places in existing code.
    
    Pull Request resolved: https://github.com/facebook/rocksdb/pull/11660
    
    Test Plan: unit tests added
    
    Reviewed By: jowlyzhang
    
    Differential Revision: D47935531
    
    Pulled By: pdillinger
    
    fbshipit-source-id: d148c43a1e51df4a1c549b93aaf2725a3f8d3bd6
    f4e4039f
hash_test.cc 34.8 KB