def int.of

bend-kit-redis@0.3.0.0 · redis.bend:293

import bend-kit-redis@0.3.0.0/redis.bend as Redis
import Base

293# RESP integers are signed 64-bit: the magnitude may reach 2^63 only when negative.
294def int.of(n: Num) -> Maybe<&1, Val>:
295  Num{+neg, +hi, +lo, ok} = n
296  +fits = Bool.or(U32.is_lt(hi, 2147483648), Bool.and(neg, Bool.and(U32.is_eq(hi, 2147483648), U32.is_eq(lo, 0))))
297  int.val(Bool.and(ok, fits), neg, hi, lo)

Uses (8)

Used by (1)