1{-# LANGUAGE MagicHash, BangPatterns #-}
4-- Module : Data.Text.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, rtomharper@googlemail.com,
12-- Stability : experimental
15-- Basic UTF-16 validation and character manipulation.
16module Data.Text.Encoding.Utf16
24import GHC.Word (Word16(..))
26chr2 :: Word16 -> Word16 -> Char
27chr2 (W16# a#) (W16# b#) = C# (chr# (upper# +# lower# +# 0x10000#))
31 !upper# = uncheckedIShiftL# (x# -# 0xD800#) 10#
32 !lower# = y# -# 0xDC00#
35validate1 :: Word16 -> Bool
36validate1 x1 = x1 < 0xD800 || x1 > 0xDFFF
37{-# INLINE validate1 #-}
39validate2 :: Word16 -> Word16 -> Bool
40validate2 x1 x2 = x1 >= 0xD800 && x1 <= 0xDBFF &&
41 x2 >= 0xDC00 && x2 <= 0xDFFF
42{-# 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