3 ms·
Note that libdivide may sound like an improvement, however there are better solutions today: 1) full-blown compiler/engines like LLVM or GCC build close to opt
by Lockal 2y ago
Note that libdivide may sound like an improvement, however there are better solutions today:
1) full-blown compiler/engines like LLVM or GCC build close to optimal shift/mul-based code (without overhead for simple constants like "2")
2) if one can't include LLVM, there are lightweight libraries like xbyak or asmjit, where one can implement optimal jit solution. See https://github.com/herumi/xbyak/blob/80477f635345e8f13efc512d84b01b94cad92cd9/sample/quantize.cpp https://github.com/herumi/xbyak/blob/80477f635345e8f13efc512... as a starting point.