Source/Packages

Model.Word32

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

400 lines41 declarations16.0 KiBSHA-256 cb521ab16bb6

def · lines 175–192

modelWord32FromNaturalDivided

Full file
General path: four divisions by 256 (a fold over the value each). Reached only for values of 256 and above; `modelWord32FromNaturalTruncated` takes the O(1) byte path below that (D17).
175def modelWord32FromNaturalDivided =
176  (lambda unrestricted value : Nat .
177    app
178      (lambda unrestricted quotient1 : Nat .
179        app
180          (lambda unrestricted quotient2 : Nat .
181            app
182              (lambda unrestricted quotient3 : Nat .
183                constructor
184                  ModelWord32
185                  ModelWord32Value
186                  (nat-to-byte (naturalModuloUnchecked value byteNaturalTwoHundredFiftySix))
187                  (nat-to-byte (naturalModuloUnchecked quotient1 byteNaturalTwoHundredFiftySix))
188                  (nat-to-byte (naturalModuloUnchecked quotient2 byteNaturalTwoHundredFiftySix))
189                  (nat-to-byte (naturalModuloUnchecked quotient3 byteNaturalTwoHundredFiftySix)))
190              (naturalDivideUnchecked quotient2 byteNaturalTwoHundredFiftySix))
191          (naturalDivideUnchecked quotient1 byteNaturalTwoHundredFiftySix))
192      (naturalDivideUnchecked value byteNaturalTwoHundredFiftySix))

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.