bit32.countrz

bit32.countrz(n: number) : integer|number

Returns the number of consecutive zero bits in the 32-bit representation of n starting from the right-most (least significant) bit. Returns 32 if n is 0.

Example

bit32.countrz(12)
{
  "def": "func",
  "name": "countrz",
  "energy": 0,
  "pure": true,
  "sleep": 0,
  "signatures": [
    {
      "result": [
        {
          "name": "",
          "def": "result",
          "desc": "",
          "variadic": false,
          "type": [
            "integer"
          ],
          "optional": false
        }
      ],
      "args": [
        {
          "def": "arg",
          "name": "n",
          "desc": "",
          "type": [
            "integer"
          ],
          "variadic": false,
          "optional": false
        }
      ]
    },
    {
      "result": [
        {
          "name": "",
          "def": "result",
          "desc": "",
          "variadic": false,
          "type": [
            "number"
          ],
          "optional": false
        }
      ],
      "args": [
        {
          "def": "arg",
          "name": "n",
          "desc": "",
          "type": [
            "integer",
            "number"
          ],
          "variadic": false,
          "optional": false
        }
      ]
    }
  ],
  "desc": "Returns the number of consecutive zero bits in the 32-bit representation of `n` starting from the right-most (least significant) bit.\nReturns `32` if `n` is `0`.",
  "link": "https://luau.org/library#bit32-library#:~:text=function%20bit32.countrz"
}

< Back to bit32