Blockchain Commons Rand TypeScript Library - v1.0.0-alpha.13
    Preparing search index...

    Function toMagnitude

    • Converts a signed integer to its unsigned magnitude. For positive numbers, returns the number unchanged. For negative numbers, returns the absolute value (wrapping for MIN values).

      This matches Rust's wrapping_abs() behavior.

      Parameters

      • value: number
      • bits: 8 | 16 | 32

      Returns number