<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "P256K",
  "identifier" : "/documentation/P256K/Int256",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "P256K"
    ],
    "preciseIdentifier" : "s:5P256K6Int256V"
  },
  "title" : "Int256"
}
-->

# Int256

A 256-bit signed integer backed by a `UInt128` low limb and an `Int128` high limb,
conforming to `FixedWidthInteger`, `BinaryInteger`, and `SignedInteger`; the signed
counterpart to [`UInt256`](/documentation/P256K/UInt256).

```
@frozen struct Int256
```

## Overview

`Int256` is the two’s-complement counterpart to [`UInt256`](/documentation/P256K/UInt256) used where signed
arithmetic is needed (e.g. certain BIP-32 child-key derivation intermediate steps
or Miller-Rabin witness computations). The high limb is `Swift.Int128` so the sign
bit lives in its natural position (bit 255); the low limb remains `UInt128` to keep
addition / subtraction carry logic uniform with the unsigned type. Use
[`init(bitPattern:)`](/documentation/P256K/Int256/init(bitPattern:)) to reinterpret the underlying bits as [`UInt256`](/documentation/P256K/UInt256) (zero-cost),
and [`addingReportingOverflow(_:)`](/documentation/P256K/Int256/addingReportingOverflow(_:)) when callers need to detect signed overflow
without trapping.

> Important: Same caveat as ``doc://P256K/documentation/P256K/UInt256`` — operations are not constant-time and
> must not be used for secret scalar arithmetic.