1{-# LANGUAGE MagicHash, BangPatterns #-}
4-- Module : Data.Text.Internal.Encoding.Utf16
5-- Copyright : (c) 2008, 2009 Tom Harper,
6-- (c) 2009 Bryan O'Sullivan,
7-- (c) 2009 Duncan Coutts
10-- Maintainer : bos@serpentine.com
11-- Stability : experimental
14-- /Warning/: this is an internal module, and does not have a stable
15-- API or name. Functions in this module may not check or enforce
16-- preconditions expected by public modules. Use at your own risk!
18-- Basic UTF-16 validation and character manipulation.
19module Data.Text.Internal.Encoding.Utf16
27import GHC.Word (Word16(..))
29chr2 :: Word16 -> Word16 -> Char
30chr2 (W16# a#) (W16# b#) = C# (chr# (upper# +# lower# +# 0x10000#))
34 !upper# = uncheckedIShiftL# (x# -# 0xD800#) 10#
35 !lower# = y# -# 0xDC00#
38validate1 :: Word16 -> Bool
39validate1 x1 = x1 < 0xD800 || x1 > 0xDFFF
40{-# INLINE validate1 #-}
42validate2 :: Word16 -> Word16 -> Bool
43validate2 x1 x2 = x1 >= 0xD800 && x1 <= 0xDBFF &&
44 x2 >= 0xDC00 && x2 <= 0xDFFF
45{-# INLINE validate2 #-}
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list