Source/Packages

Model.Word64

packages/foundation/standard/src/Model/Word64.alpha

555 lines53 declarations22.7 KiBSHA-256 a47b672b4018

def · lines 533–555

modelWord64Natural

Full file
the natural a word holds (its bytes little-endian); below 2^64, so it is a word of the build's naturals too
533def modelWord64Natural =
534  (lambda unrestricted value : (family ModelWord64) .
535    eliminate
536      ModelWord64
537      (lambda unrestricted current : (family ModelWord64) . Nat)
538      value
539      (branch ModelWord64Value b0 b1 b2 b3 b4 b5 b6 b7 .
540        then (naturalAdd (byte-to-nat b0))
541          (naturalMultiply 256)
542          (naturalAdd (byte-to-nat b1))
543          (naturalMultiply 256)
544          (naturalAdd (byte-to-nat b2))
545          (naturalMultiply 256)
546          (naturalAdd (byte-to-nat b3))
547          (naturalMultiply 256)
548          (naturalAdd (byte-to-nat b4))
549          (naturalMultiply 256)
550          (naturalAdd (byte-to-nat b5))
551          (naturalMultiply 256)
552          (naturalAdd (byte-to-nat b6))
553          (naturalMultiply 256)
554          byte-to-nat
555          b7))

The compiler supplied declaration spans and resolved links from this source snapshot. This page does not assert that this file belongs to a checked closure.