Source/Packages

Data.UTF8

packages/foundation/standard/src/Data/UTF8.alpha

1,298 lines193 declarations53.6 KiBSHA-256 4bef3dfd330d

def · lines 358–372

utf8CodepointFromFour

Full file
(lead & 0x07) << 18 | (b1 & 0x3F) << 12 | (b2 & 0x3F) << 6 | (b3 & 0x3F)
358def utf8CodepointFromFour =
359  (lambda unrestricted lead : Byte .
360    (lambda unrestricted b1 : Byte .
361      (lambda unrestricted b2 : Byte .
362        (lambda unrestricted b3 : Byte .
363          (utf8CodepointWord
364            (byteOr
365              (byteShiftLeftTruncated (byteAnd b2 (byte 3)) utf8NaturalSix)
366              (byteAnd b3 (byte 63)))
367            (byteOr
368              (byteShiftLeftTruncated (byteAnd b1 (byte 15)) (byte-to-nat (byte 4)))
369              (byteShiftRight (byteAnd b2 (byte 63)) utf8NaturalTwo))
370            (byteOr
371              (byteShiftLeftTruncated (byteAnd lead (byte 7)) utf8NaturalTwo)
372              (byteShiftRight (byteAnd b1 (byte 63)) (byte-to-nat (byte 4)))))))))

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.