{
    "Function": "log_2",
    "File": "contracts/math/ABDKMath64x64.sol",
    "Parent Contracts": [],
    "High-Level Calls": [],
    "Internal Calls": [
        "require(bool)"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function log_2(int128 x) internal pure returns (int128) {\n        require(x > 0); // dev: abdk neg log\n\n        int256 msb = 0;\n        int256 xc = x;\n        if (xc >= 0x10000000000000000) {\n            xc >>= 64;\n            msb += 64;\n        }\n        if (xc >= 0x100000000) {\n            xc >>= 32;\n            msb += 32;\n        }\n        if (xc >= 0x10000) {\n            xc >>= 16;\n            msb += 16;\n        }\n        if (xc >= 0x100) {\n            xc >>= 8;\n            msb += 8;\n        }\n        if (xc >= 0x10) {\n            xc >>= 4;\n            msb += 4;\n        }\n        if (xc >= 0x4) {\n            xc >>= 2;\n            msb += 2;\n        }\n        if (xc >= 0x2) msb += 1; // No need to shift xc anymore\n\n        int256 result = (msb - 64) << 64;\n        uint256 ux = uint256(x) << uint256(127 - msb);\n        for (int256 bit = 0x8000000000000000; bit > 0; bit >>= 1) {\n            ux *= ux;\n            uint256 b = ux >> 255;\n            ux >>= 127 + b;\n            result += bit * int256(b);\n        }\n\n        return int128(result);\n    }"
}