<s> """<STR_LIT>""" <EOL> import sys <EOL> from pypy . rlib . runicode import MAXUNICODE <EOL> if MAXUNICODE <= <NUM_LIT> : <EOL> UNICODE_SIZE = <NUM_LIT:2> <EOL> else : <EOL> UNICODE_SIZE = <NUM_LIT:4> <EOL> BIGENDIAN = sys . byteorder == "<STR_LIT>" <EOL> def pack_unichar ( unich , charlist ) : <EOL> if UNICODE_SIZE == <NUM_LIT:2> : <EOL> if BIGENDIAN : <EOL> charlist . append ( chr ( ord ( unich ) >> <NUM_LIT:8> ) ) <EOL> charlist . append ( chr ( ord ( unich ) & <NUM_LIT> ) ) <EOL> else : <EOL> charlist . append ( chr ( ord ( unich ) & <NUM_LIT> ) ) <EOL> charlist . append ( chr ( ord ( unich ) >> <NUM_LIT:8> ) ) <EOL> else : <EOL> if BIGENDIAN : <EOL> charlist . append ( chr ( ord ( unich ) >> <NUM_LIT> ) ) <EOL> charlist . append ( chr ( ( ord ( unich ) >> <NUM_LIT:16> ) & <NUM_LIT> ) ) <EOL> charlist . append ( chr ( ( ord ( unich ) >> <NUM_LIT:8> ) & <NUM_LIT> ) ) <EOL> charlist . append ( chr ( ord ( unich ) & <NUM_LIT> ) ) <EOL> else : <EOL> charlist . append ( chr ( ord ( unich ) & <NUM_LIT> ) ) <EOL> charlist . append ( chr ( ( ord ( unich ) >> <NUM_LIT:8> ) & <NUM_LIT> ) ) <EOL> charlist . append ( chr ( ( ord ( unich ) >> <NUM_LIT:16> ) & <NUM_LIT> ) ) <EOL> charlist . append ( chr ( ord ( unich ) >> <NUM_LIT> ) ) <EOL> def unpack_unichar ( rawstring ) : <EOL> assert len ( rawstring ) == UNICODE_SIZE <EOL> if UNICODE_SIZE == <NUM_LIT:2> : <EOL> if BIGENDIAN : <EOL> n = ( ord ( rawstring [ <NUM_LIT:0> ] ) << <NUM_LIT:8> | <EOL> ord ( rawstring [ <NUM_LIT:1> ] ) ) <EOL> else : <EOL> n = ( ord ( rawstring [ <NUM_LIT:0> ] ) | <EOL> ord ( rawstring [ <NUM_LIT:1> ] ) << <NUM_LIT:8> ) <EOL> else : <EOL> if BIGENDIAN : <EOL> n = ( ord ( rawstring [ <NUM_LIT:0> ] ) << <NUM_LIT> | <EOL> ord ( rawstring [ <NUM_LIT:1> ] ) << <NUM_LIT:16> | <EOL> ord ( rawstring [ <NUM_LIT:2> ] ) << <NUM_LIT:8> | <EOL> ord ( rawstring [ <NUM_LIT:3> ] ) ) <EOL> else : <EOL> n = ( ord ( rawstring [ <NUM_LIT:0> ] ) | <EOL> ord ( rawstring [ <NUM_LIT:1> ] ) << <NUM_LIT:8> | <EOL> ord ( rawstring [ <NUM_LIT:2> ] ) << <NUM_LIT:16> | <EOL> ord ( rawstring [ <NUM_LIT:3> ] ) << <NUM_LIT> ) <EOL> return unichr ( n ) </s>
