From 3e2650811e9e454cb80ab18b6e8618595e9ae14d Mon Sep 17 00:00:00 2001 From: Mikhail Kalinin Date: Fri, 16 Feb 2024 13:39:46 +0600 Subject: [PATCH] Introduce UINT64_MAX_SQRT --- specs/phase0/beacon-chain.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/specs/phase0/beacon-chain.md b/specs/phase0/beacon-chain.md index 572f46246c..f5ac401e96 100644 --- a/specs/phase0/beacon-chain.md +++ b/specs/phase0/beacon-chain.md @@ -179,6 +179,7 @@ The following values are (non-configurable) constants used throughout the specif | Name | Value | | - | - | | `UINT64_MAX` | `uint64(2**64 - 1)` | +| `UINT64_MAX_SQRT` | `uint64(4294967295)` | | `GENESIS_SLOT` | `Slot(0)` | | `GENESIS_EPOCH` | `Epoch(0)` | | `FAR_FUTURE_EPOCH` | `Epoch(2**64 - 1)` | @@ -601,7 +602,7 @@ def integer_squareroot(n: uint64) -> uint64: Return the largest integer ``x`` such that ``x**2 <= n``. """ if n == UINT64_MAX: - return uint64(4294967295) + return UINT64_MAX_SQRT x = n y = (x + 1) // 2 while y < x: