File: itf2half.py

package info (click to toggle)
schism 2%3A20251014-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,472 kB
  • sloc: ansic: 86,853; makefile: 658; objc: 337; python: 321; perl: 75; sh: 41; xml: 10
file content (14 lines) | stat: -rwxr-xr-x 346 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env python
import sys, struct

if sys.version_info[0] > 2:
        read = sys.stdin.buffer.read
        write = sys.stdout.buffer.write
else:
        read = sys.stdin.read
        write = sys.stdout.write

write(struct.pack('1024B', *[
        (d & 0xf0) | ((d & 0xf000) >> 12)
        for d in struct.unpack('<1024H', read(2048))
]))