Home / File/ clz32.js — react Source File

clz32.js — react Source File

Architecture documentation for clz32.js, a javascript file in the react codebase. 0 imports, 2 dependents.

File javascript BabelCompiler Validation 2 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  9a9d2e95_7795_7f3d_d4b6_50cacf2ab78a["clz32.js"]
  768f6d67_77c1_be19_5596_a943eab59e05["ReactFiberLane.js"]
  768f6d67_77c1_be19_5596_a943eab59e05 --> 9a9d2e95_7795_7f3d_d4b6_50cacf2ab78a
  bcb1d0d7_8aa0_fc08_efc9_136215e5b3a1["ReactFiberTreeContext.js"]
  bcb1d0d7_8aa0_fc08_efc9_136215e5b3a1 --> 9a9d2e95_7795_7f3d_d4b6_50cacf2ab78a
  style 9a9d2e95_7795_7f3d_d4b6_50cacf2ab78a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */

// TODO: This is pretty well supported by browsers. Maybe we can drop it.

export const clz32: (x: number) => number = Math.clz32
  ? Math.clz32
  : clz32Fallback;

// Count leading zeros.
// Based on:
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32
const log = Math.log;
const LN2 = Math.LN2;
function clz32Fallback(x: number): number {
  const asUint = x >>> 0;
  if (asUint === 0) {
    return 32;
  }
  return (31 - ((log(asUint) / LN2) | 0)) | 0;
}

Domain

Subdomains

Functions

Frequently Asked Questions

What does clz32.js do?
clz32.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in clz32.js?
clz32.js defines 1 function(s): clz32Fallback.
What files import clz32.js?
clz32.js is imported by 2 file(s): ReactFiberLane.js, ReactFiberTreeContext.js.
Where is clz32.js in the architecture?
clz32.js is located at packages/react-reconciler/src/clz32.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-reconciler/src).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free